{"id":1553,"url":"https://patchwork.libcamera.org/api/patches/1553/?format=json","web_url":"https://patchwork.libcamera.org/patch/1553/","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":"<20190630233817.10130-12-laurent.pinchart@ideasonboard.com>","date":"2019-06-30T23:38:14","name":"[libcamera-devel,v3,11/14] libcamera: test: Add ControlValue test","commit_ref":null,"pull_url":null,"state":"superseded","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/1553/mbox/","series":[{"id":384,"url":"https://patchwork.libcamera.org/api/series/384/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=384","date":"2019-06-30T23:38:03","name":"libcamera Controls","version":3,"mbox":"https://patchwork.libcamera.org/series/384/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1553/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1553/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 073D761F70\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 01:38:46 +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 A7156BC5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 01:38:45 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561937925;\n\tbh=GHlMySBi5xqeUwYJNAOLGl2fTK8C15O+d7MdvuQ3lss=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=deVADEiPfJvi3xSXUP1QZveIrJWiBwaZInDOSDejvfOMiwbyWFNy99YFRIIN1CZNU\n\tzVvSoMUIpYNzPSZ8T+ebeHak8CQ5U8V3EE5K/H1jSXu443kSfGmLX15V4mXa7RuJGI\n\thZxE3wA6Vi77gPXgmRJnVctvE9vGPOUyZHEdbBSM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  1 Jul 2019 02:38:14 +0300","Message-Id":"<20190630233817.10130-12-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190630233817.10130-1-laurent.pinchart@ideasonboard.com>","References":"<20190630233817.10130-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 11/14] 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":"Sun, 30 Jun 2019 23:38:47 -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","v3","11/14"]}