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/camera/statemachine.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'test/camera/statemachine.cpp') diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp index 12d5e0e1..afa13ba7 100644 --- a/test/camera/statemachine.cpp +++ b/test/camera/statemachine.cpp @@ -8,13 +8,20 @@ #include #include "camera_test.h" +#include "test.h" using namespace std; namespace { -class Statemachine : public CameraTest +class Statemachine : public CameraTest, public Test { +public: + Statemachine() + : CameraTest("VIMC Sensor B") + { + } + protected: int testAvailable() { @@ -233,14 +240,12 @@ protected: int init() override { - int ret = CameraTest::init(); - if (ret) - return ret; + if (status_ != TestPass) + return status_; defconf_ = camera_->generateConfiguration({ StreamRole::VideoRecording }); if (!defconf_) { cout << "Failed to generate default configuration" << endl; - CameraTest::cleanup(); return TestFail; } -- cgit v1.2.1