Nikolay Sivov : user32/tests: Add more A/W message data conversion tests.

Alexandre Julliard julliard at winehq.org
Tue Jan 30 14:38:13 CST 2018


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Jan 29 23:42:26 2018 +0300

user32/tests: Add more A/W message data conversion tests.

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

---

 dlls/user32/tests/dialog.c | 63 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 55 insertions(+), 8 deletions(-)

diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index cbe4b2b..19f220d 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1237,8 +1237,17 @@ static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg,
 }
 
 static const WCHAR testtextW[] = {'W','n','d','T','e','x','t',0};
+
+enum defdlgproc_text
+{
+    DLGPROCTEXT_CONTEXT = 0,
+    DLGPROCTEXT_A,
+    DLGPROCTEXT_W,
+};
+
 static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
+    int mode = (int)GetPropA(hdlg, "test_mode");
     WCHAR *text = (WCHAR *)lparam;
     char *textA = (char *)lparam;
 
@@ -1251,12 +1260,28 @@ static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM
     case LB_DIR:
     case LB_ADDFILE:
     case EM_REPLACESEL:
-        if (IsWindowUnicode(hdlg))
-        todo_wine
-            ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
-        else
-        todo_wine
+        switch (mode)
+        {
+        case DLGPROCTEXT_A:
+        todo_wine_if(!IsWindowUnicode(hdlg))
             ok(!strcmp(textA, "WndText"), "Unexpected text %s.\n", textA);
+            break;
+        case DLGPROCTEXT_W:
+            if (msg == WM_SETTEXT && !IsWindowUnicode(hdlg))
+            todo_wine
+                ok(!strcmp(textA, "WndText"), "Unexpected text %s.\n", textA);
+            else
+        todo_wine_if(IsWindowUnicode(hdlg))
+                ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
+            break;
+        default:
+            if (IsWindowUnicode(hdlg))
+            todo_wine
+                ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
+            else
+            todo_wine
+                ok(!strcmp(textA, "WndText"), "Unexpected text %s.\n", textA);
+        }
         break;
     };
 
@@ -1265,6 +1290,7 @@ static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM
 
 static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
+    int mode = (int)GetPropA(hdlg, "test_mode");
     WCHAR *text = (WCHAR *)lparam;
     char *textA = (char *)lparam;
 
@@ -1277,10 +1303,22 @@ static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM
     case LB_DIR:
     case LB_ADDFILE:
     case EM_REPLACESEL:
-        if (IsWindowUnicode(hdlg))
-            ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
-        else
+        switch (mode)
+        {
+        case DLGPROCTEXT_A:
+        todo_wine_if(IsWindowUnicode(hdlg))
             ok(!strcmp(textA, "WndText"), "Unexpected text %s.\n", textA);
+            break;
+        case DLGPROCTEXT_W:
+        todo_wine_if(!IsWindowUnicode(hdlg))
+            ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
+            break;
+        default:
+            if (IsWindowUnicode(hdlg))
+                ok(!lstrcmpW(text, testtextW), "Unexpected text %s.\n", wine_dbgstr_w(text));
+            else
+                ok(!strcmp(textA, "WndText"), "Unexpected text %s.\n", textA);
+        }
         break;
     }
 
@@ -1291,11 +1329,20 @@ static void dlg_test_aw_message(HWND hdlg, UINT msg)
 {
     LRESULT ret;
 
+    SetPropA(hdlg, "test_mode", DLGPROCTEXT_CONTEXT);
     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);
+
+    SetPropA(hdlg, "test_mode", (void *)DLGPROCTEXT_A);
+    ret = DefDlgProcA(hdlg, msg, 0, (LPARAM)"WndText");
+    ok(ret == 0, "Unexpected retval %ld.\n", ret);
+
+    SetPropA(hdlg, "test_mode", (void *)DLGPROCTEXT_W);
+    ret = DefDlgProcW(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)




More information about the wine-cvs mailing list