From f3a12332f6d987b34893b2a41294dba6db5feb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= Date: Mon, 28 Apr 2025 11:02:38 +0200 Subject: lc-compliance: Move camera setup to CameraHolder class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Different base classes can be used for different setups on tests, but all of them will need to setup the camera for the test. To reuse that code, move it to a separate CameraHolder class that is inherited by test classes. Signed-off-by: Nícolas F. R. A. Prado Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Signed-off-by: Paul Elder Signed-off-by: Sven Püschel --- src/apps/lc-compliance/tests/capture_test.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/apps/lc-compliance/tests/capture_test.cpp') diff --git a/src/apps/lc-compliance/tests/capture_test.cpp b/src/apps/lc-compliance/tests/capture_test.cpp index d02caa8a..29d8b7f8 100644 --- a/src/apps/lc-compliance/tests/capture_test.cpp +++ b/src/apps/lc-compliance/tests/capture_test.cpp @@ -15,13 +15,13 @@ #include -#include "environment.h" +#include "test_base.h" namespace { using namespace libcamera; -class SimpleCapture : public testing::TestWithParam, int>> +class SimpleCapture : public testing::TestWithParam, int>>, public CameraHolder { public: static std::string nameParameters(const testing::TestParamInfo &info); @@ -29,8 +29,6 @@ public: protected: void SetUp() override; void TearDown() override; - - std::shared_ptr camera_; }; /* @@ -39,20 +37,12 @@ protected: */ void SimpleCapture::SetUp() { - Environment *env = Environment::get(); - - camera_ = env->cm()->get(env->cameraId()); - - ASSERT_EQ(camera_->acquire(), 0); + acquireCamera(); } void SimpleCapture::TearDown() { - if (!camera_) - return; - - camera_->release(); - camera_.reset(); + releaseCamera(); } std::string SimpleCapture::nameParameters(const testing::TestParamInfo &info) -- cgit v1.2.1