{"id":1569,"url":"https://patchwork.libcamera.org/api/patches/1569/?format=json","web_url":"https://patchwork.libcamera.org/patch/1569/","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-11-laurent.pinchart@ideasonboard.com>","date":"2019-07-01T20:15:01","name":"[libcamera-devel,v4,10/13] libcamera: test: Add ControlValue test","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e401db6dedb51df744a5eda91754c2bfd71305e6","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/1569/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/1569/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1569/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 74F3E61F5D\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 202081217\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=GHlMySBi5xqeUwYJNAOLGl2fTK8C15O+d7MdvuQ3lss=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Llp3hE+ZNi0mN/ilGOzqoHjVuWf8kJ+Z8XJkXFtOKNzMbAUhMhohYMtshBgMJR2Xg\n\tmHzJ1JyacA8xWnOeZK7YXUuNSoINCp3zyL8wH8nljySMeCqoPPBtAJLkgzz9cCrjXK\n\tXIHC7PbSZjn5xAYSIRnUN5PYMmGsXnvhkY5a4iZU=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  1 Jul 2019 23:15:01 +0300","Message-Id":"<20190701201504.28487-11-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 10/13] libcamera: test: Add\n\tControlValue test","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\nAdd initial basic testing for the new ControlValue class.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/controls/control_value.cpp | 69 +++++++++++++++++++++++++++++++++\n test/controls/meson.build       | 11 ++++++\n test/meson.build                |  1 +\n 3 files changed, 81 insertions(+)\n create mode 100644 test/controls/control_value.cpp\n create mode 100644 test/controls/meson.build","diff":"diff --git a/test/controls/control_value.cpp b/test/controls/control_value.cpp\nnew file mode 100644\nindex 000000000000..778efe5c115f\n--- /dev/null\n+++ b/test/controls/control_value.cpp\n@@ -0,0 +1,69 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * control_value.cpp - ControlValue 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 ControlValueTest : public Test\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\tControlValue integer(1234);\n+\t\tControlValue boolean(true);\n+\n+\t\t/* Just a string conversion output test... no validation */\n+\t\tcout << \"Int: \" << integer.toString()\n+\t\t     << \" Bool: \" << boolean.toString()\n+\t\t     << endl;\n+\n+\t\tif (integer.getInt() != 1234) {\n+\t\t\tcerr << \"Failed to get Integer\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (boolean.getBool() != true) {\n+\t\t\tcerr << \"Failed to get Boolean\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Test an uninitialised value, and updating it. */\n+\n+\t\tControlValue value;\n+\t\tif (!value.isNone()) {\n+\t\t\tcerr << \"Empty value is non-null\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tvalue.set(true);\n+\t\tif (value.isNone()) {\n+\t\t\tcerr << \"Failed to set an empty object\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (value.getBool() != true) {\n+\t\t\tcerr << \"Failed to get Booleans\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tvalue.set(10);\n+\t\tif (value.getInt() != 10) {\n+\t\t\tcerr << \"Failed to get Integer\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(ControlValueTest)\ndiff --git a/test/controls/meson.build b/test/controls/meson.build\nnew file mode 100644\nindex 000000000000..1161864d9949\n--- /dev/null\n+++ b/test/controls/meson.build\n@@ -0,0 +1,11 @@\n+control_tests = [\n+    [ 'control_value',  'control_value.cpp' ],\n+]\n+\n+foreach t : control_tests\n+    exe = executable(t[0], t[1],\n+                     dependencies : libcamera_dep,\n+                     link_with : test_libraries,\n+                     include_directories : test_includes_internal)\n+    test(t[0], exe, suite : 'controls', is_parallel : false)\n+endforeach\ndiff --git a/test/meson.build b/test/meson.build\nindex c36ac2479636..fea2485cbb34 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -1,6 +1,7 @@\n subdir('libtest')\n \n subdir('camera')\n+subdir('controls')\n subdir('ipa')\n subdir('media_device')\n subdir('pipeline')\n","prefixes":["libcamera-devel","v4","10/13"]}