user32/tests: New test cases for SubtractRect()

Javier Cantero jcantero at escomposlinux.org
Wed Mar 26 17:05:16 CDT 2014


Added two test cases to the conformance tests of SubtractRect to check the
subtraction when dest == src2.
---
 dlls/user32/tests/uitools.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/dlls/user32/tests/uitools.c b/dlls/user32/tests/uitools.c
index 0401448..531e660 100644
--- a/dlls/user32/tests/uitools.c
+++ b/dlls/user32/tests/uitools.c
@@ -88,12 +88,28 @@ static void test_SubtractRect(void)
         && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
         "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
 
+    /* case 2b: source rect 2 partially overlaps rect 1 - dest is src rect 2 */
+    SetRect(&rect1, 2431, 626, 3427, 1608);
+    SetRect(&rect2, 2499, 626, 3427, 1608);
+    result = SubtractRect(&rect2, &rect1, &rect2);
+    ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
+    ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
+        && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
+        "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
+
     /* case 3: source rect 2 completely overlaps rect 1 */
     SetRect(&rect1, 250, 250, 400, 500);
     SetRect(&rect2, 50, 50, 1500, 1000);
     result = SubtractRect(&rectr, &rect1, &rect2);
     ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
         "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
+
+    /* case 3b: source rect 2 completely overlaps rect 1 - dest is src rect 2 */
+    SetRect(&rect1, 250, 250, 400, 500);
+    SetRect(&rect2, 50, 50, 1500, 1000);
+    result = SubtractRect(&rect2, &rect1, &rect2);
+    ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
+        "(dest rect={%d, %d, %d, %d})\n", rect2.left, rect2.top, rect2.right, rect2.bottom);
 }
 
 START_TEST(uitools)
-- 
1.9.0




More information about the wine-patches mailing list