[libcamera-devel] [PATCH v2 3/5] test: control serialization: Test lookup by ControlId
paul.elder at ideasonboard.com
paul.elder at ideasonboard.com
Thu Jul 29 12:23:59 CEST 2021
Hi Jacopo,
On Wed, Jul 28, 2021 at 06:11:14PM +0200, Jacopo Mondi wrote:
> Test that lookup by ControlId reference works in the control
> serialization test.
>
> Also make sure that the control limits are not changed by
> de-serialization.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> test/serialization/control_serialization.cpp | 22 ++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/test/serialization/control_serialization.cpp b/test/serialization/control_serialization.cpp
> index e23383d13bd6..45a706d27ba7 100644
> --- a/test/serialization/control_serialization.cpp
> +++ b/test/serialization/control_serialization.cpp
> @@ -140,6 +140,28 @@ protected:
> return TestFail;
> }
>
> + /* Test lookup by ControlId * on the de-serialized info map. */
> + auto newLimitsIter = newInfoMap.find(&controls::Brightness);
> + if (newLimitsIter == newInfoMap.end()) {
> + cerr << "Lookup by ControlId * failed" << endl;
> + return TestFail;
> + }
> +
> + auto initialLimitsIter = infoMap.find(&controls::Brightness);
> + if (initialLimitsIter == infoMap.end()) {
> + cerr << "Unable to retrieve the original control limits" << endl;
> + return TestFail;
> + }
> +
> + /* Make sure control limits looked up by id are not changed. */
> + const ControlInfo &newLimits = newLimitsIter->second;
> + const ControlInfo &initialLimits = initialLimitsIter->second;
> + if (newLimits.min().get<float>() != initialLimits.min().get<float>() ||
> + newLimits.max().get<float>() != initialLimits.max().get<float>()) {
> + 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