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>
This commit is contained in:
parent
4a4c99d0b2
commit
e1e440aad6
1 changed files with 28 additions and 30 deletions
|
@ -18,36 +18,34 @@ using namespace libcamera;
|
||||||
class Format : public V4L2DeviceTest
|
class Format : public V4L2DeviceTest
|
||||||
{
|
{
|
||||||
protected:
|
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);
|
TEST_REGISTER(Format);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue