diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 0b63799aed4..32087519996 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 );