Paul Gofman : user32/tests: Add more tests for SetWindowPos() on child window.
Alexandre Julliard
julliard at winehq.org
Tue Feb 5 16:01:32 CST 2019
Module: wine
Branch: master
Commit: d4dc48041b7c30679d42802f7aa557769d77c246
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d4dc48041b7c30679d42802f7aa557769d77c246
Author: Paul Gofman <gofmanp at gmail.com>
Date: Tue Feb 5 18:24:14 2019 +0300
user32/tests: Add more tests for SetWindowPos() on child window.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=20190
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 94eff5e..e55c139 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. */
More information about the wine-cvs
mailing list