Piotr Caban : user32: Fix DefWindowProc(WM_NCRBUTTONDOWN) tests on Win 8 and 10.
Alexandre Julliard
julliard at winehq.org
Wed Sep 14 10:28:52 CDT 2016
Module: wine
Branch: master
Commit: 80a222a8cdb127aa9d292ff636ce2ad5f0b2989e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=80a222a8cdb127aa9d292ff636ce2ad5f0b2989e
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Sep 14 12:19:47 2016 +0200
user32: Fix DefWindowProc(WM_NCRBUTTONDOWN) tests on Win 8 and 10.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/msg.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 72614eb..b088d1c 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -13909,6 +13909,25 @@ static const struct message NCRBUTTONDOWNSeq[] =
{ 0 }
};
+struct rbuttonup_thread_data
+{
+ HWND hwnd;
+ HANDLE wndproc_finished;
+};
+
+static DWORD CALLBACK post_rbuttonup_msg( void *arg )
+{
+ struct rbuttonup_thread_data *data = arg;
+ DWORD ret;
+
+ ret = WaitForSingleObject( data->wndproc_finished, 500 );
+ todo_wine ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", ret );
+ if( ret == WAIT_OBJECT_0 ) return 0;
+
+ PostMessageA( data->hwnd, WM_RBUTTONUP, 0, 0 );
+ return 0;
+}
+
static void test_defwinproc(void)
{
HWND hwnd;
@@ -13918,6 +13937,8 @@ static void test_defwinproc(void)
RECT rect;
INT x, y;
LRESULT res;
+ struct rbuttonup_thread_data data;
+ HANDLE thread;
hwnd = CreateWindowExA(0, "TestWindowClass", "test_defwndproc",
WS_VISIBLE | WS_CAPTION | WS_OVERLAPPEDWINDOW, 0,0,500,100,0,0,0, NULL);
@@ -13933,11 +13954,25 @@ static void test_defwinproc(void)
res = DefWindowProcA( hwnd, WM_NCHITTEST, 0, MAKELPARAM(x, y));
ok(res == HTCAPTION, "WM_NCHITTEST returned %ld\n", res);
+ mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
+ mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
+ flush_events();
+
flush_sequence();
- PostMessageA( hwnd, WM_RBUTTONUP, 0, 0);
+ mouse_event( MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 );
+ /* workaround for missing support for clicking on window frame */
+ data.hwnd = hwnd;
+ data.wndproc_finished = CreateEventA( NULL, FALSE, FALSE, NULL );
+ thread = CreateThread( NULL, 0, post_rbuttonup_msg, (void*)&data, 0, NULL );
+
DefWindowProcA( hwnd, WM_NCRBUTTONDOWN, HTCAPTION, MAKELPARAM(x, y));
ok_sequence(NCRBUTTONDOWNSeq, "WM_NCRBUTTONDOWN on caption", FALSE);
+ SetEvent( data.wndproc_finished );
+ WaitForSingleObject( thread, 1000 );
+ CloseHandle( data.wndproc_finished );
+ CloseHandle( thread );
+
SetCursorPos(pos.x, pos.y);
DefWindowProcA( hwnd, WM_ENDSESSION, 1, 0);
More information about the wine-cvs
mailing list