Patch Detail
Show a patch.
GET /api/patches/647/?format=api
{ "id": 647, "url": "https://patchwork.libcamera.org/api/patches/647/?format=api", "web_url": "https://patchwork.libcamera.org/patch/647/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190227173837.6902-9-jacopo@jmondi.org>", "date": "2019-02-27T17:38:37", "name": "[libcamera-devel,v4,8/8] test: v4l2_device: Add format handling test", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f1dfd8058878717955080ab83ed8bfe5fcc7569a", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/647/mbox/", "series": [ { "id": 194, "url": "https://patchwork.libcamera.org/api/series/194/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=194", "date": "2019-02-27T17:38:29", "name": "v4l2_(sub)dev: improvements and tests", "version": 4, "mbox": "https://patchwork.libcamera.org/series/194/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/647/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/647/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 3A7E1610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Feb 2019 18:38:19 +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 97253100005;\n\tWed, 27 Feb 2019 17:38:18 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 27 Feb 2019 18:38:37 +0100", "Message-Id": "<20190227173837.6902-9-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190227173837.6902-1-jacopo@jmondi.org>", "References": "<20190227173837.6902-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 8/8] 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": "Wed, 27 Feb 2019 17:38:19 -0000" }, "content": "Add test for V4L2Device set and get format methods.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n test/v4l2_device/meson.build | 1 +\n test/v4l2_device/test_formats.cpp | 68 +++++++++++++++++++++++++++++++\n 2 files changed, 69 insertions(+)\n create mode 100644 test/v4l2_device/test_formats.cpp", "diff": "diff --git a/test/v4l2_device/meson.build b/test/v4l2_device/meson.build\nindex 9f7a7545ac9b..72b22a637a2f 100644\n--- a/test/v4l2_device/meson.build\n+++ b/test/v4l2_device/meson.build\n@@ -6,6 +6,7 @@ v4l2_device_tests = [\n [ 'stream_on_off', 'stream_on_off.cpp' ],\n [ 'capture_async', 'capture_async.cpp' ],\n [ 'buffer_sharing', 'buffer_sharing.cpp' ],\n+ [ 'test_formats', 'test_formats.cpp' ],\n ]\n \n foreach t : v4l2_device_tests\ndiff --git a/test/v4l2_device/test_formats.cpp b/test/v4l2_device/test_formats.cpp\nnew file mode 100644\nindex 000000000000..9fb1b5c73521\n--- /dev/null\n+++ b/test/v4l2_device/test_formats.cpp\n@@ -0,0 +1,68 @@\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();\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+\tformat.width = 0;\n+\tformat.height = 0;\n+\tret = capture_->setFormat(&format);\n+\tif (ret) {\n+\t\tcerr << \"Failed to set format: image resolution is invalid: \"\n+\t\t << \"(0 x 0) but setFormat() should not fail.\"\n+\t\t << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\tif (format.width == 0 || format.height == 0) {\n+\t\tcerr << \"Failed to update image format = (0x0)\" << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\treturn TestPass;\n+}\n+\n+TEST_REGISTER(Format);\n", "prefixes": [ "libcamera-devel", "v4", "8/8" ] }