aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_devices.cpp
diff options
context:
space:
mode:
authorDan Glastonbury <[email protected]>2017-05-29 13:14:08 +1000
committerMatthew Gregan <[email protected]>2017-05-29 15:51:19 +1200
commit087dc942a9a3bb5cbb88e3763cde7fe709db99e9 (patch)
tree79e22e8b64b05b234396fd5c4ac07db82ec04411 /test/test_devices.cpp
parent040cf4afa26bd46f4343d3b7fd1d2b9211e503b2 (diff)
downloadcubeb-087dc942a9a3bb5cbb88e3763cde7fe709db99e9.tar.gz
cubeb-087dc942a9a3bb5cbb88e3763cde7fe709db99e9.zip
cubeb: Test cubeb_device_collection_destroy behaviour.
Diffstat (limited to 'test/test_devices.cpp')
-rw-r--r--test/test_devices.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_devices.cpp b/test/test_devices.cpp
index 8bc9190..5177961 100644
--- a/test/test_devices.cpp
+++ b/test/test_devices.cpp
@@ -105,6 +105,29 @@ print_device_collection(cubeb_device_collection * collection, FILE * f)
print_device_info(&collection->device[i], f);
}
+TEST(cubeb, destroy_default_collection)
+{
+ int r;
+ cubeb * ctx = NULL;
+ cubeb_device_collection collection{ nullptr, 0 };
+
+ r = common_init(&ctx, "Cubeb audio test");
+ ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
+
+ std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
+ cleanup_cubeb_at_exit(ctx, cubeb_destroy);
+
+ ASSERT_EQ(collection.device, nullptr);
+ ASSERT_EQ(collection.count, (size_t) 0);
+
+ r = cubeb_device_collection_destroy(ctx, &collection);
+ if (r != CUBEB_ERROR_NOT_SUPPORTED) {
+ ASSERT_EQ(r, CUBEB_OK);
+ ASSERT_EQ(collection.device, nullptr);
+ ASSERT_EQ(collection.count, (size_t) 0);
+ }
+}
+
TEST(cubeb, enumerate_devices)
{
int r;