Add more message conversion tests, make the tests pass under Wine

Dmitry Timoshkov dmitry at baikal.ru
Fri Oct 1 07:41:28 CDT 2004


Hello,

please apply this patch after Rob's message conversion tests.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Add more message conversion tests, make the tests pass under Wine.

diff -u cvs/hq/wine/dlls/user/message.c wine/dlls/user/message.c
--- cvs/hq/wine/dlls/user/message.c	2004-10-01 21:23:57.000000000 +0900
+++ wine/dlls/user/message.c	2004-10-01 21:29:03.000000000 +0900
@@ -2033,7 +2033,7 @@ BOOL WINAPI SendNotifyMessageW( HWND hwn
 
     if (is_pointer_message(msg))
     {
-        SetLastError(ERROR_INVALID_PARAMETER);
+        SetLastError( ERROR_MESSAGE_SYNC_ONLY );
         return FALSE;
     }
 
@@ -2086,7 +2086,7 @@ BOOL WINAPI SendMessageCallbackW( HWND h
 
     if (is_pointer_message(msg))
     {
-        SetLastError(ERROR_INVALID_PARAMETER);
+        SetLastError( ERROR_MESSAGE_SYNC_ONLY );
         return FALSE;
     }
 
@@ -2175,7 +2175,7 @@ BOOL WINAPI PostMessageW( HWND hwnd, UIN
 
     if (is_pointer_message( msg ))
     {
-        SetLastError( ERROR_INVALID_PARAMETER );
+        SetLastError( ERROR_MESSAGE_SYNC_ONLY );
         return FALSE;
     }
 
@@ -2223,7 +2223,7 @@ BOOL WINAPI PostThreadMessageW( DWORD th
 
     if (is_pointer_message( msg ))
     {
-        SetLastError( ERROR_INVALID_PARAMETER );
+        SetLastError( ERROR_MESSAGE_SYNC_ONLY );
         return FALSE;
     }
     if (USER_IsExitingThread( thread )) return TRUE;
diff -u cvs/hq/wine/dlls/user/tests/msg.c wine/dlls/user/tests/msg.c
--- cvs/hq/wine/dlls/user/tests/msg.c	2004-10-01 21:25:45.000000000 +0900
+++ wine/dlls/user/tests/msg.c	2004-10-01 21:29:03.000000000 +0900
@@ -32,7 +32,6 @@
 #include "winuser.h"
 
 #include "wine/test.h"
-#include "wine/unicode.h"
 
 #define MDI_FIRST_CHILD_ID 2004
 
@@ -2945,9 +2944,9 @@ static LRESULT CALLBACK MsgConversionPro
     {
     case CB_FINDSTRINGEXACT:
         trace("String: %p\n", (LPCWSTR)lParam);
-        if (!strcmpW((LPCWSTR)lParam, wszUnicode))
+        if (!lstrcmpW((LPCWSTR)lParam, wszUnicode))
             return 1;
-        if (!strcmpW((LPCWSTR)lParam, wszAnsi))
+        if (!lstrcmpW((LPCWSTR)lParam, wszAnsi))
             return 0;
         return -1;
     }
@@ -3006,8 +3005,6 @@ static void test_message_conversion(void
 
     /* Asynchronous messages */
 
-    todo_wine
-    {
     SetLastError(0);
     lRes = PostMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
@@ -3016,7 +3013,30 @@ static void test_message_conversion(void
     lRes = PostMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
         "PostMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError());
-    }
+    SetLastError(0);
+    lRes = PostThreadMessageA(GetCurrentThreadId(), CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
+    ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
+        "PosThreadtMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError());
+    SetLastError(0);
+    lRes = PostThreadMessageW(GetCurrentThreadId(), CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
+    ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
+        "PosThreadtMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError());
+    SetLastError(0);
+    lRes = SendNotifyMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
+    ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
+        "SendNotifyMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError());
+    SetLastError(0);
+    lRes = SendNotifyMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
+    ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
+        "SendNotifyMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError());
+    SetLastError(0);
+    lRes = SendMessageCallbackA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode, NULL, 0);
+    ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
+        "SendMessageCallback on sync only message returned %ld, last error %ld\n", lRes, GetLastError());
+    SetLastError(0);
+    lRes = SendMessageCallbackW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode, NULL, 0);
+    ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
+        "SendMessageCallback on sync only message returned %ld, last error %ld\n", lRes, GetLastError());
 }
 
 START_TEST(msg)






More information about the wine-patches mailing list