aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_duplex.cpp12
-rw-r--r--test/test_loopback.cpp6
2 files changed, 18 insertions, 0 deletions
diff --git a/test/test_duplex.cpp b/test/test_duplex.cpp
index 5eda95f..81efcd3 100644
--- a/test/test_duplex.cpp
+++ b/test/test_duplex.cpp
@@ -184,6 +184,12 @@ TEST(cubeb, duplex_collection_change)
std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
ctx, cubeb_destroy);
+ /* This test needs an available input device, skip it if this host does not
+ * have one. */
+ if (!can_run_audio_input_test(ctx)) {
+ return;
+ }
+
duplex_collection_change_impl(ctx);
r = cubeb_register_device_collection_changed(
ctx, static_cast<cubeb_device_type>(CUBEB_DEVICE_TYPE_INPUT), nullptr,
@@ -201,6 +207,12 @@ TEST(cubeb, duplex_collection_change_no_unregister)
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)) {
+ return;
+ }
+
duplex_collection_change_impl(ctx);
}
diff --git a/test/test_loopback.cpp b/test/test_loopback.cpp
index ce29d6e..e2c8343 100644
--- a/test/test_loopback.cpp
+++ b/test/test_loopback.cpp
@@ -267,6 +267,12 @@ void run_loopback_duplex_test(bool is_float)
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
+ /* This test needs an available input device, skip it if this host does not
+ * have one. */
+ 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;