[libcamera-devel,v4,2/5] test: control serialization: Test lookup by ControlId
diff mbox series

Message ID 20210810151211.56702-3-jacopo@jmondi.org
State Accepted
Headers show
Series
  • libcamera: Initialize controls in the IPA
Related show

Commit Message

Jacopo Mondi Aug. 10, 2021, 3:12 p.m. UTC
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@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/serialization/control_serialization.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch
diff mbox series

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());