Alexandre Julliard : user32/tests: Add another test for dialog creation messages without DefDlgProc.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 18 10:14:56 CST 2016


Module: wine
Branch: master
Commit: c1ed920e151c4ecc06bd64a8df1139815e47ac47
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c1ed920e151c4ecc06bd64a8df1139815e47ac47

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Feb 18 22:18:56 2016 +0900

user32/tests: Add another test for dialog creation messages without DefDlgProc.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/msg.c       | 74 +++++++++++++++++++++++++++++++++++++++++++
 dlls/user32/tests/resource.rc |  9 ++++++
 2 files changed, 83 insertions(+)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 1ef7841..3d4bea5 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -11942,6 +11942,35 @@ static INT_PTR WINAPI test_dlg_proc2(HWND hwnd, UINT message, WPARAM wParam, LPA
     return 1;
 }
 
+static INT_PTR WINAPI test_dlg_proc3(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    ok( 0, "should not be called since DefDlgProc is not used\n" );
+    return 0;
+}
+
+static LRESULT WINAPI test_dlg_proc4(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    struct recvd_message msg;
+
+    if (!ignore_message( message ))
+    {
+        msg.hwnd = hwnd;
+        msg.message = message;
+        msg.flags = sent|wparam|lparam|parent;
+        msg.wParam = wParam;
+        msg.lParam = lParam;
+        msg.descr = "dialog";
+        add_message(&msg);
+    }
+    if (message == WM_INITDIALOG)
+    {
+        orig_edit_proc = (WNDPROC)SetWindowLongPtrW(GetDlgItem(hwnd, 200),
+                GWLP_WNDPROC, (LONG_PTR)dlg_creation_edit_proc);
+        return 1;
+    }
+    return DefWindowProcW( hwnd, message, wParam, lParam );
+}
+
 static const struct message WmDefDlgSetFocus_1[] = {
     { WM_GETDLGCODE, sent|wparam|lparam, 0, 0 },
     { WM_GETTEXTLENGTH, sent|wparam|lparam|optional, 0, 0 }, /* XP */
@@ -12024,6 +12053,41 @@ static const struct message WmCreateDialogParamSeq_3[] = {
     { 0 }
 };
 
+static const struct message WmCreateDialogParamSeq_4[] = {
+    { HCBT_CREATEWND, hook },
+    { WM_NCCREATE, sent|parent },
+    { WM_NCCALCSIZE, sent|parent|wparam, 0 },
+    { WM_CREATE, sent|parent },
+    { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
+    { WM_SIZE, sent|parent|wparam, SIZE_RESTORED },
+    { WM_MOVE, sent|parent },
+    { WM_SETFONT, sent|parent },
+    { WM_INITDIALOG, sent|parent },
+    { WM_GETDLGCODE, sent|wparam|lparam, 0, 0 },
+    { EM_SETSEL, sent|wparam|lparam, 0, INT_MAX },
+    { EM_SETSEL, sent|wparam|lparam|optional, 0, INT_MAX },
+    { EM_SETSEL, sent|wparam|lparam|optional, 0, INT_MAX },
+    { EM_SETSEL, sent|wparam|lparam|optional, 0, INT_MAX },
+    { HCBT_ACTIVATE, hook },
+    { WM_QUERYNEWPALETTE, sent|parent|optional }, /* TODO: this message should not be sent */
+    { WM_WINDOWPOSCHANGING, sent|parent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
+    { WM_WINDOWPOSCHANGING, sent|parent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
+    { WM_ACTIVATEAPP, sent|parent|wparam, 1 },
+    { WM_NCACTIVATE, sent|parent },
+    { WM_ACTIVATE, sent|parent|wparam, 1 },
+    { HCBT_SETFOCUS, hook },
+    { WM_SETFOCUS, sent|parent },
+    { WM_KILLFOCUS, sent|parent },
+    { WM_SETFOCUS, sent },
+    { WM_COMMAND, sent|parent|wparam, MAKELONG(200, EN_SETFOCUS) },
+    { WM_GETDLGCODE, sent|wparam|lparam, 0, 0 },
+    { WM_USER, sent|parent },
+    { WM_CHANGEUISTATE, sent|parent|optional },
+    { WM_UPDATEUISTATE, sent|parent|optional },
+    { WM_UPDATEUISTATE, sent|optional },
+    { 0 }
+};
+
 static void test_dialog_messages(void)
 {
     WNDCLASSA cls;
@@ -12133,6 +12197,16 @@ static void test_dialog_messages(void)
     DestroyWindow(hdlg);
     flush_sequence();
 
+    UnregisterClassA( cls.lpszClassName, cls.hInstance );
+    cls.lpfnWndProc = test_dlg_proc4;
+    ok( RegisterClassA(&cls), "failed to register class again\n" );
+    hdlg = CreateDialogParamA(0, "FOCUS_TEST_DIALOG_4", 0, test_dlg_proc3, 0);
+    ok(IsWindow(hdlg), "CreateDialogParam failed\n");
+    ok_sequence(WmCreateDialogParamSeq_4, "CreateDialogParam_4", TRUE);
+    EndDialog(hdlg, 0);
+    DestroyWindow(hdlg);
+    flush_sequence();
+
     UnregisterClassA(cls.lpszClassName, cls.hInstance);
 }
 
diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc
index fdef5a9..f116b85 100644
--- a/dlls/user32/tests/resource.rc
+++ b/dlls/user32/tests/resource.rc
@@ -115,6 +115,15 @@ FONT 8, "MS Shell Dlg"
   EDITTEXT                200,4,4,50,14
 }
 
+FOCUS_TEST_DIALOG_4 DIALOG 0, 0, 60, 30
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Test dialog"
+CLASS "MyDialogClass"
+FONT 8, "MS Shell Dlg"
+{
+  EDITTEXT                200,4,4,50,14
+}
+
 IDD_DIALOG DIALOG  0, 0, 186, 95
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Dialog"




More information about the wine-cvs mailing list