aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unit/testGeometry.cxx
diff options
context:
space:
mode:
authorMarkus Nißl <unknown>2022-09-02 10:55:40 +1000
committerMarkus Nißl <unknown>2022-09-02 10:55:40 +1000
commit4faa21ad78c41b863ad0ca9b205cf48a025c229e (patch)
tree81bfc9c106ce9926300dd4f1f0c53bd0e156c9a1 /test/unit/testGeometry.cxx
parented6f18d6bf0e71014de9193a88e4b9cf5a957d2f (diff)
downloadscintilla-mirror-4faa21ad78c41b863ad0ca9b205cf48a025c229e.tar.gz
Add PixelAlignCeil and call PixelAlign* to avoid repeated code.
Diffstat (limited to 'test/unit/testGeometry.cxx')
-rw-r--r--test/unit/testGeometry.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/testGeometry.cxx b/test/unit/testGeometry.cxx
index 6ccd63cd0..4e7b436be 100644
--- a/test/unit/testGeometry.cxx
+++ b/test/unit/testGeometry.cxx
@@ -148,36 +148,49 @@ TEST_CASE("PRectangle") {
// Whole pixels
REQUIRE(PixelAlign(1.0, 1) == 1.0);
REQUIRE(PixelAlignFloor(1.0, 1) == 1.0);
+ REQUIRE(PixelAlignCeil(1.0, 1) == 1.0);
REQUIRE(PixelAlign(1.25, 1) == 1.0);
REQUIRE(PixelAlignFloor(1.25, 1) == 1.0);
+ REQUIRE(PixelAlignCeil(1.25, 1) == 2.0);
REQUIRE(PixelAlign(1.5, 1) == 2.0);
REQUIRE(PixelAlignFloor(1.5, 1) == 1.0);
+ REQUIRE(PixelAlignCeil(1.5, 1) == 2.0);
REQUIRE(PixelAlign(1.75, 1) == 2.0);
REQUIRE(PixelAlignFloor(1.75, 1) == 1.0);
+ REQUIRE(PixelAlignCeil(1.75, 1) == 2.0);
+
+ REQUIRE(PixelAlign(Point(1.75, 1.25), 1) == Point(2.0, 1.0));
+ REQUIRE(PixelAlign(Point(1.5, 1.0), 1) == Point(2.0, 1.0));
// Half pixels
REQUIRE(PixelAlign(1.0, 2) == 1.0);
REQUIRE(PixelAlignFloor(1.0, 2) == 1.0);
+ REQUIRE(PixelAlignCeil(1.0, 2) == 1.0);
REQUIRE(PixelAlign(1.25, 2) == 1.5);
REQUIRE(PixelAlignFloor(1.25, 2) == 1.0);
+ REQUIRE(PixelAlignCeil(1.25, 2) == 1.5);
REQUIRE(PixelAlign(1.5, 2) == 1.5);
REQUIRE(PixelAlignFloor(1.5, 2) == 1.5);
+ REQUIRE(PixelAlignCeil(1.5, 2) == 1.5);
REQUIRE(PixelAlign(1.75, 2) == 2.0);
REQUIRE(PixelAlignFloor(1.75, 2) == 1.5);
+ REQUIRE(PixelAlignCeil(1.75, 2) == 2.0);
REQUIRE(PixelAlign(Point(1.75, 1.25), 2) == Point(2.0, 1.5));
REQUIRE(PixelAlign(Point(1.5, 1.0), 2) == Point(1.5, 1.0));
// x->round, y->floored
+ REQUIRE(PixelAlign(PRectangle(1.0, 1.25, 1.5, 1.75), 1) == PRectangle(1.0, 1.0, 2.0, 1.0));
REQUIRE(PixelAlign(PRectangle(1.0, 1.25, 1.5, 1.75), 2) == PRectangle(1.0, 1.0, 1.5, 1.5));
// x->outside(floor left, ceil right), y->floored
+ REQUIRE(PixelAlignOutside(PRectangle(1.1, 1.25, 1.6, 1.75), 1) == PRectangle(1.0, 1.0, 2.0, 1.0));
REQUIRE(PixelAlignOutside(PRectangle(1.1, 1.25, 1.6, 1.75), 2) == PRectangle(1.0, 1.0, 2.0, 1.5));
}