From patchwork Thu May 23 13:58:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 1271 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DB27060DE9 for ; Thu, 23 May 2019 15:59:05 +0200 (CEST) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7842CB7C; Thu, 23 May 2019 15:59:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558619945; bh=a0eycquhtYysrCMaRms7fN5KsRROLlUE7QgcgkNOKy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=niAbE98GzyHMBRdtnmebjFM7Oce0aCWzHD499TvWfQPiGb16JJk9IGfsDeKOKcbFb x5hvx0h4IR6ZgR0utNwjRPJ9i88dFxiJwuLEETniH8DMOTDdqEkcRK0tiiimJ0P0fS hUgC96g0f3pLYUN1GkCDYNChf+xHk0LkMMrb6rW4= From: Kieran Bingham To: LibCamera Devel Date: Thu, 23 May 2019 14:58:59 +0100 Message-Id: <20190523135900.24029-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523135900.24029-1-kieran.bingham@ideasonboard.com> References: <20190523135900.24029-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/3] test: v4l2_device: Extend formats test with tryFromat() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 13:59:06 -0000 Add a new test to verify the tryFormat() functionality updates the attempted format. Signed-off-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- 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." + << 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; + } + format.size = { UINT_MAX, UINT_MAX }; ret = capture_->setFormat(&format); if (ret) {