{"id":13142,"url":"https://patchwork.libcamera.org/api/1.1/patches/13142/?format=json","web_url":"https://patchwork.libcamera.org/patch/13142/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210728161116.64489-4-jacopo@jmondi.org>","date":"2021-07-28T16:11:14","name":"[libcamera-devel,v2,3/5] test: control serialization: Test lookup by ControlId","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"409eacfb31f72afc6d304d8b33b81e809be966bc","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13142/mbox/","series":[{"id":2288,"url":"https://patchwork.libcamera.org/api/1.1/series/2288/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2288","date":"2021-07-28T16:11:11","name":"libcamera: Initialize controls in the IPA","version":2,"mbox":"https://patchwork.libcamera.org/series/2288/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13142/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13142/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 82106C3231\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Jul 2021 16:10:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0715A687CB;\n\tWed, 28 Jul 2021 18:10:36 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B6EE6687C9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Jul 2021 18:10:33 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 4D43360009;\n\tWed, 28 Jul 2021 16:10:33 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 28 Jul 2021 18:11:14 +0200","Message-Id":"<20210728161116.64489-4-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20210728161116.64489-1-jacopo@jmondi.org>","References":"<20210728161116.64489-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 3/5] test: control serialization: Test\n\tlookup by ControlId","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Test that lookup by ControlId reference works in the control\nserialization test.\n\nAlso make sure that the control limits are not changed by\nde-serialization.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n test/serialization/control_serialization.cpp | 22 ++++++++++++++++++++\n 1 file changed, 22 insertions(+)","diff":"diff --git a/test/serialization/control_serialization.cpp b/test/serialization/control_serialization.cpp\nindex e23383d13bd6..45a706d27ba7 100644\n--- a/test/serialization/control_serialization.cpp\n+++ b/test/serialization/control_serialization.cpp\n@@ -140,6 +140,28 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\t/* Test lookup by ControlId * on the de-serialized info map. */\n+\t\tauto newLimitsIter = newInfoMap.find(&controls::Brightness);\n+\t\tif (newLimitsIter == newInfoMap.end()) {\n+\t\t\tcerr << \"Lookup by ControlId * failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tauto initialLimitsIter = infoMap.find(&controls::Brightness);\n+\t\tif (initialLimitsIter == infoMap.end()) {\n+\t\t\tcerr << \"Unable to retrieve the original control limits\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Make sure control limits looked up by id are not changed. */\n+\t\tconst ControlInfo &newLimits = newLimitsIter->second;\n+\t\tconst ControlInfo &initialLimits = initialLimitsIter->second;\n+\t\tif (newLimits.min().get<float>() != initialLimits.min().get<float>() ||\n+\t\t    newLimits.max().get<float>() != initialLimits.max().get<float>()) {\n+\t\t\tcerr << \"The brightness control limits have changed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\t/* Deserialize the control list and verify the contents. */\n \t\tbuffer = ByteStreamBuffer(const_cast<const uint8_t *>(listData.data()),\n \t\t\t\t\t  listData.size());\n","prefixes":["libcamera-devel","v2","3/5"]}