{"id":677,"url":"https://patchwork.libcamera.org/api/patches/677/?format=json","web_url":"https://patchwork.libcamera.org/patch/677/","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":"<20190228200151.2948-10-jacopo@jmondi.org>","date":"2019-02-28T20:01:51","name":"[libcamera-devel,v5,9/9] test: v4l2_device: Add format handling test","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"cf33a60d8f50e819cf32a91d00ffd539809e72f8","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/677/mbox/","series":[{"id":198,"url":"https://patchwork.libcamera.org/api/series/198/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=198","date":"2019-02-28T20:01:42","name":"v4l2_(sub)dev: improvements and tests","version":4,"mbox":"https://patchwork.libcamera.org/series/198/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/677/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/677/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D4ED610B7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 21:01:37 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 9716D100004;\n\tThu, 28 Feb 2019 20:01:36 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 28 Feb 2019 21:01:51 +0100","Message-Id":"<20190228200151.2948-10-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190228200151.2948-1-jacopo@jmondi.org>","References":"<20190228200151.2948-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 9/9] test: v4l2_device: Add format\n\thandling 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":"Thu, 28 Feb 2019 20:01:37 -0000"},"content":"Add test for V4L2Device set and get format methods.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n test/v4l2_device/formats.cpp | 53 ++++++++++++++++++++++++++++++++++++\n test/v4l2_device/meson.build |  1 +\n 2 files changed, 54 insertions(+)\n create mode 100644 test/v4l2_device/formats.cpp","diff":"diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_device/formats.cpp\nnew file mode 100644\nindex 000000000000..30b8b5c3f3f5\n--- /dev/null\n+++ b/test/v4l2_device/formats.cpp\n@@ -0,0 +1,53 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * libcamera V4L2 device format handling test\n+ */\n+\n+#include <climits>\n+#include <iostream>\n+\n+#include \"v4l2_device.h\"\n+\n+#include \"v4l2_device_test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class Format : public V4L2DeviceTest\n+{\n+protected:\n+\tint run() override;\n+};\n+\n+int Format::run()\n+{\n+\tV4L2DeviceFormat format = {};\n+\n+\tint ret = capture_->getFormat(&format);\n+\tif (ret) {\n+\t\tcerr << \"Failed to get format\" << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\tformat.width = UINT_MAX;\n+\tformat.height = UINT_MAX;\n+\tret = capture_->setFormat(&format);\n+\tif (ret) {\n+\t\tcerr << \"Failed to set format: image resolution is invalid: \"\n+\t\t     << \"(UINT_MAX x UINT_MAX) but setFormat() should not fail.\"\n+\t\t     << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\tif (format.width == UINT_MAX || format.height == UINT_MAX) {\n+\t\tcerr << \"Failed to update image format = (UINT_MAX x UINT_MAX)\"\n+\t\t     << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\treturn TestPass;\n+}\n+\n+TEST_REGISTER(Format);\ndiff --git a/test/v4l2_device/meson.build b/test/v4l2_device/meson.build\nindex 9f7a7545ac9b..aa617b6dc837 100644\n--- a/test/v4l2_device/meson.build\n+++ b/test/v4l2_device/meson.build\n@@ -2,6 +2,7 @@\n # They are not alphabetically sorted.\n v4l2_device_tests = [\n   [ 'double_open',        'double_open.cpp' ],\n+  [ 'formats',            'formats.cpp' ],\n   [ 'request_buffers',    'request_buffers.cpp' ],\n   [ 'stream_on_off',      'stream_on_off.cpp' ],\n   [ 'capture_async',      'capture_async.cpp' ],\n","prefixes":["libcamera-devel","v5","9/9"]}