[libcamera-devel] [PATCH v2 2/3] test: v4l2_device: Extend formats test with tryFromat()

Jacopo Mondi jacopo at jmondi.org
Fri May 24 08:40:55 CEST 2019


Hi Kieran,

On Thu, May 23, 2019 at 02:58:59PM +0100, Kieran Bingham wrote:
> Add a new test to verify the tryFormat() functionality updates the
> attempted format.
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  test/v4l2_device/formats.cpp | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_device/formats.cpp
> index 6be045ff754c..1ed9901a9e4e 100644
> --- a/test/v4l2_device/formats.cpp
> +++ b/test/v4l2_device/formats.cpp
> @@ -31,6 +31,22 @@ protected:
>  			return TestFail;
>  		}
>
> +		format.size = { UINT_MAX, UINT_MAX };
> +		ret = capture_->tryFormat(&format);
> +		if (ret) {
> +			cerr << "Failed to try format: image resolution is invalid: "
> +			     << "(UINT_MAX x UINT_MAX) but setFormat() should not fail."

nit: "but tryFormat() should not fail"

> +			     << endl;
> +			return TestFail;
> +		}
> +
> +		if (format.size.width == UINT_MAX ||
> +		    format.size.height == UINT_MAX) {
> +			cerr << "Failed to update image (try) format = (UINT_MAX x UINT_MAX)"
> +			     << endl;
> +			return TestFail;
> +		}
> +

Looks good!
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j
>  		format.size = { UINT_MAX, UINT_MAX };
>  		ret = capture_->setFormat(&format);
>  		if (ret) {
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20190524/11ccd602/attachment.sig>


More information about the libcamera-devel mailing list