Piotr Caban : user32/tests: Show that message conversion should work on window procedures without handles.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 14 09:05:21 CDT 2016


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Mar  9 13:51:43 2016 +0100

user32/tests: Show that message conversion should work on window procedures without handles.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/win.c | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index e121809..cf7ddc8 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -8686,8 +8686,30 @@ static LRESULT WINAPI winproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
     return 0;
 }
 
-static LRESULT WINAPI winproc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+static LRESULT WINAPI winproc_convA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
+    if(msg == WM_SETTEXT)
+    {
+        const char *text = (const char*)lparam;
+
+        ok(!wparam, "wparam = %08lx\n", wparam);
+        ok(!strcmp(text, "text"), "WM_SETTEXT lparam = %s\n", text);
+        return 1;
+    }
+    return 0;
+}
+
+static const WCHAR textW[] = {'t','e','x','t',0};
+static LRESULT WINAPI winproc_convW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    if(msg == WM_SETTEXT)
+    {
+        const WCHAR *text = (const WCHAR*)lparam;
+
+        ok(!wparam, "wparam = %08lx\n", wparam);
+        ok(!lstrcmpW(text, textW), "WM_SETTEXT lparam = %s\n", wine_dbgstr_w(text));
+        return 1;
+    }
     return 0;
 }
 
@@ -8765,8 +8787,16 @@ static void test_winproc_limit(void)
             break;
     }
     ok(i != 0xffff, "unable to run out of winproc slots\n");
-    ok(SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)winproc2),
+
+    ok(SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)winproc_convA),
+            "SetWindowLongPtr failed with error %d\n", GetLastError());
+    ok(SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"text"), "WM_SETTEXT failed\n");
+    ok(SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)textW), "WM_SETTEXT with conversion failed\n");
+
+    ok(SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)winproc_convW),
             "SetWindowLongPtr failed with error %d\n", GetLastError());
+    ok(SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"text"), "WM_SETTEXT failed\n");
+    ok(SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)textW), "WM_SETTEXT with conversion failed\n");
 
     i = 0;
     CallWindowProcA(winproc_handle, 0, 0, 0, (LPARAM)&i);




More information about the wine-cvs mailing list