summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/media_device/media_device_acquire.cpp33
-rw-r--r--test/media_device/media_device_print_test.cpp11
-rw-r--r--test/media_device/meson.build1
3 files changed, 34 insertions, 11 deletions
diff --git a/test/media_device/media_device_acquire.cpp b/test/media_device/media_device_acquire.cpp
new file mode 100644
index 00000000..d1e3d744
--- /dev/null
+++ b/test/media_device/media_device_acquire.cpp
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2019, Google Inc.
+ *
+ * media_device_acquire.cpp- Test acquire/release of a MediaDevice
+ */
+
+#include "media_device_test.h"
+
+using namespace libcamera;
+
+class MediaDeviceAcquire : public MediaDeviceTest
+{
+ int run()
+ {
+ if (!media_->acquire())
+ return TestFail;
+
+ if (media_->acquire())
+ return TestFail;
+
+ media_->release();
+
+ if (!media_->acquire())
+ return TestFail;
+
+ media_->release();
+
+ return TestPass;
+ }
+};
+
+TEST_REGISTER(MediaDeviceAcquire);
diff --git a/test/media_device/media_device_print_test.cpp b/test/media_device/media_device_print_test.cpp
index ceffd538..30d929b8 100644
--- a/test/media_device/media_device_print_test.cpp
+++ b/test/media_device/media_device_print_test.cpp
@@ -113,17 +113,6 @@ int MediaDevicePrintTest::testMediaDevice(const string deviceNode)
MediaDevice dev(deviceNode);
int ret;
- /* Fuzzy open/close sequence. */
- ret = dev.open();
- if (ret)
- return ret;
-
- ret = dev.open();
- if (!ret)
- return ret;
-
- dev.close();
-
ret = dev.populate();
if (ret)
return ret;
diff --git a/test/media_device/meson.build b/test/media_device/meson.build
index 42913113..7ac6c2db 100644
--- a/test/media_device/meson.build
+++ b/test/media_device/meson.build
@@ -3,6 +3,7 @@ lib_mdev_test_sources = files([
])
media_device_tests = [
+ ['media_device_acquire', 'media_device_acquire.cpp'],
['media_device_print_test', 'media_device_print_test.cpp'],
['media_device_link_test', 'media_device_link_test.cpp'],
]