user32: Add a test for a dialog minimizing itself on WM_INITDIALOG
Dmitry Timoshkov
dmitry at codeweavers.com
Wed Sep 19 06:00:35 CDT 2007
Hello,
this patch adds a test case for the problem reported in the bug 7404.
Please let me know if more tests is needed.
Changelog:
user32: Add a test for a dialog minimizing itself on WM_INITDIALOG.
---
dlls/user32/tests/msg.c | 141 ++++++++++++++++++++++++++++++-----------------
1 files changed, 91 insertions(+), 50 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 188551c..70aa2a7 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -9061,56 +9061,6 @@ static void test_ShowWindow(void)
DestroyWindow(hwnd);
}
-static INT_PTR WINAPI test_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- struct message msg;
-
- trace("dialog: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
-
- switch (message)
- {
- case WM_WINDOWPOSCHANGING:
- case WM_WINDOWPOSCHANGED:
- {
- WINDOWPOS *winpos = (WINDOWPOS *)lParam;
-
- trace("%s\n", (message == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED");
- trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
- winpos->hwnd, winpos->hwndInsertAfter,
- winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
- dump_winpos_flags(winpos->flags);
-
- /* Log only documented flags, win2k uses 0x1000 and 0x2000
- * in the high word for internal purposes
- */
- wParam = winpos->flags & 0xffff;
- /* We are not interested in the flags that don't match under XP and Win9x */
- wParam &= ~(SWP_NOZORDER);
- break;
- }
-
- /* explicitly ignore WM_GETICON message */
- case WM_GETICON:
- return 0;
- }
-
- msg.message = message;
- msg.flags = sent|wparam|lparam;
- msg.wParam = wParam;
- msg.lParam = lParam;
- add_message(&msg);
-
- /* calling DefDlgProc leads to a recursion under XP */
-
- switch (message)
- {
- case WM_INITDIALOG:
- case WM_GETDLGCODE:
- return 0;
- }
- return 1;
-}
-
static const struct message WmDefDlgSetFocus_1[] = {
{ WM_GETDLGCODE, sent|wparam|lparam, 0, 0 },
{ WM_GETTEXTLENGTH, sent|wparam|lparam|optional, 0, 0 }, /* XP */
@@ -9164,6 +9114,90 @@ static const struct message WmCreateDialogParamSeq_2[] = {
{ WM_CHANGEUISTATE, sent|optional },
{ 0 }
};
+/* Call ShowWindow(SW_MINIMIZE) on a not visible dialog window */
+static const struct message WmMinimizeDlg[] = {
+ { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
+ { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|0x8000 },
+ { WM_NCCALCSIZE, sent|wparam, 1 },
+ { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|0x8000 },
+ { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
+ { 0 }
+};
+
+static BOOL test_minimize_on_init = FALSE;
+
+static INT_PTR WINAPI test_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ struct message msg;
+
+ trace("dialog: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
+
+ switch (message)
+ {
+ case WM_WINDOWPOSCHANGING:
+ case WM_WINDOWPOSCHANGED:
+ {
+ WINDOWPOS *winpos = (WINDOWPOS *)lParam;
+
+ trace("%s\n", (message == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED");
+ trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
+ winpos->hwnd, winpos->hwndInsertAfter,
+ winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
+ dump_winpos_flags(winpos->flags);
+
+ /* Log only documented flags, win2k uses 0x1000 and 0x2000
+ * in the high word for internal purposes
+ */
+ wParam = winpos->flags & 0xffff;
+ /* We are not interested in the flags that don't match under XP and Win9x */
+ wParam &= ~(SWP_NOZORDER);
+ break;
+ }
+
+ /* explicitly ignore WM_GETICON message */
+ case WM_GETICON:
+ case WM_GETTEXT:
+ return 0;
+ }
+
+ msg.message = message;
+ msg.flags = sent|wparam|lparam;
+ msg.wParam = wParam;
+ msg.lParam = lParam;
+ add_message(&msg);
+
+ /* calling DefDlgProc leads to a recursion under XP */
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ if (test_minimize_on_init)
+ {
+ RECT rc;
+
+ ok_sequence(WmCreateDialogParamSeq_1, "CreateDialogParam_1", FALSE);
+ ok(!(GetWindowLong(hwnd, GWL_STYLE) & WS_VISIBLE), "dialog should NOT be visible\n");
+
+ ShowWindow(hwnd, SW_MINIMIZE);
+ ok_sequence(WmMinimizeDlg, "WmMinimizeDlg", TRUE);
+
+ ok(GetWindowLong(hwnd, GWL_STYLE) & WS_VISIBLE, "dialog should be visible\n");
+ ok(GetWindowLong(hwnd, GWL_STYLE) & WS_MINIMIZE, "dialog should be minimized\n");
+ GetWindowRect(hwnd, &rc);
+todo_wine ok((rc.left == -32000 && rc.top == -32000) /* XP*/ ||
+ (rc.left == 3000 && rc.top == 3000), /* Win9x*/
+ "expected -32000,-32000 (XP) or 3000,3000 (Win9x) got %d,%d\n", rc.left, rc.top);
+
+ UpdateWindow(hwnd);
+ ok_sequence(WmEmptySeq, "WmEmptySeq", TRUE);
+ }
+ return 0;
+
+ case WM_GETDLGCODE:
+ return 0;
+ }
+ return 1;
+}
static void test_dialog_messages(void)
{
@@ -9267,6 +9301,13 @@ static void test_dialog_messages(void)
DestroyWindow(hdlg);
flush_sequence();
+ test_minimize_on_init = TRUE;
+ hdlg = CreateDialogParam(0, "CLASS_TEST_DIALOG_2", 0, test_dlg_proc, 0);
+ ok(IsWindow(hdlg), "CreateDialogParam failed\n");
+ EndDialog(hdlg, 0);
+ DestroyWindow(hdlg);
+ flush_sequence();
+
UnregisterClass(cls.lpszClassName, cls.hInstance);
}
--
1.5.3.1
More information about the wine-patches
mailing list