From patchwork Tue Jul 19 21:33:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16695 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 C48B8BE173 for ; Tue, 19 Jul 2022 21:33:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DC27463315; Tue, 19 Jul 2022 23:33:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658266433; bh=DVoD73zdvZrY7noMQ4ePjUlWxuFH19HP45H8FN07T1c=; 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=xWv8/ziKzbjv4pfzLcr7XxEB9JCUX4JtJFixuVVMfykSrffetDLQKkK9yqYLxHz+i 6aLdHN4hKu0wiA+KtqURpIYUfI/TiSdalr27LRfhOEG/Jciyq5ETUGrlX1y+yAt8BZ KkDcZEdjMXud11nVwQCpGLxRCEyRhaIqamzx9LHPccTsvKsUdjbhjZJMMCLRmA3yWM ThoxHwSyTXQ854kt99bXBCunMyh7Dbb9f6v7FzQzk7Qg5WSe+tDcxNv+/Z8BYh6kAT lheII3gA5TBKe/doxFk9uD87El5M4/zXhV/faFGvWcMT8r0zfELDCa/JUi6NwQru9h zOr6DXOHrpWgA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6713C603F4 for ; Tue, 19 Jul 2022 23:33:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="L2STuPsd"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C715E6EE; Tue, 19 Jul 2022 23:33:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1658266432; bh=DVoD73zdvZrY7noMQ4ePjUlWxuFH19HP45H8FN07T1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L2STuPsdQjosOzyxjuUArnvv38+EeM/QvYKy7gsL2cY45mxp9OKIxL0nv/MD8u9IT Mm02gD18zgPOZHAOGLRFWvKXx+SH+pI77LMAqIQZGjvIRzqLMCP+bLAs74O9yALmgh 9j/4NAf/rdiiTcYGA/AmvDqQ+MWh5ib1v+QANet8= To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jul 2022 00:33:13 +0300 Message-Id: <20220719213314.11717-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220719210258.5602-1-laurent.pinchart@ideasonboard.com> References: <20220719210258.5602-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/2] test: control_list: Use get() to test for control presence 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: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that the ControlList::get() function returns an std::optional<>, it is the preferred way to test if a control is present in a ControlList. Use it in the test to prepare for removal of ControlList::contains(). Signed-off-by: Laurent Pinchart --- test/controls/control_list.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp index 70cf61b85cbc..c03f230e0a12 100644 --- a/test/controls/control_list.cpp +++ b/test/controls/control_list.cpp @@ -50,7 +50,7 @@ protected: return TestFail; } - if (list.contains(controls::Brightness)) { + if (list.get(controls::Brightness)) { cout << "List should not contain Brightness control" << endl; return TestFail; } @@ -80,7 +80,7 @@ protected: return TestFail; } - if (!list.contains(controls::Brightness)) { + if (!list.get(controls::Brightness)) { cout << "List should contain Brightness control" << endl; return TestFail; } @@ -99,7 +99,7 @@ protected: return TestFail; } - if (list.contains(controls::Contrast)) { + if (list.get(controls::Contrast)) { cout << "List should not contain Contract control" << endl; return TestFail; } @@ -108,8 +108,8 @@ protected: list.set(controls::Brightness, 0.0f); list.set(controls::Contrast, 1.5f); - if (!list.contains(controls::Brightness) || - !list.contains(controls::Contrast)) { + if (!list.get(controls::Brightness) || + !list.get(controls::Contrast)) { cout << "List should contain Brightness and Contrast controls" << endl; return TestFail; @@ -145,7 +145,7 @@ protected: */ list.set(controls::AwbEnable, true); - if (list.contains(controls::AwbEnable)) { + if (list.get(controls::AwbEnable)) { cout << "List shouldn't contain AwbEnable control" << endl; return TestFail; } @@ -171,9 +171,9 @@ protected: return TestFail; } - if (!mergeList.contains(controls::Brightness) || - !mergeList.contains(controls::Contrast) || - !mergeList.contains(controls::Saturation)) { + if (!mergeList.get(controls::Brightness) || + !mergeList.get(controls::Contrast) || + !mergeList.get(controls::Saturation)) { cout << "Merged list does not contain all controls" << endl; return TestFail; }