Skip to content

Commit

Permalink
Skip a couple more tests when a backend can't use audio input
Browse files Browse the repository at this point in the history
  • Loading branch information
padenot committed Apr 25, 2023
1 parent 245f669 commit 9b05c26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 4 additions & 2 deletions test/test_duplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,17 @@ TEST(cubeb, duplex_collection_change_no_unregister)

r = common_init(&ctx, "Cubeb duplex example with collection change");
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
ctx, [](cubeb * p) noexcept { EXPECT_DEATH(cubeb_destroy(p), ""); });

/* This test needs an available input device, skip it if this host does not
* have one. */
if (!can_run_audio_input_test(ctx)) {
cubeb_destroy(ctx);
return;
}

std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
ctx, [](cubeb * p) noexcept { EXPECT_DEATH(cubeb_destroy(p), ""); });

duplex_collection_change_impl(ctx);
}

Expand Down
14 changes: 11 additions & 3 deletions test/test_loopback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ void run_loopback_separate_streams_test(bool is_float)
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);

if (!can_run_audio_input_test(ctx)) {
return;
}

input_params.format = is_float ? CUBEB_SAMPLE_FLOAT32NE : CUBEB_SAMPLE_S16LE;
input_params.rate = SAMPLE_FREQUENCY;
input_params.channels = 1;
Expand Down Expand Up @@ -429,6 +433,10 @@ void run_loopback_silence_test(bool is_float)
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);

if (!can_run_audio_input_test(ctx)) {
return;
}

input_params.format = is_float ? CUBEB_SAMPLE_FLOAT32NE : CUBEB_SAMPLE_S16LE;
input_params.rate = SAMPLE_FREQUENCY;
input_params.channels = 1;
Expand Down Expand Up @@ -489,13 +497,13 @@ void run_loopback_device_selection_test(bool is_float)
r = common_init(&ctx, "Cubeb loopback example: device selection, separate streams");
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";

std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);

if (!can_run_audio_input_test(ctx)) {
return;
}

std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);

r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection);
if (r == CUBEB_ERROR_NOT_SUPPORTED) {
fprintf(stderr, "Device enumeration not supported"
Expand Down

0 comments on commit 9b05c26

Please sign in to comment.