From patchwork Wed Dec 28 22:30:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 18075 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 74EE3C3291 for ; Wed, 28 Dec 2022 22:30:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 21F43625CC; Wed, 28 Dec 2022 23:30:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1672266646; bh=Qmri63OtuQVbg9dIGqC4smNcZ7MRbgtnjv3mdBBOxek=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=U+dU2JTWpBLkvz6ZAGGkiWSQ0pdnrH/vBuN5XUlPGovymbSwAqAwW4cWlDNdv3jOG MDp4cvnUeXzGnStmp5ZXSYsm/4sgVdWKuwFdUk/iSJtgRzFG1rsSSfeJTs3wzbDgNU 4FPkfuGLfgYA4cw/KCS67zsovD2C4jg8ITl08uNMRgq0Ele/iTpAUa5QhRTN8bbRWf B1Gexhdsx2xrP7GOmWBBYztS4Sq5wYuWeogWbcost0HNBS61MojetBX6XWmZnQAKkm 8KMfidFZ3HP0jiHKqWbHRw5prLagt5NyzbWmqMIXVepffytRU+6lTsUHc/UPQWdKFq mNBj0vI7dwPIQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5644A62609 for ; Wed, 28 Dec 2022 23:30:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qmzwQy+1"; dkim-atps=neutral Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad8a:9000:1bf9:855b:22de:3645]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CCBB0109; Wed, 28 Dec 2022 23:30:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1672266642; bh=Qmri63OtuQVbg9dIGqC4smNcZ7MRbgtnjv3mdBBOxek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qmzwQy+1HwBlXf3FZQi3CHPmW/NTLE15lpSKJRTYCCulM7aKz0sBWqRUfq7vzsLmw YswQPPW8/Z8RJmBCwvGxZPEsk5uZBKi6kd4Dk+guHBxhi8jbCmIbPXzLsCB198YZwe R8QSDd0Fjq0GWd4OyBHesJohoLjMXGiMDJU2M5lo= To: libcamera-devel@lists.libcamera.org Date: Wed, 28 Dec 2022 16:30:03 -0600 Message-Id: <20221228223003.2265712-20-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221228223003.2265712-1-paul.elder@ideasonboard.com> References: <20221228223003.2265712-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v10 19/19] lc-compliance: Add test to ensure MinimumRequests is valid X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: NĂ­colas F. R. A. Prado 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 Reviewed-by: Paul Elder Signed-off-by: Paul Elder Reviewed-by: Umang Jain --- No change in v10 Changes in v9: - rebased Changes in v8: - Moved RequiredProperties test to property_test.cpp - Moved CameraTests to new test_base.{cpp,h} files Changes in v7: - New --- src/apps/lc-compliance/meson.build | 1 + src/apps/lc-compliance/property_test.cpp | 24 ++++++++++++++++++++++++ src/apps/lc-compliance/test_base.cpp | 10 ++++++++++ src/apps/lc-compliance/test_base.h | 7 +++++++ 4 files changed, 42 insertions(+) create mode 100644 src/apps/lc-compliance/property_test.cpp diff --git a/src/apps/lc-compliance/meson.build b/src/apps/lc-compliance/meson.build index fae290bb..a10a3cc2 100644 --- a/src/apps/lc-compliance/meson.build +++ b/src/apps/lc-compliance/meson.build @@ -14,6 +14,7 @@ lc_compliance_sources = files([ 'capture_test.cpp', 'environment.cpp', 'main.cpp', + 'property_test.cpp', 'simple_capture.cpp', 'test_base.cpp', ]) diff --git a/src/apps/lc-compliance/property_test.cpp b/src/apps/lc-compliance/property_test.cpp new file mode 100644 index 00000000..6a0951b2 --- /dev/null +++ b/src/apps/lc-compliance/property_test.cpp @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2021, Collabora Ltd. + * + * property_test.cpp - Test camera properties + */ + +#include + +#include + +#include "test_base.h" + +using namespace libcamera; + +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"; +} diff --git a/src/apps/lc-compliance/test_base.cpp b/src/apps/lc-compliance/test_base.cpp index c9957b9e..a5e64c8b 100644 --- a/src/apps/lc-compliance/test_base.cpp +++ b/src/apps/lc-compliance/test_base.cpp @@ -26,3 +26,13 @@ void CameraHolder::releaseCamera() camera_->release(); camera_.reset(); } + +void CameraTests::SetUp() +{ + acquireCamera(); +} + +void CameraTests::TearDown() +{ + releaseCamera(); +} diff --git a/src/apps/lc-compliance/test_base.h b/src/apps/lc-compliance/test_base.h index 52347749..8125e1c6 100644 --- a/src/apps/lc-compliance/test_base.h +++ b/src/apps/lc-compliance/test_base.h @@ -21,4 +21,11 @@ protected: std::shared_ptr camera_; }; +class CameraTests : public ::testing::Test, public CameraHolder +{ +protected: + void SetUp() override; + void TearDown() override; +}; + #endif /* __LC_COMPLIANCE_TEST_BASE_H__ */