[PATCH] user32/tests: Add more tests for SetWindowPos() on child window.
Paul Gofman
gofmanp at gmail.com
Mon Jan 21 06:07:56 CST 2019
Related to bug https://bugs.winehq.org/show_bug.cgi?id=20190.
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
dlls/user32/tests/win.c | 67 ++++++++++++++++++++++++++++++++++-------
1 file changed, 56 insertions(+), 11 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 94eff5ee4f..e55c1399a5 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -2471,6 +2471,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
LONG_PTR old_proc;
HWND hwnd_grandchild, hwnd_child, hwnd_child2;
HWND hwnd_desktop;
+ RECT rc_expected;
RECT rc1, rc2;
BOOL ret;
@@ -2554,11 +2555,59 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
/* Does not seem to do anything even without passing flags, still returns TRUE */
GetWindowRect(hwnd_child, &rc1);
- ret = SetWindowPos(hwnd_child, hwnd2 , 1, 2, 3, 4, 0);
- ok(ret, "Got %d\n", ret);
+ ret = SetWindowPos(hwnd_child, hwnd2, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d.\n", ret);
GetWindowRect(hwnd_child, &rc2);
- ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
+ ok(EqualRect(&rc1, &rc2), "%s != %s.\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ GetWindowRect(hwnd_child, &rc1);
+ ret = SetWindowPos(hwnd_child, HWND_NOTOPMOST, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d.\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ todo_wine ok(EqualRect(&rc1, &rc2), "%s != %s.\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
+ check_active_state(hwnd2, hwnd2, hwnd2);
+ SetWindowPos(hwnd_child, HWND_NOTOPMOST, 0, 0, rc1.right - rc1.left, rc1.bottom - rc1.top, 0);
+
+ GetWindowRect(hwnd_child, &rc1);
+ ret = SetWindowPos(hwnd_child, HWND_TOPMOST, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d.\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ todo_wine ok(EqualRect(&rc1, &rc2), "%s != %s.\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
+ check_active_state(hwnd2, hwnd2, hwnd2);
+ SetWindowPos(hwnd_child, HWND_TOPMOST, 0, 0, rc1.right - rc1.left, rc1.bottom - rc1.top, 0);
+
+ /* HWND_TOP / HWND_BOTTOM are different. */
+ GetWindowRect(hwnd_child, &rc1);
+ rc_expected.left = rc1.left + 1;
+ rc_expected.top = rc1.top + 2;
+ rc_expected.right = rc1.left + 4;
+ rc_expected.bottom = rc1.top + 6;
+ ret = SetWindowPos(hwnd_child, HWND_TOP, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d.\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ ok(EqualRect(&rc_expected, &rc2), "%s != %s.\n",
+ wine_dbgstr_rect(&rc_expected), wine_dbgstr_rect(&rc2));
+ check_active_state(hwnd2, hwnd2, hwnd2);
+ SetWindowPos(hwnd_child, HWND_TOP, 0, 0, rc1.right - rc1.left, rc1.bottom - rc1.top, 0);
+
+ GetWindowRect(hwnd_child, &rc1);
+ ret = SetWindowPos(hwnd_child, HWND_BOTTOM, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d.\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ ok(EqualRect(&rc_expected, &rc2), "%s != %s.\n",
+ wine_dbgstr_rect(&rc_expected), wine_dbgstr_rect(&rc2));
check_active_state(hwnd2, hwnd2, hwnd2);
+ SetWindowPos(hwnd_child, HWND_BOTTOM, 0, 0, rc1.right - rc1.left, rc1.bottom - rc1.top, 0);
+
+ GetWindowRect(hwnd_child, &rc1);
+ ret = SetWindowPos(hwnd_child, NULL, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d.\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ ok(EqualRect(&rc_expected, &rc2), "%s != %s.\n",
+ wine_dbgstr_rect(&rc_expected), wine_dbgstr_rect(&rc2));
+ check_active_state(hwnd2, hwnd2, hwnd2);
+ SetWindowPos(hwnd_child, NULL, 0, 0, rc1.right - rc1.left, rc1.bottom - rc1.top, 0);
/* Same thing the other way around. */
GetWindowRect(hwnd2, &rc1);
@@ -2581,10 +2630,8 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ret = SetWindowPos(hwnd_grandchild, hwnd_child2, 1, 2, 3, 4, SWP_NOZORDER);
ok(ret, "Got %d\n", ret);
GetWindowRect(hwnd_grandchild, &rc2);
- ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top &&
- (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom,
- "(%d,%d)-(%d,%d) != %s\n", rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6,
- wine_dbgstr_rect(&rc2));
+ ok(EqualRect(&rc_expected, &rc2),
+ "%s != %s.\n", wine_dbgstr_rect(&rc_expected), wine_dbgstr_rect(&rc2));
check_active_state(hwnd2, hwnd2, hwnd2);
/* Given a sibling window, the window is properly resized. */
@@ -2592,10 +2639,8 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ret = SetWindowPos(hwnd_child, hwnd_child2, 1, 2, 3, 4, 0);
ok(ret, "Got %d\n", ret);
GetWindowRect(hwnd_child, &rc2);
- ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top &&
- (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom,
- "(%d,%d)-(%d,%d) != %s\n", rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6,
- wine_dbgstr_rect(&rc2));
+ ok(EqualRect(&rc_expected, &rc2),
+ "%s != %s.\n", wine_dbgstr_rect(&rc_expected), wine_dbgstr_rect(&rc2));
check_active_state(hwnd2, hwnd2, hwnd2);
/* Involving the desktop window changes things. */
--
2.20.1
More information about the wine-devel
mailing list