[libcamera-devel] [PATCH v3 2/5] test: control serialization: Test lookup by ControlId

Jacopo Mondi jacopo at jmondi.org
Mon Aug 9 17:23:05 CEST 2021


Test that lookup by ControlId reference works in the control
serialization test making sure that the control limits are not changed by
de-serialization.

The test currently fails and demonstates that lookup by ControlId is
currently not supported until the introduction of the next patch.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 test/serialization/control_serialization.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/serialization/control_serialization.cpp b/test/serialization/control_serialization.cpp
index e23383d13bd6..5ac9c4ede5f9 100644
--- a/test/serialization/control_serialization.cpp
+++ b/test/serialization/control_serialization.cpp
@@ -140,6 +140,15 @@ protected:
 			return TestFail;
 		}
 
+		/* Make sure control limits looked up by id are not changed. */
+		const ControlInfo &newLimits = newInfoMap.at(&controls::Brightness);
+		const ControlInfo &initialLimits = infoMap.at(&controls::Brightness);
+		if (newLimits.min() != initialLimits.min() ||
+		    newLimits.max() != initialLimits.max()) {
+			cerr << "The brightness control limits have changed" << endl;
+			return TestFail;
+		}
+
 		/* Deserialize the control list and verify the contents. */
 		buffer = ByteStreamBuffer(const_cast<const uint8_t *>(listData.data()),
 					  listData.size());
-- 
2.32.0



More information about the libcamera-devel mailing list