summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2021-11-25 07:01:38 +0100
committerKim Woelders <kim@woelders.dk>2021-11-25 15:46:23 +0100
commite0e4f883e9c7614d8ca81524f33658f681a1ad39 (patch)
tree1a31808cc48d4ec53240636b94acb1385ff66b86
parent00d050901df966a13f1f6bd9f5151c2135e1e8e8 (diff)
downloadimlib2-e0e4f883e9c7614d8ca81524f33658f681a1ad39.tar.gz
test_grab: Add scale-down tests
-rw-r--r--test/test_grab.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/test_grab.cpp b/test/test_grab.cpp
index b144399..665cfc5 100644
--- a/test/test_grab.cpp
+++ b/test/test_grab.cpp
@@ -140,6 +140,16 @@ _test_grab_1(int w, int h, int x0, int y0)
ys *= xd.scale;
hs *= xd.scale;
}
+ if (xd.scale < 0)
+ {
+ xs = (xs & ~1) / -xd.scale;
+ ws /= -xd.scale;
+ ys = (ys & ~1) / -xd.scale;
+ hs /= -xd.scale;
+ }
+
+ D("%s: %3dx%3d(%3d,%3d) -> %3dx%3d(%d,%d)\n", __func__,
+ w, h, x0, y0, ws, hs, xs, ys);
if (xd.scale == 0)
im = imlib_create_image_from_drawable(None, x0, y0, w, h, 0);
@@ -215,6 +225,14 @@ _test_grab(const char *test, int depth, int scale, int opt)
_test_grab_1(w, h, -d, d);
_test_grab_1(w, h, d, d);
_test_grab_1(w, h, d, -d);
+ if (scale < 0)
+ {
+ d = 2;
+ _test_grab_1(w, h, -d, -d);
+ _test_grab_1(w, h, -d, d);
+ _test_grab_1(w, h, d, d);
+ _test_grab_1(w, h, d, -d);
+ }
break;
}
@@ -238,6 +256,11 @@ TEST(GRAB, grab_noof_24_su2)
_test_grab("grab_noof_24_su2", 24, 2, 0);
}
+TEST(GRAB, grab_noof_24_sd2)
+{
+ _test_grab("grab_noof_24_sd2", 24, -2, 0);
+}
+
TEST(GRAB, grab_noof_32_s0)
{
_test_grab("grab_noof_32_s0", 32, 0, 0);
@@ -253,6 +276,11 @@ TEST(GRAB, grab_noof_32_su2)
_test_grab("grab_noof_32_su2", 32, 2, 0);
}
+TEST(GRAB, grab_noof_32_sd2)
+{
+ _test_grab("grab_noof_32_sd2", 32, -2, 0);
+}
+
TEST(GRAB, grab_offs_24_s0)
{
_test_grab("grab_offs_24_s0", 24, 0, 1);
@@ -268,6 +296,11 @@ TEST(GRAB, grab_offs_24_su2)
_test_grab("grab_offs_24_su2", 24, 2, 1);
}
+TEST(GRAB, grab_offs_24_sd2)
+{
+ _test_grab("grab_offs_24_sd2", 24, -2, 1);
+}
+
TEST(GRAB, grab_offs_32_s0)
{
_test_grab("grab_offs_32_s0", 32, 0, 1);
@@ -283,6 +316,11 @@ TEST(GRAB, grab_offs_32_su2)
_test_grab("grab_offs_32_su2", 32, 2, 1);
}
+TEST(GRAB, grab_offs_32_sd2)
+{
+ _test_grab("grab_offs_32_sd2", 32, -2, 1);
+}
+
int
main(int argc, char **argv)
{