From patchwork Mon Apr 27 18:10:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3568 Return-Path: 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 3AD3B603FC for ; Mon, 27 Apr 2020 20:10:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JXBjqYRm"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AC4B172C for ; Mon, 27 Apr 2020 20:10:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1588011052; bh=9+7C1zfMHzseZH+4uNNYegz1yG3Zs2H65y4pxbIvJzo=; h=From:To:Subject:Date:From; b=JXBjqYRm+iI0EDxDClxUaX9L4rGsJgix81s8ltbJiAOKEdwKeWtAkM0arPspM46mg 3tYhPduzE2p0IvdG+ITpEeoHPudE68zUU4VKe9KuQ4U04L4eLdiGHM7jfS4qyfSMb7 O3zo6GePE03ir+D1RIHkQ+7+rX71CSEniiPv9JCY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 27 Apr 2020 21:10:34 +0300 Message-Id: <20200427181034.10388-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] test: Use float values for brightness, contrast and saturation 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-List-Received-Date: Mon, 27 Apr 2020 18:10:53 -0000 Two tests use the brightness, contrast and saturation controls with integer failures. They were not updated by commit eff4b1aa01c1 which turned those controls into floats. This doesn't cause test failures as the control API converts the value types. For correctness, update the tests to use float values. Fixes: eff4b1aa01c1 ("libcamera: controls: Reorder and update description of existing controls") Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- test/controls/control_list.cpp | 20 ++++++++++---------- test/serialization/control_serialization.cpp | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp index 5374c6f99f80..d51ec47d61d3 100644 --- a/test/controls/control_list.cpp +++ b/test/controls/control_list.cpp @@ -68,7 +68,7 @@ protected: * Set a control, and verify that the list now contains it, and * nothing else. */ - list.set(controls::Brightness, 255); + list.set(controls::Brightness, -0.5f); if (list.empty()) { cout << "List should not be empty" << endl; @@ -94,7 +94,7 @@ protected: return TestFail; } - if (list.get(controls::Brightness) != 255) { + if (list.get(controls::Brightness) != -0.5f) { cout << "Incorrest Brightness control value" << endl; return TestFail; } @@ -105,8 +105,8 @@ protected: } /* Update the first control and set a second one. */ - list.set(controls::Brightness, 64); - list.set(controls::Contrast, 128); + list.set(controls::Brightness, 0.0f); + list.set(controls::Contrast, 1.5f); if (!list.contains(controls::Contrast) || !list.contains(controls::Contrast)) { @@ -114,8 +114,8 @@ protected: return TestFail; } - if (list.get(controls::Brightness) != 64 || - list.get(controls::Contrast) != 128) { + if (list.get(controls::Brightness) != 0.0f || + list.get(controls::Contrast) != 1.5f) { cout << "Failed to retrieve control value" << endl; return TestFail; } @@ -124,11 +124,11 @@ protected: * Update both controls and verify that the container doesn't * grow. */ - list.set(controls::Brightness, 10); - list.set(controls::Contrast, 20); + list.set(controls::Brightness, 0.5f); + list.set(controls::Contrast, 1.1f); - if (list.get(controls::Brightness) != 10 || - list.get(controls::Contrast) != 20) { + if (list.get(controls::Brightness) != 0.5f || + list.get(controls::Contrast) != 1.1f) { cout << "Failed to update control value" << endl; return TestFail; } diff --git a/test/serialization/control_serialization.cpp b/test/serialization/control_serialization.cpp index 2989b52774fb..111365241eb8 100644 --- a/test/serialization/control_serialization.cpp +++ b/test/serialization/control_serialization.cpp @@ -42,9 +42,9 @@ protected: const ControlInfoMap &infoMap = camera_->controls(); ControlList list(infoMap); - list.set(controls::Brightness, 255); - list.set(controls::Contrast, 128); - list.set(controls::Saturation, 50); + list.set(controls::Brightness, 0.5f); + list.set(controls::Contrast, 1.2f); + list.set(controls::Saturation, 0.2f); /* * Serialize the control list, this should fail as the control