{"id":3069,"url":"https://patchwork.libcamera.org/api/1.1/patches/3069/?format=json","web_url":"https://patchwork.libcamera.org/patch/3069/","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":"<20200309162414.720306-5-jacopo@jmondi.org>","date":"2020-03-09T16:24:07","name":"[libcamera-devel,04/11] test: controls: control_value: Test string control type","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c98532757c4edc65f2f9cba076f83096dd921bde","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/3069/mbox/","series":[{"id":716,"url":"https://patchwork.libcamera.org/api/1.1/series/716/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=716","date":"2020-03-09T16:24:03","name":"Adda support for V4L2 array control and strings","version":1,"mbox":"https://patchwork.libcamera.org/series/716/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3069/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3069/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["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 975DB62938\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 17:21:29 +0100 (CET)","from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 5595060008\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 16:21:29 +0000 (UTC)"],"X-Originating-IP":"93.34.114.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  9 Mar 2020 17:24:07 +0100","Message-Id":"<20200309162414.720306-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.25.0","In-Reply-To":"<20200309162414.720306-1-jacopo@jmondi.org>","References":"<20200309162414.720306-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 04/11] test: controls: control_value: Test\n\tstring control type","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, 09 Mar 2020 16:21:31 -0000"},"content":"From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nAdd test cases for the string control type. As strings are implemented\nas char arrays, arrays of strings are not supported.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/controls/control_value.cpp | 22 ++++++++++++++++++++++\n 1 file changed, 22 insertions(+)","diff":"diff --git a/test/controls/control_value.cpp b/test/controls/control_value.cpp\nindex a7ebf60f6a6a..ad8e05d0b1a9 100644\n--- a/test/controls/control_value.cpp\n+++ b/test/controls/control_value.cpp\n@@ -235,6 +235,28 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\t/*\n+\t\t * String type.\n+\t\t */\n+\t\tstd::string string{ \"libcamera\" };\n+\t\tvalue.set(string);\n+\t\tif (value.isNone() || !value.isArray() ||\n+\t\t    value.type() != ControlTypeString ||\n+\t\t    value.numElements() != string.size()) {\n+\t\t\tcerr << \"Control type mismatch after setting to string\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (value.get<std::string>() != string) {\n+\t\t\tcerr << \"Control value mismatch after setting to string\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (value.toString() != string) {\n+\t\t\tcerr << \"Control string mismatch after setting to string\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n };\n","prefixes":["libcamera-devel","04/11"]}