diff options
Diffstat (limited to 'test/v4l2_videodevice')
-rw-r--r-- | test/v4l2_videodevice/controls.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp index da9e0111..347af211 100644 --- a/test/v4l2_videodevice/controls.cpp +++ b/test/v4l2_videodevice/controls.cpp @@ -57,18 +57,20 @@ protected: const ControlInfo &u8 = infoMap.find(VIVID_CID_U8_4D_ARRAY)->second; /* Test getting controls. */ - ControlList ctrls(infoMap); - ctrls.set(V4L2_CID_BRIGHTNESS, -1); - ctrls.set(V4L2_CID_CONTRAST, -1); - ctrls.set(V4L2_CID_SATURATION, -1); - ctrls.set(VIVID_CID_U8_4D_ARRAY, 0); - - int ret = capture_->getControls(&ctrls); - if (ret) { + ControlList ctrls = capture_->getControls({ V4L2_CID_BRIGHTNESS, + V4L2_CID_CONTRAST, + V4L2_CID_SATURATION, + VIVID_CID_U8_4D_ARRAY }); + if (ctrls.empty()) { cerr << "Failed to get controls" << endl; return TestFail; } + if (ctrls.infoMap() != &infoMap) { + cerr << "Incorrect infoMap for retrieved controls" << endl; + return TestFail; + } + if (ctrls.get(V4L2_CID_BRIGHTNESS).get<int32_t>() == -1 || ctrls.get(V4L2_CID_CONTRAST).get<int32_t>() == -1 || ctrls.get(V4L2_CID_SATURATION).get<int32_t>() == -1) { @@ -97,7 +99,7 @@ protected: std::fill(u8Values.begin(), u8Values.end(), u8.min().get<uint8_t>()); ctrls.set(VIVID_CID_U8_4D_ARRAY, Span<const uint8_t>(u8Values)); - ret = capture_->setControls(&ctrls); + int ret = capture_->setControls(&ctrls); if (ret) { cerr << "Failed to set controls" << endl; return TestFail; |