Nikolay Sivov : user32/tests: Add some more tests for message data conversion in dialog procedures.

Alexandre Julliard julliard at winehq.org
Mon Jan 8 16:08:07 CST 2018


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Jan  8 15:58:19 2018 +0300

user32/tests: Add some more tests for message data conversion in dialog procedures.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/dialog.c | 80 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 65 insertions(+), 15 deletions(-)

diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index afc3473..cbe4b2b 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1239,44 +1239,65 @@ static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg,
 static const WCHAR testtextW[] = {'W','n','d','T','e','x','t',0};
 static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
-    if (msg == WM_SETTEXT)
+    WCHAR *text = (WCHAR *)lparam;
+    char *textA = (char *)lparam;
+
+    switch (msg)
     {
+    case WM_SETTEXT:
+    case WM_WININICHANGE:
+    case WM_DEVMODECHANGE:
+    case CB_DIR:
+    case LB_DIR:
+    case LB_ADDFILE:
+    case EM_REPLACESEL:
         if (IsWindowUnicode(hdlg))
-        {
-            WCHAR *text = (WCHAR *)lparam;
         todo_wine
             ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
-        }
         else
-        {
-            char *textA = (char *)lparam;
         todo_wine
             ok(!strcmp(textA, "WndText"), "Unexpected text %s.\n", textA);
-        }
-    }
+        break;
+    };
 
     return DefWindowProcW(hdlg, msg, wparam, lparam);
 }
 
 static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
-    if (msg == WM_SETTEXT)
+    WCHAR *text = (WCHAR *)lparam;
+    char *textA = (char *)lparam;
+
+    switch (msg)
     {
+    case WM_SETTEXT:
+    case WM_WININICHANGE:
+    case WM_DEVMODECHANGE:
+    case CB_DIR:
+    case LB_DIR:
+    case LB_ADDFILE:
+    case EM_REPLACESEL:
         if (IsWindowUnicode(hdlg))
-        {
-            WCHAR *text = (WCHAR *)lparam;
             ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
-        }
         else
-        {
-            char *textA = (char *)lparam;
             ok(!strcmp(textA, "WndText"), "Unexpected text %s.\n", textA);
-        }
+        break;
     }
 
     return DefWindowProcA(hdlg, msg, wparam, lparam);
 }
 
+static void dlg_test_aw_message(HWND hdlg, UINT msg)
+{
+    LRESULT ret;
+
+    ret = SendMessageA(hdlg, msg, 0, (LPARAM)"WndText");
+    ok(ret == 0, "Unexpected retval %ld.\n", ret);
+
+    ret = SendMessageW(hdlg, msg, 0, (LPARAM)testtextW);
+    ok(ret == 0, "Unexpected retval %ld.\n", ret);
+}
+
 static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
     ULONG_PTR dlgproc, originalproc;
@@ -1290,6 +1311,7 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM w
     case WM_INITDIALOG:
         ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
 
+        /* WM_SETTEXT/WM_GETTEXT */
         originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
         ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", originalproc);
 
@@ -1320,6 +1342,13 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM w
     todo_wine
         ok(!lstrcmpW(buffW, testtextW) && len == 0, "Unexpected window text %s, len %d\n", wine_dbgstr_w(buffW), len);
 
+        dlg_test_aw_message(hdlg, WM_WININICHANGE);
+        dlg_test_aw_message(hdlg, WM_DEVMODECHANGE);
+        dlg_test_aw_message(hdlg, CB_DIR);
+        dlg_test_aw_message(hdlg, LB_DIR);
+        dlg_test_aw_message(hdlg, LB_ADDFILE);
+        dlg_test_aw_message(hdlg, EM_REPLACESEL);
+
         dlgproc = SetWindowLongPtrW(hdlg, DWLP_DLGPROC, (UINT_PTR)test_aw_conversion_dlgprocW);
         ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
 
@@ -1343,6 +1372,13 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM w
         ok(buffW[0] == 'W' && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
             buffW[0], buffW[1], len);
 
+        dlg_test_aw_message(hdlg, WM_WININICHANGE);
+        dlg_test_aw_message(hdlg, WM_DEVMODECHANGE);
+        dlg_test_aw_message(hdlg, CB_DIR);
+        dlg_test_aw_message(hdlg, LB_DIR);
+        dlg_test_aw_message(hdlg, LB_ADDFILE);
+        dlg_test_aw_message(hdlg, EM_REPLACESEL);
+
         SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
         EndDialog(hdlg, -123);
         return TRUE;
@@ -1391,6 +1427,13 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM
         ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %s, len %d\n",
             wine_dbgstr_w(buffW), len);
 
+        dlg_test_aw_message(hdlg, WM_WININICHANGE);
+        dlg_test_aw_message(hdlg, WM_DEVMODECHANGE);
+        dlg_test_aw_message(hdlg, CB_DIR);
+        dlg_test_aw_message(hdlg, LB_DIR);
+        dlg_test_aw_message(hdlg, LB_ADDFILE);
+        dlg_test_aw_message(hdlg, EM_REPLACESEL);
+
         dlgproc = SetWindowLongPtrW(hdlg, DWLP_DLGPROC, (UINT_PTR)test_aw_conversion_dlgprocA);
         ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
 
@@ -1415,6 +1458,13 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM
         ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
             buffW[0], buffW[1], len);
 
+        dlg_test_aw_message(hdlg, WM_WININICHANGE);
+        dlg_test_aw_message(hdlg, WM_DEVMODECHANGE);
+        dlg_test_aw_message(hdlg, CB_DIR);
+        dlg_test_aw_message(hdlg, LB_DIR);
+        dlg_test_aw_message(hdlg, LB_ADDFILE);
+        dlg_test_aw_message(hdlg, EM_REPLACESEL);
+
         SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
         EndDialog(hdlg, -123);
         return TRUE;




More information about the wine-cvs mailing list