{"id":10262,"url":"https://patchwork.libcamera.org/api/patches/10262/?format=json","web_url":"https://patchwork.libcamera.org/patch/10262/","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":"<20201026171908.21463-7-david.plowman@raspberrypi.com>","date":"2020-10-26T17:19:08","name":"[libcamera-devel,v6,6/6] test: geometry: Add unit tests for new geometry helper functions","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"be2279324bdea9c1a4bb003f12f91b1d8cf01e19","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10262/mbox/","series":[{"id":1417,"url":"https://patchwork.libcamera.org/api/series/1417/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1417","date":"2020-10-26T17:19:02","name":"Digital zoom","version":6,"mbox":"https://patchwork.libcamera.org/series/1417/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10262/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10262/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E897AC3B5F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Oct 2020 17:19:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A7A3A62051;\n\tMon, 26 Oct 2020 18:19:25 +0100 (CET)","from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C32CE62035\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Oct 2020 18:19:23 +0100 (CET)","by mail-wm1-x329.google.com with SMTP id 13so12460634wmf.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Oct 2020 10:19:23 -0700 (PDT)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\to63sm20955295wmo.2.2020.10.26.10.19.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 26 Oct 2020 10:19:20 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"MokD/Gv7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=HuQ/45j10rn7cV+oW6EnXl0vLVq6yUYLvkNJnvlm9Zo=;\n\tb=MokD/Gv7W9KS+Ssvxa6VMAulCSJ8EGd40m9XAR0mc3kqLeCbMC9M9k8jDz/H3p0ZwS\n\tO/a1p4xYXc07UvhT7x9FYojQA/cDOwj8PlgsH3SVVQjn1H4W0JU8GuX3MJmJ3sz5Vn4x\n\t+FY8jEzDWjHcAdK5UvHgOdkUmGa5Mp7cWrEuqSsmGHuOfzR4N8Rp1G9lkWeXDT1ICYyM\n\td7Rvylp5nYqkXUrxWGDvL54cLM5vn8znHN2lKObUgslivpCWM+RTzToCQ7cQXadsqjer\n\t+iRfzjoYjjPWHzP/58sW/7RQy7gI8GYtyOPxdLGS26uSc+fqpSPSGXVG/PGTohLY+3WL\n\t/uZw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=HuQ/45j10rn7cV+oW6EnXl0vLVq6yUYLvkNJnvlm9Zo=;\n\tb=GLfXEbNSFR3DlkiNSDV0Fp9MIMhcGNlgJYd/vQL78zFl6xGoSbgkgDAeJd7pyWO7pL\n\tc48hmTxEVo4q4ItzLsMPKMa/+JJSc/qbAhxpIhC4DfYtyLZK9fYtc5SYTDuM6Ya7EYmJ\n\t9BaecjRY4laBeE8glqV0kf7QHgE6yekwc/59isgZu+87drvukgJGbsNo8wNjh+pp1Y+y\n\tSMY5MtcVHt/NTVSUmUwNiKUJy544Ys8g3GNaiQgv58AOWwlYgrNUK562oU4WE/g63DVT\n\tDKDctrD1mbAs7pOPxVD02FENsju85yhtOpT7L+DMWaO7nJgkS92cBcvGBx2aVMX/xQlx\n\t1KgA==","X-Gm-Message-State":"AOAM530t5ula6FjAf82r0VHACzA+5Rn/kA+Lqx5L/1zVJcGBMQb0RBZ6\n\tFJ1LDlmqQZhjPISyMS+u1Po4Pm7278CnmQ==","X-Google-Smtp-Source":"ABdhPJy71ns1HZNXXjQizd5ouXf9HM7R3BpqwMsDsIJJ7nwwqDokZzRehBuNy07nMVjhgnqqfsfshg==","X-Received":"by 2002:a1c:9d94:: with SMTP id\n\tg142mr12748774wme.66.1603732760803; \n\tMon, 26 Oct 2020 10:19:20 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 26 Oct 2020 17:19:08 +0000","Message-Id":"<20201026171908.21463-7-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20201026171908.21463-1-david.plowman@raspberrypi.com>","References":"<20201026171908.21463-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v6 6/6] test: geometry: Add unit tests for\n\tnew geometry helper functions","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n test/geometry.cpp | 258 +++++++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 254 insertions(+), 4 deletions(-)","diff":"diff --git a/test/geometry.cpp b/test/geometry.cpp\nindex 08e268c9..175221f9 100644\n--- a/test/geometry.cpp\n+++ b/test/geometry.cpp\n@@ -17,16 +17,17 @@ using namespace libcamera;\n class GeometryTest : public Test\n {\n protected:\n-\tbool compare(const Size &lhs, const Size &rhs,\n-\t\t     bool (*op)(const Size &lhs, const Size &rhs),\n+\ttemplate<typename T = Size>\n+\tbool compare(const T &lhs, const T &rhs,\n+\t\t     bool (*op)(const T &lhs, const T &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\tcout << lhs.toString()\n \t\t\t     << opName << \" \"\n-\t\t\t     << \"Size(\" << rhs.width << \", \" << rhs.height << \") \"\n+\t\t\t     << rhs.toString()\n \t\t\t     << \"test failed\" << std::endl;\n \t\t\treturn false;\n \t\t}\n@@ -36,6 +37,63 @@ protected:\n \n \tint run()\n \t{\n+\t\t/*\n+\t\t * Point tests\n+\t\t */\n+\n+\t\t/* Equality */\n+\t\tif (!compare(Point(50, 100), Point(50, 100), &operator==, \"==\", true))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(-50, 100), Point(-50, 100), &operator==, \"==\", true))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(50, -100), Point(50, -100), &operator==, \"==\", true))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(-50, -100), Point(-50, -100), &operator==, \"==\", true))\n+\t\t\treturn TestFail;\n+\n+\t\t/* Inequality */\n+\t\tif (!compare(Point(50, 100), Point(50, 100), &operator!=, \"!=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(-50, 100), Point(-50, 100), &operator!=, \"!=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(50, -100), Point(50, -100), &operator!=, \"!=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(-50, -100), Point(-50, -100), &operator!=, \"!=\", false))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(-50, 100), Point(50, 100), &operator!=, \"!=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(50, -100), Point(50, 100), &operator!=, \"!=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\tif (!compare(Point(-50, -100), Point(50, 100), &operator!=, \"!=\", true))\n+\t\t\treturn TestFail;\n+\n+\t\t/* Negation */\n+\t\tif (Point(50, 100) != -Point(-50, -100) ||\n+\t\t    Point(50, 100) == -Point(50, -100) ||\n+\t\t    Point(50, 100) == -Point(-50, 100)) {\n+\t\t\tcout << \"Point negation test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Default constructor */\n+\t\tif (Point() != Point(0, 0)) {\n+\t\t\tcout << \"Default constructor test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Size tests\n+\t\t */\n+\n \t\tif (!Size().isNull() || !Size(0, 0).isNull()) {\n \t\t\tcout << \"Null size incorrectly reported as not null\" << endl;\n \t\t\treturn TestFail;\n@@ -109,6 +167,76 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\t/* Aspect ratio tests */\n+\t\tif (Size(0, 0).boundedToAspectRatio(Size(4, 3)) != Size(0, 0) ||\n+\t\t    Size(1920, 1440).boundedToAspectRatio(Size(16, 9)) != Size(1920, 1080) ||\n+\t\t    Size(1920, 1440).boundedToAspectRatio(Size(65536, 36864)) != Size(1920, 1080) ||\n+\t\t    Size(1440, 1920).boundedToAspectRatio(Size(9, 16)) != Size(1080, 1920) ||\n+\t\t    Size(1920, 1080).boundedToAspectRatio(Size(4, 3)) != Size(1440, 1080) ||\n+\t\t    Size(1920, 1080).boundedToAspectRatio(Size(65536, 49152)) != Size(1440, 1080) ||\n+\t\t    Size(1024, 1024).boundedToAspectRatio(Size(1, 1)) != Size(1024, 1024) ||\n+\t\t    Size(1920, 1080).boundedToAspectRatio(Size(16, 9)) != Size(1920, 1080) ||\n+\t\t    Size(200, 100).boundedToAspectRatio(Size(16, 9)) != Size(177, 100) ||\n+\t\t    Size(300, 200).boundedToAspectRatio(Size(16, 9)) != Size(300, 168)) {\n+\t\t\tcout << \"Size::boundedToAspectRatio test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (Size(0, 0).expandedToAspectRatio(Size(4, 3)) != Size(0, 0) ||\n+\t\t    Size(1920, 1440).expandedToAspectRatio(Size(16, 9)) != Size(2560, 1440) ||\n+\t\t    Size(1920, 1440).expandedToAspectRatio(Size(65536, 36864)) != Size(2560, 1440) ||\n+\t\t    Size(1440, 1920).expandedToAspectRatio(Size(9, 16)) != Size(1440, 2560) ||\n+\t\t    Size(1920, 1080).expandedToAspectRatio(Size(4, 3)) != Size(1920, 1440) ||\n+\n+\t\t    Size(1920, 1080).expandedToAspectRatio(Size(65536, 49152)) != Size(1920, 1440) ||\n+\t\t    Size(1024, 1024).expandedToAspectRatio(Size(1, 1)) != Size(1024, 1024) ||\n+\t\t    Size(1920, 1080).expandedToAspectRatio(Size(16, 9)) != Size(1920, 1080) ||\n+\t\t    Size(200, 100).expandedToAspectRatio(Size(16, 9)) != Size(200, 112) ||\n+\t\t    Size(300, 200).expandedToAspectRatio(Size(16, 9)) != Size(355, 200)) {\n+\t\t\tcout << \"Size::expandedToAspectRatio test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Size::centeredTo tests */\n+\t\tif (Size(0, 0).centeredTo(Point(50, 100)) != Rectangle(50, 100, 0, 0) ||\n+\t\t    Size(0, 0).centeredTo(Point(-50, -100)) != Rectangle(-50, -100, 0, 0) ||\n+\t\t    Size(100, 200).centeredTo(Point(50, 100)) != Rectangle(0, 0, 100, 200) ||\n+\t\t    Size(100, 200).centeredTo(Point(-50, -100)) != Rectangle(-100, -200, 100, 200) ||\n+\t\t    Size(101, 201).centeredTo(Point(-50, -100)) != Rectangle(-100, -200, 101, 201) ||\n+\t\t    Size(101, 201).centeredTo(Point(-51, -101)) != Rectangle(-101, -201, 101, 201)) {\n+\t\t\tcout << \"Size::centeredTo test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Scale a size by a float */\n+\t\tif (Size(1000, 2000) * 2.0 != Size(2000, 4000) ||\n+\t\t    Size(300, 100) * 0.5 != Size(150, 50) ||\n+\t\t    Size(1, 2) * 1.6 != Size(1, 3)) {\n+\t\t\tcout << \"Size::operator* failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (Size(1000, 2000) / 2.0 != Size(500, 1000) ||\n+\t\t    Size(300, 100) / 0.5 != Size(600, 200) ||\n+\t\t    Size(1000, 2000) / 3.0 != Size(333, 666)) {\n+\t\t\tcout << \"Size::operator* failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\ts = Size(300, 100);\n+\t\ts *= 0.3333;\n+\t\tif (s != Size(99, 33)) {\n+\t\t\tcout << \"Size::operator* test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\ts = Size(300, 100);\n+\t\ts /= 3;\n+\t\tif (s != Size(100, 33)) {\n+\t\t\tcout << \"Size::operator* test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\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@@ -182,6 +310,10 @@ protected:\n \t\tif (!compare(Size(200, 100), Size(100, 200), &operator>=, \">=\", true))\n \t\t\treturn TestFail;\n \n+\t\t/*\n+\t\t * Rectangle tests\n+\t\t */\n+\n \t\t/* Test Rectangle::isNull(). */\n \t\tif (!Rectangle(0, 0, 0, 0).isNull() ||\n \t\t    !Rectangle(1, 1, 0, 0).isNull()) {\n@@ -196,6 +328,124 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\t/* Rectangle::size, Rectangle::topLeft and Rectangle::center tests */\n+\t\tif (Rectangle(-1, -2, 3, 4).size() != Size(3, 4) ||\n+\t\t    Rectangle(0, 0, 100000, 200000).size() != Size(100000, 200000)) {\n+\t\t\tcout << \"Rectangle::size test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (Rectangle(1, 2, 3, 4).topLeft() != Point(1, 2) ||\n+\t\t    Rectangle(-1, -2, 3, 4).topLeft() != Point(-1, -2)) {\n+\t\t\tcout << \"Rectangle::topLeft test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (Rectangle(0, 0, 300, 400).center() != Point(150, 200) ||\n+\t\t    Rectangle(-1000, -2000, 300, 400).center() != Point(-850, -1800) ||\n+\t\t    Rectangle(10, 20, 301, 401).center() != Point(160, 220) ||\n+\t\t    Rectangle(11, 21, 301, 401).center() != Point(161, 221) ||\n+\t\t    Rectangle(-1011, -2021, 301, 401).center() != Point(-861, -1821)) {\n+\t\t\tcout << \"Rectangle::center test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Rectangle::boundedTo (intersection function) */\n+\t\tif (Rectangle(0, 0, 1000, 2000).boundedTo(Rectangle(0, 0, 1000, 2000)) !=\n+\t\t\t    Rectangle(0, 0, 1000, 2000) ||\n+\t\t    Rectangle(-500, -1000, 1000, 2000).boundedTo(Rectangle(0, 0, 1000, 2000)) !=\n+\t\t\t    Rectangle(0, 0, 500, 1000) ||\n+\t\t    Rectangle(500, 1000, 1000, 2000).boundedTo(Rectangle(0, 0, 1000, 2000)) !=\n+\t\t\t    Rectangle(500, 1000, 500, 1000) ||\n+\t\t    Rectangle(300, 400, 50, 100).boundedTo(Rectangle(0, 0, 1000, 2000)) !=\n+\t\t\t    Rectangle(300, 400, 50, 100) ||\n+\t\t    Rectangle(0, 0, 1000, 2000).boundedTo(Rectangle(300, 400, 50, 100)) !=\n+\t\t\t    Rectangle(300, 400, 50, 100) ||\n+\t\t    Rectangle(0, 0, 100, 100).boundedTo(Rectangle(50, 100, 100, 100)) !=\n+\t\t\t    Rectangle(50, 100, 50, 0) ||\n+\t\t    Rectangle(0, 0, 100, 100).boundedTo(Rectangle(100, 50, 100, 100)) !=\n+\t\t\t    Rectangle(100, 50, 0, 50) ||\n+\t\t    Rectangle(-10, -20, 10, 20).boundedTo(Rectangle(10, 20, 100, 100)) !=\n+\t\t\t    Rectangle(10, 20, 0, 0)) {\n+\t\t\tcout << \"Rectangle::boundedTo test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Rectangle::enclosedIn tests */\n+\t\tif (Rectangle(10, 20, 300, 400).enclosedIn(Rectangle(-10, -20, 1300, 1400)) !=\n+\t\t\t    Rectangle(10, 20, 300, 400) ||\n+\t\t    Rectangle(-100, -200, 3000, 4000).enclosedIn(Rectangle(-10, -20, 1300, 1400)) !=\n+\t\t\t    Rectangle(-10, -20, 1300, 1400) ||\n+\t\t    Rectangle(-100, -200, 300, 400).enclosedIn(Rectangle(-10, -20, 1300, 1400)) !=\n+\t\t\t    Rectangle(-10, -20, 300, 400) ||\n+\t\t    Rectangle(5100, 6200, 300, 400).enclosedIn(Rectangle(-10, -20, 1300, 1400)) !=\n+\t\t\t    Rectangle(990, 980, 300, 400) ||\n+\t\t    Rectangle(100, -300, 150, 200).enclosedIn(Rectangle(50, 0, 200, 300)) !=\n+\t\t\t    Rectangle(100, 0, 150, 200) ||\n+\t\t    Rectangle(100, -300, 150, 1200).enclosedIn(Rectangle(50, 0, 200, 300)) !=\n+\t\t\t    Rectangle(100, 0, 150, 300) ||\n+\t\t    Rectangle(-300, 100, 200, 150).enclosedIn(Rectangle(0, 50, 300, 200)) !=\n+\t\t\t    Rectangle(0, 100, 200, 150) ||\n+\t\t    Rectangle(-300, 100, 1200, 150).enclosedIn(Rectangle(0, 50, 300, 200)) !=\n+\t\t\t    Rectangle(0, 100, 300, 150)) {\n+\t\t\tcout << \"Rectangle::enclosedIn test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Rectange::scaledBy tests */\n+\t\tif (Rectangle(10, 20, 300, 400).scaledBy(Size(0, 0), Size(1, 1)) !=\n+\t\t\t    Rectangle(0, 0, 0, 0) ||\n+\t\t    Rectangle(10, -20, 300, 400).scaledBy(Size(32768, 65536), Size(32768, 32768)) !=\n+\t\t\t    Rectangle(10, -40, 300, 800) ||\n+\t\t    Rectangle(-30000, 10000, 20000, 20000).scaledBy(Size(7, 7), Size(7, 7)) !=\n+\t\t\t    Rectangle(-30000, 10000, 20000, 20000) ||\n+\t\t    Rectangle(-20, -30, 320, 240).scaledBy(Size(1280, 960), Size(640, 480)) !=\n+\t\t\t    Rectangle(-40, -60, 640, 480) ||\n+\t\t    Rectangle(1, 1, 2026, 1510).scaledBy(Size(4056, 3024), Size(2028, 1512)) !=\n+\t\t\t    Rectangle(2, 2, 4052, 3020)) {\n+\t\t\tcout << \"Rectangle::scaledBy test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Rectangle::translatedBy tests */\n+\t\tif (Rectangle(10, -20, 300, 400).translatedBy(Point(-30, 40)) !=\n+\t\t\t    Rectangle(-20, 20, 300, 400) ||\n+\t\t    Rectangle(-10, 20, 400, 300).translatedBy(Point(50, -60)) !=\n+\t\t\t    Rectangle(40, -40, 400, 300)) {\n+\t\t\tcout << \"Rectangle::translatedBy test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Rectangle::scaleBy tests */\n+\t\tRectangle r(-20, -30, 320, 240);\n+\t\tr.scaleBy(Size(1280, 960), Size(640, 480));\n+\t\tif (r != Rectangle(-40, -60, 640, 480)) {\n+\t\t\tcout << \"Rectangle::scaleBy test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tr = Rectangle(1, 1, 2026, 1510);\n+\t\tr.scaleBy(Size(4056, 3024), Size(2028, 1512));\n+\t\tif (r != Rectangle(2, 2, 4052, 3020)) {\n+\t\t\tcout << \"Rectangle::scaleBy test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Rectangle::translateBy tests */\n+\t\tr = Rectangle(10, -20, 300, 400);\n+\t\tr.translateBy(Point(-30, 40));\n+\t\tif (r != Rectangle(-20, 20, 300, 400)) {\n+\t\t\tcout << \"Rectangle::translateBy test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tr = Rectangle(-10, 20, 400, 300);\n+\t\tr.translateBy(Point(50, -60));\n+\t\tif (r != Rectangle(40, -40, 400, 300)) {\n+\t\t\tcout << \"Rectangle::translateBy test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n };\n","prefixes":["libcamera-devel","v6","6/6"]}