@@ -121,6 +121,22 @@ protected:
return TestFail;
}
+ /* Test the getControl() API. */
+ int32_t oldBrightness = ctrls.get(V4L2_CID_BRIGHTNESS).get<int32_t>();
+ int32_t newBrightness;
+ ret = capture_->getControl(V4L2_CID_BRIGHTNESS, &newBrightness);
+ if (ret) {
+ cerr << "Failed to read a single control" << endl;
+ return TestFail;
+ }
+
+ if (newBrightness != oldBrightness) {
+ cerr << "Wrong control value read from device: "
+ << "got: " << newBrightness << " expected: "
+ << oldBrightness << endl;
+ return TestFail;
+ }
+
return TestPass;
}
};
Add a simple test for the newly added method. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- test/v4l2_videodevice/controls.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)