summaryrefslogtreecommitdiff
path: root/test/controls/control_value.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-01 20:44:01 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-20 16:47:45 +0200
commit79fbecea456ccf05a76e23ee9bf61b5b057950c9 (patch)
treeefab14aa57943b7b899d671b3f9e7382f0f23bf9 /test/controls/control_value.cpp
parent4e3f835126b5116f5cec88634e18f3d54900892d (diff)
test: controls: control_value: Test string control type
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@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'test/controls/control_value.cpp')
-rw-r--r--test/controls/control_value.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/controls/control_value.cpp b/test/controls/control_value.cpp
index a7ebf60f..ad8e05d0 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;
}
};