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

This commit is contained in:
Dmitry Timoshkov 2004-10-04 20:39:00 +00:00 committed by Alexandre Julliard
parent 6be32f7edc
commit 11d550dfa8
2 changed files with 30 additions and 10 deletions

View File

@ -2033,7 +2033,7 @@ BOOL WINAPI SendNotifyMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
if (is_pointer_message(msg)) if (is_pointer_message(msg))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError( ERROR_MESSAGE_SYNC_ONLY );
return FALSE; return FALSE;
} }
@ -2086,7 +2086,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
if (is_pointer_message(msg)) if (is_pointer_message(msg))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError( ERROR_MESSAGE_SYNC_ONLY );
return FALSE; return FALSE;
} }
@ -2175,7 +2175,7 @@ BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
if (is_pointer_message( msg )) if (is_pointer_message( msg ))
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_MESSAGE_SYNC_ONLY );
return FALSE; return FALSE;
} }
@ -2223,7 +2223,7 @@ BOOL WINAPI PostThreadMessageW( DWORD thread, UINT msg, WPARAM wparam, LPARAM lp
if (is_pointer_message( msg )) if (is_pointer_message( msg ))
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_MESSAGE_SYNC_ONLY );
return FALSE; return FALSE;
} }
if (USER_IsExitingThread( thread )) return TRUE; if (USER_IsExitingThread( thread )) return TRUE;

View File

@ -32,7 +32,6 @@
#include "winuser.h" #include "winuser.h"
#include "wine/test.h" #include "wine/test.h"
#include "wine/unicode.h"
#define MDI_FIRST_CHILD_ID 2004 #define MDI_FIRST_CHILD_ID 2004
@ -2945,9 +2944,9 @@ static LRESULT CALLBACK MsgConversionProcW(HWND hwnd, UINT uMsg, WPARAM wParam,
{ {
case CB_FINDSTRINGEXACT: case CB_FINDSTRINGEXACT:
trace("String: %p\n", (LPCWSTR)lParam); trace("String: %p\n", (LPCWSTR)lParam);
if (!strcmpW((LPCWSTR)lParam, wszUnicode)) if (!lstrcmpW((LPCWSTR)lParam, wszUnicode))
return 1; return 1;
if (!strcmpW((LPCWSTR)lParam, wszAnsi)) if (!lstrcmpW((LPCWSTR)lParam, wszAnsi))
return 0; return 0;
return -1; return -1;
} }
@ -3006,8 +3005,6 @@ static void test_message_conversion(void)
/* Asynchronous messages */ /* Asynchronous messages */
todo_wine
{
SetLastError(0); SetLastError(0);
lRes = PostMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); lRes = PostMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, 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); lRes = PostMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY,
"PostMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); "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) START_TEST(msg)