summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYudhistira Erlandinata <yerlandinata@chromium.org>2024-09-25 08:12:24 +0000
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2024-10-01 21:01:25 +0200
commit724bbf7d2506d65e060c9475010738983f5b85bd (patch)
tree8944cf91d91f45edd98c92d568cd08cb2a3d2bd7 /test
parent2f621920eaf084b29ce3ad15204b989e868df826 (diff)
libcamera: geometry: Add two-point Rectangle constructor
Add a constructor to the Rectangle class that accepts two points. The constructed Rectangle spans all the space between the two given points. Signed-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/geometry.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/geometry.cpp b/test/geometry.cpp
index 64169206..5760fa3c 100644
--- a/test/geometry.cpp
+++ b/test/geometry.cpp
@@ -481,6 +481,20 @@ protected:
return TestFail;
}
+ Point topLeft(3, 3);
+ Point bottomRight(30, 30);
+ Point topRight(30, 3);
+ Point bottomLeft(3, 30);
+ Rectangle rect1(topLeft, bottomRight);
+ Rectangle rect2(topRight, bottomLeft);
+ Rectangle rect3(bottomRight, topLeft);
+ Rectangle rect4(bottomLeft, topRight);
+
+ if (rect1 != rect2 || rect1 != rect3 || rect1 != rect4) {
+ cout << "Point-to-point construction failed" << endl;
+ return TestFail;
+ }
+
return TestPass;
}
};