[libcamera-devel] [PATCH v7 11/11] lc-compliance: Add test to ensure MinimumRequests is valid

Nícolas F. R. A. Prado nfraprado at collabora.com
Fri Jul 23 01:28:51 CEST 2021


Add a test in lc-compliance to check that the MinimumRequests property
is set and valid, that is, greater than 0.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
---

Added in v7

 src/lc-compliance/capture_test.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/lc-compliance/capture_test.cpp b/src/lc-compliance/capture_test.cpp
index a7ba7448a21b..8d0da770e901 100644
--- a/src/lc-compliance/capture_test.cpp
+++ b/src/lc-compliance/capture_test.cpp
@@ -101,6 +101,23 @@ void RoleParametrizedTest::TearDown()
 	releaseCamera();
 }
 
+class CameraTests : public ::testing::Test, public CameraHolder
+{
+protected:
+	void SetUp() override;
+	void TearDown() override;
+};
+
+void CameraTests::SetUp()
+{
+	acquireCamera();
+}
+
+void CameraTests::TearDown()
+{
+	releaseCamera();
+}
+
 std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info)
 {
 	return roleToString(std::get<0>(info.param)) + "_" +
@@ -187,6 +204,16 @@ TEST_P(RoleParametrizedTest, Overflow)
 	capture.capture();
 }
 
+TEST_F(CameraTests, RequiredProperties)
+{
+	const ControlList &properties = camera_->properties();
+
+	using namespace properties;
+
+	EXPECT_GT(properties.get(MinimumRequests), 0)
+		<< "Camera should have a positive value for MinimumRequests property";
+}
+
 INSTANTIATE_TEST_SUITE_P(CaptureTests,
 			 SingleStream,
 			 testing::Combine(testing::ValuesIn(ROLES),
-- 
2.32.0



More information about the libcamera-devel mailing list