summaryrefslogtreecommitdiff
path: root/test/controls
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-27 19:20:39 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-20 21:47:20 +0200
commitfac471e812a988905aa2c6a0914f5fc9a72ee111 (patch)
tree972d09ff4043130d3b8d31f7cf53bdc26e5c51cc /test/controls
parent6b3308ba1b15a5be6df8fc34315cc896b077d0d0 (diff)
test: Extract CameraTest class out of camera tests to libtest
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'test/controls')
-rw-r--r--test/controls/control_list.cpp39
1 files changed, 7 insertions, 32 deletions
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 <libcamera/controls.h>
#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> camera_;
};
TEST_REGISTER(ControlListTest)