Alexandre Julliard : user32/tests: Add a test for calling UpdateLayeredWindow from a different thread.
Alexandre Julliard
julliard at winehq.org
Mon Sep 17 14:06:34 CDT 2012
Module: wine
Branch: master
Commit: b57323a61e497923bd922d076a4cc47289e6b834
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b57323a61e497923bd922d076a4cc47289e6b834
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Sep 17 14:03:42 2012 +0200
user32/tests: Add a test for calling UpdateLayeredWindow from a different thread.
---
dlls/user32/tests/msg.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 0b63799..3208751 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -13792,6 +13792,27 @@ static const struct message WmSetLayeredStyle2[] = {
{ 0 }
};
+struct layered_window_info
+{
+ HWND hwnd;
+ HDC hdc;
+ SIZE size;
+ HANDLE event;
+ BOOL ret;
+};
+
+static DWORD CALLBACK update_layered_proc( void *param )
+{
+ struct layered_window_info *info = param;
+ POINT src = { 0, 0 };
+
+ info->ret = pUpdateLayeredWindow( info->hwnd, 0, NULL, &info->size,
+ info->hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( info->ret, "failed\n");
+ SetEvent( info->event );
+ return 0;
+}
+
static void test_layered_window(void)
{
HWND hwnd;
@@ -13801,6 +13822,9 @@ static void test_layered_window(void)
SIZE size;
POINT pos, src;
RECT rect, client;
+ HANDLE thread;
+ DWORD tid;
+ struct layered_window_info info;
if (!pUpdateLayeredWindow)
{
@@ -13894,6 +13918,26 @@ static void test_layered_window(void)
broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50),
"wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+ SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ info.hwnd = hwnd;
+ info.hdc = hdc;
+ info.size.cx = 250;
+ info.size.cy = 300;
+ info.event = CreateEventA( NULL, TRUE, FALSE, NULL );
+ info.ret = FALSE;
+ thread = CreateThread( NULL, 0, update_layered_proc, &info, 0, &tid );
+ ok( WaitForSingleObject( info.event, 1000 ) == 0, "wait failed\n" );
+ ok( info.ret, "UpdateLayeredWindow failed in other thread\n" );
+ WaitForSingleObject( thread, 1000 );
+ CloseHandle( thread );
+ GetWindowRect( hwnd, &rect );
+ ok( rect.left == 200 && rect.top == 200 && rect.right == 450 && rect.bottom == 500,
+ "wrong window rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+ GetClientRect( hwnd, &rect );
+ ok( (rect.right == 250 && rect.bottom == 300) ||
+ broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50),
+ "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+
DestroyWindow( hwnd );
DeleteDC( hdc );
DeleteObject( bmp );
More information about the wine-cvs
mailing list