From patchwork Sat May 11 11:11:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 1199 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7023860E4F for ; Sat, 11 May 2019 13:11:41 +0200 (CEST) X-Halon-ID: 8688bfee-73dd-11e9-81fd-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [185.224.57.161]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 8688bfee-73dd-11e9-81fd-0050569116f7; Sat, 11 May 2019 13:11:31 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sat, 11 May 2019 13:11:12 +0200 Message-Id: <20190511111115.16727-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190511111115.16727-1-niklas.soderlund@ragnatech.se> References: <20190511111115.16727-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/5] test: v4l2_device: Implement functions inside class definition in cpp files 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: Sat, 11 May 2019 11:11:41 -0000 Align the style of the formats test with the other v4l2_device tests by impending the functions in the class definition instead of first declaring the class and then implement the functions. There is no functional change only restructuring of existing code to align with the style of other tests. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- test/v4l2_device/formats.cpp | 58 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_device/formats.cpp index 007e7e9487b57772..72676c9d334a69b0 100644 --- a/test/v4l2_device/formats.cpp +++ b/test/v4l2_device/formats.cpp @@ -18,36 +18,34 @@ using namespace libcamera; class Format : public V4L2DeviceTest { protected: - int run() override; + int run() + { + V4L2DeviceFormat format = {}; + + int ret = capture_->getFormat(&format); + if (ret) { + cerr << "Failed to get format" << endl; + return TestFail; + } + + format.size = { UINT_MAX, UINT_MAX }; + ret = capture_->setFormat(&format); + if (ret) { + cerr << "Failed to set 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 format = (UINT_MAX x UINT_MAX)" + << endl; + return TestFail; + } + + return TestPass; + } }; -int Format::run() -{ - V4L2DeviceFormat format = {}; - - int ret = capture_->getFormat(&format); - if (ret) { - cerr << "Failed to get format" << endl; - return TestFail; - } - - format.size = { UINT_MAX, UINT_MAX }; - ret = capture_->setFormat(&format); - if (ret) { - cerr << "Failed to set 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 format = (UINT_MAX x UINT_MAX)" - << endl; - return TestFail; - } - - return TestPass; -} - TEST_REGISTER(Format);