{"id":712,"url":"https://patchwork.libcamera.org/api/1.1/patches/712/?format=json","web_url":"https://patchwork.libcamera.org/patch/712/","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":"<20190311022232.4759-3-niklas.soderlund@ragnatech.se>","date":"2019-03-11T02:22:30","name":"[libcamera-devel,v2,2/4] test: camera: Add setting of configuration test","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"680baaa585680736660de0bef434a684043c2254","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/712/mbox/","series":[{"id":204,"url":"https://patchwork.libcamera.org/api/1.1/series/204/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=204","date":"2019-03-11T02:22:28","name":"test: camera: Add basic tests for the camera","version":2,"mbox":"https://patchwork.libcamera.org/series/204/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/712/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/712/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 881B3610C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Mar 2019 03:23:07 +0100 (CET)","from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 9a110e00-43a4-11e9-985a-005056917f90;\n\tMon, 11 Mar 2019 03:23:05 +0100 (CET)"],"X-Halon-ID":"9a110e00-43a4-11e9-985a-005056917f90","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 11 Mar 2019 03:22:30 +0100","Message-Id":"<20190311022232.4759-3-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190311022232.4759-1-niklas.soderlund@ragnatech.se>","References":"<20190311022232.4759-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/4] test: camera: Add setting of\n\tconfiguration 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, 11 Mar 2019 02:23:07 -0000"},"content":"Try to set the default configuration, a modified valid configuration and\nan invalid configuration.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n test/camera/configuration_set.cpp | 90 +++++++++++++++++++++++++++++++\n test/camera/meson.build           |  1 +\n 2 files changed, 91 insertions(+)\n create mode 100644 test/camera/configuration_set.cpp","diff":"diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp\nnew file mode 100644\nindex 0000000000000000..cf0b96b7d1d6583c\n--- /dev/null\n+++ b/test/camera/configuration_set.cpp\n@@ -0,0 +1,90 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * libcamera Camera API tests\n+ */\n+\n+#include <iostream>\n+\n+#include \"camera_test.h\"\n+\n+using namespace std;\n+\n+namespace {\n+\n+class ConfigurationSet : public CameraTest\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\tstd::set<Stream *> streams = { *camera_->streams().begin() };\n+\t\tstd::map<Stream *, StreamConfiguration> conf =\n+\t\t\tcamera_->streamConfiguration(streams);\n+\t\tStreamConfiguration *sconf = &conf.begin()->second;\n+\n+\t\tif (!configurationValid(streams, conf)) {\n+\t\t\tcout << \"Reading default configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (camera_->acquire()) {\n+\t\t\tcout << \"Acquiring the camera\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Test that setting the default configuration works. */\n+\t\tif (camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Setting default configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test that configuring the camera fails if it is not\n+\t\t * acquired, this will also test release and reacquiring\n+\t\t * of the camera.\n+\t\t */\n+\t\tif (camera_->release()) {\n+\t\t\tcout << \"Releasing the camera\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Setting configuration on a camera not acquired\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (camera_->acquire()) {\n+\t\t\tcout << \"Acquiring the camera\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test that modifying the default configuration works. Doubling\n+\t\t * the default configuration of the VIMC camera is known to\n+\t\t * work.\n+\t\t */\n+\t\tsconf->width *= 2;\n+\t\tsconf->height *= 2;\n+\t\tif (camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Setting modified configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test that setting an invalid configuration fails.\n+\t\t */\n+\t\tsconf->width = 0;\n+\t\tsconf->height = 0;\n+\t\tif (!camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Setting invalid configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+} /* namespace */\n+\n+TEST_REGISTER(ConfigurationSet);\ndiff --git a/test/camera/meson.build b/test/camera/meson.build\nindex 186ba211b9fde026..ed4837190ff6c52c 100644\n--- a/test/camera/meson.build\n+++ b/test/camera/meson.build\n@@ -2,6 +2,7 @@\n # They are not alphabetically sorted.\n camera_tests = [\n   [ 'configuration_default',  'configuration_default.cpp' ],\n+  [ 'configuration_set',      'configuration_set.cpp' ],\n ]\n \n foreach t : camera_tests\n","prefixes":["libcamera-devel","v2","2/4"]}