From 41d01871fef296dc717cf2c4f0bdbb07f5266acd Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Thu, 16 Jun 2016 14:44:04 +0200 Subject: [PATCH] user32/tests: Add some IsRectEmpty() tests. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/user32/tests/uitools.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/dlls/user32/tests/uitools.c b/dlls/user32/tests/uitools.c index f3365ba9a99..27a41793fdd 100644 --- a/dlls/user32/tests/uitools.c +++ b/dlls/user32/tests/uitools.c @@ -146,6 +146,42 @@ static void test_EqualRect(void) ok(ret, "got %d\n", ret); } +static void test_IsRectEmpty(void) +{ + BOOL ret; + unsigned int i; + static const struct { + RECT rect; + BOOL ret; + } rtest[] = { + {{0, 0, 0, 0}, TRUE}, + {{127, 131, 127, 131}, TRUE}, + {{MAXLONG, MAXLONG, MAXLONG, MAXLONG}, TRUE}, + {{-1, -1, -1, -1}, TRUE}, + {{-2011, -2017, -2011, -2017}, TRUE}, + {{MINLONG, MINLONG, MINLONG, MINLONG}, TRUE}, + /* Only width or height are 0 */ + {{31, 37, 31, 41}, TRUE}, + {{881, 883, 887, 883}, TRUE}, + {{-1721, 1723, -1721, 7213}, TRUE}, + /* Negative width and/or height */ + {{11, 13, 5, 7}, TRUE}, + {{-11, -13, -19, -23}, TRUE}, + {{11, 13, -17, 19}, TRUE}, + {{11, 13, 17, 11}, TRUE}, + /* Non emty rects */ + {{101, 103, 107, 109}, FALSE}, + {{1, -9, 7, 3}, FALSE}, + {{-109, -107, -103, -101}, FALSE}, + }; + + for (i = 0; i < sizeof(rtest)/sizeof(rtest[0]); i++) { + ret = IsRectEmpty(&rtest[i].rect); + ok(ret == rtest[i].ret, "Test %d: IsRectEmpty returned %s for %s\n", i, + ret ? "TRUE" : "FALSE", wine_dbgstr_rect(&rtest[i].rect)); + } +} + static void test_SetRect(void) { RECT rect; @@ -170,5 +206,6 @@ START_TEST(uitools) test_FillRect(); test_SubtractRect(); test_EqualRect(); + test_IsRectEmpty(); test_SetRect(); }