diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-04-29 19:29:35 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-05-17 20:35:09 +0200 |
commit | 9c1fe51ebc33684a2205dfb92dde469f436c855c (patch) | |
tree | 5e492963bc10daebca475e6b6f8d0ccc3d3b05f5 /test/media_device/media_device_acquire.cpp | |
parent | 9654d1f64a216214304706802fab19a71eaf5cf1 (diff) |
test: media_device: Add test for acquire() and release()
The interfaces MediaDevice::{open,close}() are about to be made private,
replace them with a test of MediaDevice::{acquire,release}() instead.
The new test will implicitly tests the open() and close() methods as
they are about to be move inside acquire() and release() which will
remain public.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/media_device/media_device_acquire.cpp')
-rw-r--r-- | test/media_device/media_device_acquire.cpp | 33 |
1 files changed, 33 insertions, 0 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); |