[{"id":4584,"web_url":"https://patchwork.libcamera.org/comment/4584/","msgid":"<20200427192639.mbg5bjc7q3d44mpu@uno.localdomain>","date":"2020-04-27T19:26:39","subject":"Re: [libcamera-devel] [PATCH] test: Use float values for brightness,\n\tcontrast and saturation","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Mon, Apr 27, 2020 at 09:10:34PM +0300, Laurent Pinchart wrote:\n> Two tests use the brightness, contrast and saturation controls with\n> integer failures. They were not updated by commit eff4b1aa01c1 which\n> turned those controls into floats. This doesn't cause test failures as\n> the control API converts the value types. For correctness, update the\n> tests to use float values.\n>\n> Fixes: eff4b1aa01c1 (\"libcamera: controls: Reorder and update description of existing controls\")\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nGood catch!\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n>  test/controls/control_list.cpp               | 20 ++++++++++----------\n>  test/serialization/control_serialization.cpp |  6 +++---\n>  2 files changed, 13 insertions(+), 13 deletions(-)\n>\n> diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp\n> index 5374c6f99f80..d51ec47d61d3 100644\n> --- a/test/controls/control_list.cpp\n> +++ b/test/controls/control_list.cpp\n> @@ -68,7 +68,7 @@ protected:\n>  \t\t * Set a control, and verify that the list now contains it, and\n>  \t\t * nothing else.\n>  \t\t */\n> -\t\tlist.set(controls::Brightness, 255);\n> +\t\tlist.set(controls::Brightness, -0.5f);\n>\n>  \t\tif (list.empty()) {\n>  \t\t\tcout << \"List should not be empty\" << endl;\n> @@ -94,7 +94,7 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>\n> -\t\tif (list.get(controls::Brightness) != 255) {\n> +\t\tif (list.get(controls::Brightness) != -0.5f) {\n>  \t\t\tcout << \"Incorrest Brightness control value\" << endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n> @@ -105,8 +105,8 @@ protected:\n>  \t\t}\n>\n>  \t\t/* Update the first control and set a second one. */\n> -\t\tlist.set(controls::Brightness, 64);\n> -\t\tlist.set(controls::Contrast, 128);\n> +\t\tlist.set(controls::Brightness, 0.0f);\n> +\t\tlist.set(controls::Contrast, 1.5f);\n>\n>  \t\tif (!list.contains(controls::Contrast) ||\n>  \t\t    !list.contains(controls::Contrast)) {\n> @@ -114,8 +114,8 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>\n> -\t\tif (list.get(controls::Brightness) != 64 ||\n> -\t\t    list.get(controls::Contrast) != 128) {\n> +\t\tif (list.get(controls::Brightness) != 0.0f ||\n> +\t\t    list.get(controls::Contrast) != 1.5f) {\n>  \t\t\tcout << \"Failed to retrieve control value\" << endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n> @@ -124,11 +124,11 @@ protected:\n>  \t\t * Update both controls and verify that the container doesn't\n>  \t\t * grow.\n>  \t\t */\n> -\t\tlist.set(controls::Brightness, 10);\n> -\t\tlist.set(controls::Contrast, 20);\n> +\t\tlist.set(controls::Brightness, 0.5f);\n> +\t\tlist.set(controls::Contrast, 1.1f);\n>\n> -\t\tif (list.get(controls::Brightness) != 10 ||\n> -\t\t    list.get(controls::Contrast) != 20) {\n> +\t\tif (list.get(controls::Brightness) != 0.5f ||\n> +\t\t    list.get(controls::Contrast) != 1.1f) {\n>  \t\t\tcout << \"Failed to update control value\" << endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n> diff --git a/test/serialization/control_serialization.cpp b/test/serialization/control_serialization.cpp\n> index 2989b52774fb..111365241eb8 100644\n> --- a/test/serialization/control_serialization.cpp\n> +++ b/test/serialization/control_serialization.cpp\n> @@ -42,9 +42,9 @@ protected:\n>  \t\tconst ControlInfoMap &infoMap = camera_->controls();\n>  \t\tControlList list(infoMap);\n>\n> -\t\tlist.set(controls::Brightness, 255);\n> -\t\tlist.set(controls::Contrast, 128);\n> -\t\tlist.set(controls::Saturation, 50);\n> +\t\tlist.set(controls::Brightness, 0.5f);\n> +\t\tlist.set(controls::Contrast, 1.2f);\n> +\t\tlist.set(controls::Saturation, 0.2f);\n>\n>  \t\t/*\n>  \t\t * Serialize the control list, this should fail as the control\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C348603FC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 21:23:29 +0200 (CEST)","from uno.localdomain (a-ur1-85.tin.it [212.216.150.148])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id A06FDE0007;\n\tMon, 27 Apr 2020 19:23:28 +0000 (UTC)"],"X-Originating-IP":"212.216.150.148","Date":"Mon, 27 Apr 2020 21:26:39 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200427192639.mbg5bjc7q3d44mpu@uno.localdomain>","References":"<20200427181034.10388-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200427181034.10388-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] test: Use float values for brightness,\n\tcontrast and saturation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 27 Apr 2020 19:23:29 -0000"}}]