{"id":1570,"url":"https://patchwork.libcamera.org/api/patches/1570/?format=json","web_url":"https://patchwork.libcamera.org/patch/1570/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20190701201504.28487-12-laurent.pinchart@ideasonboard.com>","date":"2019-07-01T20:15:02","name":"[libcamera-devel,v4,11/13] libcamera: test: Add ControlInfo test","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"3ebf28fc63a78658389f36a9d5e14a9733e0d9b9","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1570/mbox/","series":[{"id":386,"url":"https://patchwork.libcamera.org/api/series/386/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=386","date":"2019-07-01T20:14:51","name":"libcamera Controls","version":4,"mbox":"https://patchwork.libcamera.org/series/386/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1570/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1570/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B360661F4A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 22:15:31 +0200 (CEST)","from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6A838524\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 22:15:31 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562012131;\n\tbh=PXVWkAZU9N/gTgufqV4/MXpcO3dQqPOekospj4fc+yU=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=syM6/ainhsn8lT3eFDbb0qLmq+DvjQjG6TK5ldk+4l+pxd1wtNdH5+Tv7N1MGh7//\n\t3BS3i3vWW9ll0xQcS7jkKXknnGOooS9OxvMPL4axXaiCSYRt6Ev1U0WyfTfnomgO7I\n\taLSmzpBa4r+3g5hEtBAEkVfG7acL1bXMltXcGX8w=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  1 Jul 2019 23:15:02 +0300","Message-Id":"<20190701201504.28487-12-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190701201504.28487-1-laurent.pinchart@ideasonboard.com>","References":"<20190701201504.28487-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 11/13] libcamera: test: Add ControlInfo\n\ttest","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 01 Jul 2019 20:15:32 -0000"},"content":"From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nProvide an initial test coverage for the ControlInfo class.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v2:\n\n- Renamed to control_info.cpp\n---\n test/controls/control_info.cpp | 62 ++++++++++++++++++++++++++++++++++\n test/controls/meson.build      |  1 +\n 2 files changed, 63 insertions(+)\n create mode 100644 test/controls/control_info.cpp","diff":"diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\nnew file mode 100644\nindex 000000000000..aa3a65b1e5ef\n--- /dev/null\n+++ b/test/controls/control_info.cpp\n@@ -0,0 +1,62 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * control_info.cpp - ControlInfo tests\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/controls.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class ControlInfoTest : public Test\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\t/*\n+\t\t * Test information retrieval from a control with no minimum\n+\t\t * and maximum.\n+\t\t */\n+\t\tControlInfo info(Brightness);\n+\n+\t\tif (info.id() != Brightness ||\n+\t\t    info.type() != ControlValueInteger ||\n+\t\t    info.name() != std::string(\"Brightness\")) {\n+\t\t\tcout << \"Invalid control identification for Brightness\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (info.min().getInt() != 0 || info.max().getInt() != 0) {\n+\t\t\tcout << \"Invalid control range for Brightness\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test information retrieval from a control with a minimum and\n+\t\t * a maximum value.\n+\t\t */\n+\t\tinfo = ControlInfo(Contrast, 10, 200);\n+\n+\t\tif (info.id() != Contrast ||\n+\t\t    info.type() != ControlValueInteger ||\n+\t\t    info.name() != std::string(\"Contrast\")) {\n+\t\t\tcout << \"Invalid control identification for Contrast\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (info.min().getInt() != 10 || info.max().getInt() != 200) {\n+\t\t\tcout << \"Invalid control range for Contrast\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(ControlInfoTest)\ndiff --git a/test/controls/meson.build b/test/controls/meson.build\nindex 1161864d9949..f8cda2877e73 100644\n--- a/test/controls/meson.build\n+++ b/test/controls/meson.build\n@@ -1,4 +1,5 @@\n control_tests = [\n+    [ 'control_info',   'control_info.cpp' ],\n     [ 'control_value',  'control_value.cpp' ],\n ]\n \n","prefixes":["libcamera-devel","v4","11/13"]}