Patch Detail
Show a patch.
GET /api/1.1/patches/988/?format=api
{ "id": 988, "url": "https://patchwork.libcamera.org/api/1.1/patches/988/?format=api", "web_url": "https://patchwork.libcamera.org/patch/988/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190415165700.22970-8-laurent.pinchart@ideasonboard.com>", "date": "2019-04-15T16:56:56", "name": "[libcamera-devel,07/11] test: geometry: Add tests for Size class comparison operators", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "8faefaba9eebbf8fd22b523df6c178ed2548bab1", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/988/mbox/", "series": [ { "id": 250, "url": "https://patchwork.libcamera.org/api/1.1/series/250/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=250", "date": "2019-04-15T16:56:49", "name": "Rockchip ISP pipeline handler", "version": 1, "mbox": "https://patchwork.libcamera.org/series/250/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/988/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/988/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 EB32860DCC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2019 18:57:16 +0200 (CEST)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 81180B81\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2019 18:57:16 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555347436;\n\tbh=3xVTvaBVOA4Plyd3pIxARfd1JmMrOkx92cNZikTLFUg=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=FCDa2Lz0/QsSqTfwHd1OsFxlHaKCWIhVV7go/Prhl+0LSWNVNVviVDDiazaK0olYc\n\t4N2T/HI/tEQM0v4UkRbs3a/cm0RLZeYydNIKI/2zHyXrGRfBPApDQLs/+cf6OIU5JC\n\t9lcwYcnvp1p6mNOc3ZWDGJ0K8Fxn7cFClrjZU4/o=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 15 Apr 2019 19:56:56 +0300", "Message-Id": "<20190415165700.22970-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190415165700.22970-1-laurent.pinchart@ideasonboard.com>", "References": "<20190415165700.22970-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 07/11] test: geometry: Add tests for Size\n\tclass comparison operators", "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, 15 Apr 2019 16:57:17 -0000" }, "content": "Add a test that exercises all the comparison operators for the Size\nclass.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/geometry.cpp | 125 ++++++++++++++++++++++++++++++++++++++++++++++\n test/meson.build | 1 +\n 2 files changed, 126 insertions(+)\n create mode 100644 test/geometry.cpp", "diff": "diff --git a/test/geometry.cpp b/test/geometry.cpp\nnew file mode 100644\nindex 000000000000..7ba3f72ed71d\n--- /dev/null\n+++ b/test/geometry.cpp\n@@ -0,0 +1,125 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * geometry.cpp - Geometry classes tests\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/geometry.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class GeometryTest : public Test\n+{\n+protected:\n+\tint init()\n+\t{\n+\t\treturn 0;\n+\t}\n+\n+\tbool compare(const Size &lhs, const Size &rhs,\n+\t\t bool (*op)(const Size &lhs, const Size &rhs),\n+\t\t const char *opName, bool expect)\n+\t{\n+\t\tbool result = op(lhs, rhs);\n+\n+\t\tif (result != expect) {\n+\t\t\tcout << \"Size(\" << lhs.width << \", \" << lhs.height << \") \"\n+\t\t\t << opName << \" \"\n+\t\t\t << \"Size(\" << rhs.width << \", \" << rhs.height << \") \"\n+\t\t\t << \"test failed\" << std::endl;\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\treturn true;\n+\t}\n+\n+\tint run()\n+\t{\n+\t\t/* Test Size equality and inequality. */\n+\t\tif (!compare(Size(100, 100), Size(100, 100), &operator==, \"==\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 100), Size(100, 100), &operator!=, \"!=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Size(100, 100), Size(200, 100), &operator==, \"==\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 100), Size(200, 100), &operator!=, \"!=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Size(100, 100), Size(100, 200), &operator==, \"==\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 100), Size(100, 200), &operator!=, \"!=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\t/* Test Size ordering based on combined with and height. */\n+\t\tif (!compare(Size(100, 100), Size(200, 200), &operator<, \"<\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 100), Size(200, 200), &operator<=, \"<=\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 100), Size(200, 200), &operator>, \">\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 100), Size(200, 200), &operator>=, \">=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Size(200, 200), Size(100, 100), &operator<, \"<\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 200), Size(100, 100), &operator<=, \"<=\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 200), Size(100, 100), &operator>, \">\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 200), Size(100, 100), &operator>=, \">=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\t/* Test Size ordering based on area (with overlapping sizes). */\n+\t\tif (!compare(Size(200, 100), Size(100, 400), &operator<, \"<\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 100), Size(100, 400), &operator<=, \"<=\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 100), Size(100, 400), &operator>, \">\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 100), Size(100, 400), &operator>=, \">=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Size(100, 400), Size(200, 100), &operator<, \"<\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 400), Size(200, 100), &operator<=, \"<=\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 400), Size(200, 100), &operator>, \">\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 400), Size(200, 100), &operator>=, \">=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\t/* Test Size ordering based on width (with identical areas). */\n+\t\tif (!compare(Size(100, 200), Size(200, 100), &operator<, \"<\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 200), Size(200, 100), &operator<=, \"<=\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 200), Size(200, 100), &operator>, \">\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(100, 200), Size(200, 100), &operator>=, \">=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Size(200, 100), Size(100, 200), &operator<, \"<\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 100), Size(100, 200), &operator<=, \"<=\", false))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 100), Size(100, 200), &operator>, \">\", true))\n+\t\t\treturn TestFail;\n+\t\tif (!compare(Size(200, 100), Size(100, 200), &operator>=, \">=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup()\n+\t{\n+\t}\n+};\n+\n+TEST_REGISTER(GeometryTest)\ndiff --git a/test/meson.build b/test/meson.build\nindex 71a96921697c..d501f2beaf96 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -9,6 +9,7 @@ subdir('v4l2_subdevice')\n public_tests = [\n ['event', 'event.cpp'],\n ['event-dispatcher', 'event-dispatcher.cpp'],\n+ ['geometry', 'geometry.cpp'],\n ['list-cameras', 'list-cameras.cpp'],\n ['signal', 'signal.cpp'],\n ['timer', 'timer.cpp'],\n", "prefixes": [ "libcamera-devel", "07/11" ] }