[libcamera-devel] [PATCH 04/11] test: controls: control_value: Test string control type
Jacopo Mondi
jacopo at jmondi.org
Mon Mar 9 17:24:07 CET 2020
From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Add test cases for the string control type. As strings are implemented
as char arrays, arrays of strings are not supported.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
test/controls/control_value.cpp | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/controls/control_value.cpp b/test/controls/control_value.cpp
index a7ebf60f6a6a..ad8e05d0b1a9 100644
--- a/test/controls/control_value.cpp
+++ b/test/controls/control_value.cpp
@@ -235,6 +235,28 @@ protected:
return TestFail;
}
+ /*
+ * String type.
+ */
+ std::string string{ "libcamera" };
+ value.set(string);
+ if (value.isNone() || !value.isArray() ||
+ value.type() != ControlTypeString ||
+ value.numElements() != string.size()) {
+ cerr << "Control type mismatch after setting to string" << endl;
+ return TestFail;
+ }
+
+ if (value.get<std::string>() != string) {
+ cerr << "Control value mismatch after setting to string" << endl;
+ return TestFail;
+ }
+
+ if (value.toString() != string) {
+ cerr << "Control string mismatch after setting to string" << endl;
+ return TestFail;
+ }
+
return TestPass;
}
};
--
2.25.0
More information about the libcamera-devel
mailing list