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>
This commit is contained in:
parent
4e3f835126
commit
79fbecea45
1 changed files with 22 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue