From fac471e812a988905aa2c6a0914f5fc9a72ee111 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 27 Oct 2019 19:20:39 +0200 Subject: test: Extract CameraTest class out of camera tests to libtest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many tests other than the camera/ tests use a camera. To increase code sharing, move the base CameraTest class to the test library. The class becomes a helper that doesn't inherit from Test anymore (to avoid diamond inheritance issues when more such helpers will exist). Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- test/controls/control_list.cpp | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) (limited to 'test/controls') diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp index 5af53f64..4d212abd 100644 --- a/test/controls/control_list.cpp +++ b/test/controls/control_list.cpp @@ -13,32 +13,22 @@ #include #include "camera_controls.h" + +#include "camera_test.h" #include "test.h" using namespace std; using namespace libcamera; -class ControlListTest : public Test +class ControlListTest : public CameraTest, public Test { -protected: - int init() +public: + ControlListTest() + : CameraTest("VIMC Sensor B") { - cm_ = new CameraManager(); - - if (cm_->start()) { - cout << "Failed to start camera manager" << endl; - return TestFail; - } - - camera_ = cm_->get("VIMC Sensor B"); - if (!camera_) { - cout << "Can not find VIMC camera" << endl; - return TestSkip; - } - - return TestPass; } +protected: int run() { CameraControlValidator validator(camera_.get()); @@ -156,21 +146,6 @@ protected: return TestPass; } - - void cleanup() - { - if (camera_) { - camera_->release(); - camera_.reset(); - } - - cm_->stop(); - delete cm_; - } - -private: - CameraManager *cm_; - std::shared_ptr camera_; }; TEST_REGISTER(ControlListTest) -- cgit v1.2.1