aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2023-04-25 16:41:15 +0200
committerPaul Adenot <[email protected]>2023-04-26 14:28:46 +0200
commit1ba923736487443f5c7be09bdb6bb894f9ee9d06 (patch)
treeafe4ed53ad371110005d2949118e5ad81a364c2b /test
parent88900545d4ada75c002d4a73b902d58f497e707e (diff)
downloadcubeb-1ba923736487443f5c7be09bdb6bb894f9ee9d06.tar.gz
cubeb-1ba923736487443f5c7be09bdb6bb894f9ee9d06.zip
Skip a couple more tests when a backend can't use audio input
Diffstat (limited to 'test')
-rw-r--r--test/test_duplex.cpp6
-rw-r--r--test/test_loopback.cpp14
2 files changed, 15 insertions, 5 deletions
diff --git a/test/test_duplex.cpp b/test/test_duplex.cpp
index 81efcd3..1eb661e 100644
--- a/test/test_duplex.cpp
+++ b/test/test_duplex.cpp
@@ -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);
}
diff --git a/test/test_loopback.cpp b/test/test_loopback.cpp
index e2c8343..bbb9409 100644
--- a/test/test_loopback.cpp
+++ b/test/test_loopback.cpp
@@ -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;
@@ -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;
@@ -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"