[libcamera-devel] [PATCH v3 03/16] test: control_list: Test ControlList::merge()
Jacopo Mondi
jacopo at jmondi.org
Wed Apr 21 18:03:06 CEST 2021
Test the newly introduce ControlList::merge() method by creating
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.
+ */
+ 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;
+ }
+
return TestPass;
}
};
--
2.31.1
More information about the libcamera-devel
mailing list