[libcamera-devel] [RFC PATCH v2 4/9] libcamera: test: Add ControlInfo tests

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Jun 21 18:13:56 CEST 2019


Provide an initial test coverage for the ControlInfo class.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 test/controls.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
 test/meson.build  |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 test/controls.cpp

diff --git a/test/controls.cpp b/test/controls.cpp
new file mode 100644
index 000000000000..94e89f270108
--- /dev/null
+++ b/test/controls.cpp
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2019, Google Inc.
+ *
+ * controls.cpp - Control tests
+ */
+
+#include <iostream>
+
+#include <libcamera/controls.h>
+
+#include "test.h"
+
+using namespace std;
+using namespace libcamera;
+
+class Controls : public Test
+{
+protected:
+	int testControlInfo()
+	{
+		ControlInfo gainInfo(ManualGain);
+		cout << "Gain Info: " << gainInfo << endl;
+
+		return TestPass;
+	}
+
+	int run()
+	{
+		int ret;
+
+		ret = testControlInfo();
+		if (ret)
+			return ret;
+
+		return TestPass;
+	}
+};
+
+TEST_REGISTER(Controls)
diff --git a/test/meson.build b/test/meson.build
index eff541ddc0a6..0b3e6c6813e6 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -9,6 +9,7 @@ subdir('v4l2_subdevice')
 subdir('v4l2_videodevice')
 
 public_tests = [
+    ['controls',                        'controls.cpp'],
     ['event',                           'event.cpp'],
     ['event-dispatcher',                'event-dispatcher.cpp'],
     ['geometry',                        'geometry.cpp'],
-- 
2.20.1



More information about the libcamera-devel mailing list