[libcamera-devel] [PATCH v3 10/13] test: v4l2_device: Test getControl() API
Jacopo Mondi
jacopo at jmondi.org
Fri Apr 24 23:53:01 CEST 2020
Add a simple test for the newly added method.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
test/v4l2_videodevice/controls.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp
index da9e0111e221..cf3d599c43ff 100644
--- a/test/v4l2_videodevice/controls.cpp
+++ b/test/v4l2_videodevice/controls.cpp
@@ -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;
}
};
--
2.26.1
More information about the libcamera-devel
mailing list