@@ -305,6 +305,47 @@ CK_START_TEST(test_play_dbus_signals) {
305
305
306
306
} CK_END_TEST
307
307
308
+ #if WITH_LIBSAMPLERATE
309
+ CK_START_TEST (test_play_resampler ) {
310
+
311
+ struct spawn_process sp_ba_mock ;
312
+ ck_assert_int_ne (spawn_bluealsa_mock (& sp_ba_mock , NULL , true,
313
+ "--profile=a2dp-sink" ,
314
+ NULL ), -1 );
315
+
316
+ struct spawn_process sp_ba_aplay ;
317
+ ck_assert_int_ne (spawn_bluealsa_aplay (& sp_ba_aplay ,
318
+ "--profile-a2dp" ,
319
+ "--pcm=null" ,
320
+ "--resampler=fastest" ,
321
+ "--volume=none" ,
322
+ "-v" , "-v" , "-v" , "-v" , "-v" ,
323
+ NULL ), -1 );
324
+ spawn_terminate (& sp_ba_aplay , 500 );
325
+
326
+ char output [8192 ] = "" ;
327
+ ck_assert_int_gt (spawn_read (& sp_ba_aplay , NULL , 0 , output , sizeof (output )), 0 );
328
+
329
+ ck_assert_ptr_ne (strstr (output ,
330
+ "Used configuration for 12:34:56:78:9A:BC" ), NULL );
331
+ ck_assert_ptr_ne (strstr (output ,
332
+ "Used configuration for 23:45:67:89:AB:CD" ), NULL );
333
+ ck_assert_ptr_ne (strstr (output ,
334
+ "Resampler method: fastest" ), NULL );
335
+
336
+ #if DEBUG
337
+ /* check if the resampler correctly configured */
338
+ ck_assert_ptr_ne (strstr (output ,
339
+ "Resampler rate ratio: 1.00000000" ), NULL );
340
+ #endif
341
+
342
+ spawn_close (& sp_ba_aplay , NULL );
343
+ spawn_terminate (& sp_ba_mock , 0 );
344
+ spawn_close (& sp_ba_mock , NULL );
345
+
346
+ } CK_END_TEST
347
+ #endif
348
+
308
349
int main (int argc , char * argv []) {
309
350
preload (argc , argv , ".libs/libaloader.so" );
310
351
@@ -330,6 +371,9 @@ int main(int argc, char *argv[]) {
330
371
tcase_add_test (tc , test_play_single_audio );
331
372
tcase_add_test (tc , test_play_mixer_setup );
332
373
tcase_add_test (tc , test_play_dbus_signals );
374
+ #if WITH_LIBSAMPLERATE
375
+ tcase_add_test (tc , test_play_resampler );
376
+ #endif
333
377
334
378
srunner_run_all (sr , CK_ENV );
335
379
int nf = srunner_ntests_failed (sr );
0 commit comments