[libcamera-devel] [PATCH 04/11] test: controls: control_value: Test string control type
Jacopo Mondi
jacopo at jmondi.org
Fri Mar 20 13:09:41 CET 2020
Hi Laurent,
On Mon, Mar 09, 2020 at 05:24:07PM +0100, Jacopo Mondi wrote:
> 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>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Thanks
j
> ---
> 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
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
More information about the libcamera-devel
mailing list