[libcamera-devel] [PATCH v3 03/16] test: control_list: Test ControlList::merge()
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Apr 26 06:26:12 CEST 2021
Hi Jacopo,
Thank you for the patch.
On Wed, Apr 21, 2021 at 06:03:06PM +0200, Jacopo Mondi wrote:
> Test the newly introduce ControlList::merge() method by creating
s/introduce/introduced/ or just drop "newly introduce".
> a new list with a single control and merging it with the existing one.
>
> Test that the merged list contains all the controls and their values
> are not changed.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
> test/controls/control_list.cpp | 40 ++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp
> index 2b321ddd6fa4..91b38993abf9 100644
> --- a/test/controls/control_list.cpp
> +++ b/test/controls/control_list.cpp
> @@ -150,6 +150,46 @@ protected:
> return TestFail;
> }
>
> + /*
> + * Create a new list with a new control and merge it with the
> + * existing one, verifying that the existing controls
> + * values does not get changed.
"existing control values don't get changed"
> + */
> + ControlList mergeList(controls::controls, &validator);
> + mergeList.set(controls::Saturation, 0.4f);
> +
> + mergeList.merge(list);
> + if (mergeList.size() != 3) {
> + cout << "Merged list should contain three elements" << endl;
> + return TestFail;
> + }
> +
> + if (!mergeList.contains(controls::Brightness) ||
> + !mergeList.contains(controls::Contrast) ||
> + !mergeList.contains(controls::Saturation)) {
> + cout << "Merged list does not contain all controls it should"
> + << endl;
> + return TestFail;
> + }
> +
> + if (mergeList.get(controls::Brightness) != 0.5f) {
> + cout << "Brightness control value changed after merging lists"
> + << endl;
> + return TestFail;
> + }
> +
> + if (mergeList.get(controls::Contrast) != 1.1f) {
> + cout << "Contrast control value changed after merging lists"
> + << endl;
> + return TestFail;
> + }
> +
> + if (mergeList.get(controls::Saturation) != 0.4f) {
> + cout << "Saturation control value changed after merging lists"
> + << endl;
> + return TestFail;
> + }
Could you please also test that list.size() is zero after the merge ?
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> +
> return TestPass;
> }
> };
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list