diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-05-08 18:08:27 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-05-17 20:39:03 +0200 |
commit | e1e440aad6f7bff42a6cee106e5bc269af31c2c0 (patch) | |
tree | 588871cd3700c47c697b9121709d8235210d22ad /test/v4l2_device | |
parent | 4a4c99d0b2490fe18857a869275a059d9d201aed (diff) |
test: v4l2_device: Implement functions inside class definition in cpp files
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 <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/v4l2_device')
-rw-r--r-- | test/v4l2_device/formats.cpp | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_device/formats.cpp index 007e7e94..72676c9d 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 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; + 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; } - - return TestPass; -} +}; TEST_REGISTER(Format); |