[WineTests]

- Sync to 1.5.18

svn path=/trunk/; revision=57765
This commit is contained in:
James Tabor 2012-11-25 02:53:09 +00:00
parent 4864e1b553
commit e223b5389a
3 changed files with 317 additions and 12 deletions

View file

@ -6795,6 +6795,7 @@ static void test_interthread_messages(void)
wnd_event.hwnd = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 200, 200, 0, 0, 0, NULL);
ok (wnd_event.hwnd != 0, "Failed to create parent window\n");
flush_events();
flush_sequence();
log_all_parent_messages++;
wnd_event.start_event = CreateEventA( NULL, TRUE, FALSE, NULL );
@ -11031,11 +11032,6 @@ static void test_ShowWindow(void)
}
else
{
if (wp.ptMinPosition.x != sw[i].wp_min.x || wp.ptMinPosition.y != sw[i].wp_min.y)
todo_wine
ok(wp.ptMinPosition.x == sw[i].wp_min.x && wp.ptMinPosition.y == sw[i].wp_min.y,
"expected %d,%d got %d,%d\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
else
ok(wp.ptMinPosition.x == sw[i].wp_min.x && wp.ptMinPosition.y == sw[i].wp_min.y,
"expected %d,%d got %d,%d\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
}
@ -11268,8 +11264,7 @@ static void test_EndDialog(void)
ok(GetClassInfo(0, "#32770", &cls), "GetClassInfo failed\n");
cls.lpszClassName = "MyDialogClass";
cls.hInstance = GetModuleHandle(0);
/* need a cast since a dlgproc is used as a wndproc */
cls.lpfnWndProc = (WNDPROC)test_dlg_proc;
cls.lpfnWndProc = test_dlg_proc;
if (!RegisterClass(&cls)) assert(0);
flush_sequence();
@ -13792,6 +13787,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 +13817,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 +13913,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 - 50 && rect.bottom == client.bottom),
"wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
DestroyWindow( hwnd );
DeleteDC( hdc );
DeleteObject( bmp );

View file

@ -170,11 +170,11 @@ static void test_accel1(void)
ac[n].cmd = 0xfff0;
ac[n].key = 0xffff;
ac[n++].fVirt = (SHORT) 0x0000;
ac[n++].fVirt = 0x0000;
ac[n].cmd = 0xfff0;
ac[n].key = 0xffff;
ac[n++].fVirt = (SHORT) 0x0001;
ac[n++].fVirt = 0x0001;
hAccel = CreateAcceleratorTable( &ac[0], n );
ok( hAccel != NULL, "create accelerator table\n");

View file

@ -50,6 +50,7 @@ static UINT (WINAPI *pGetWindowModuleFileNameA)(HWND,LPSTR,UINT);
static BOOL (WINAPI *pGetLayeredWindowAttributes)(HWND,COLORREF*,BYTE*,DWORD*);
static BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
static BOOL (WINAPI *pUpdateLayeredWindowIndirect)(HWND,const UPDATELAYEREDWINDOWINFO*);
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static int (WINAPI *pGetWindowRgnBox)(HWND,LPRECT);
@ -2636,7 +2637,7 @@ static void test_SetActiveWindow(HWND hwnd)
SetActiveWindow(0);
check_wnd_state(0, 0, 0, 0);
/*trace("testing SetActiveWindow %p\n", hwnd);*/
trace("testing SetActiveWindow %p\n", hwnd);
ShowWindow(hwnd, SW_SHOW);
check_wnd_state(hwnd, hwnd, hwnd, 0);
@ -2656,11 +2657,11 @@ static void test_SetActiveWindow(HWND hwnd)
SetWindowPos(hwnd,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
check_wnd_state(hwnd, hwnd, hwnd, 0);
trace("testing ShowWindow SW_HIDE window %p\n", hwnd);
ShowWindow(hwnd, SW_HIDE);
check_wnd_state(0, 0, 0, 0);
/*trace("testing SetActiveWindow on an invisible window %p\n", hwnd);*/
trace("testing SetActiveWindow on an invisible window %p\n", hwnd);
SetActiveWindow(hwnd);
check_wnd_state(hwnd, hwnd, hwnd, 0);
@ -6074,6 +6075,47 @@ static void test_layered_window(void)
ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
ok( ret, "UpdateLayeredWindow should succeed on layered window\n" );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE | ULW_EX_NORESIZE );
ok( !ret, "UpdateLayeredWindow should fail with ex flag\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
if (pUpdateLayeredWindowIndirect)
{
UPDATELAYEREDWINDOWINFO info;
info.cbSize = sizeof(info);
info.hdcDst = 0;
info.pptDst = NULL;
info.psize = &sz;
info.hdcSrc = hdc;
info.pptSrc = &pt;
info.crKey = 0;
info.pblend = NULL;
info.dwFlags = ULW_OPAQUE | ULW_EX_NORESIZE;
info.prcDirty = NULL;
ret = pUpdateLayeredWindowIndirect( hwnd, &info );
ok( ret, "UpdateLayeredWindowIndirect should succeed on layered window\n" );
sz.cx--;
ret = pUpdateLayeredWindowIndirect( hwnd, &info );
ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
ok( GetLastError() == ERROR_INCORRECT_SIZE || broken(GetLastError() == ERROR_MR_MID_NOT_FOUND),
"wrong error %u\n", GetLastError() );
info.dwFlags = ULW_OPAQUE;
ret = pUpdateLayeredWindowIndirect( hwnd, &info );
ok( ret, "UpdateLayeredWindowIndirect should succeed on layered window\n" );
sz.cx++;
info.dwFlags = ULW_OPAQUE | 0xf00;
ret = pUpdateLayeredWindowIndirect( hwnd, &info );
ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
info.cbSize--;
info.dwFlags = ULW_OPAQUE;
ret = pUpdateLayeredWindowIndirect( hwnd, &info );
ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ret = pUpdateLayeredWindowIndirect( hwnd, NULL );
ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
}
ret = pSetLayeredWindowAttributes( hwnd, 0x654321, 22, LWA_COLORKEY | LWA_ALPHA );
ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
@ -7062,6 +7104,228 @@ todo_wine
ok(ret, "UnregisterClass(my_window) failed\n");
}
static void test_map_points(void)
{
BOOL ret;
POINT p;
HWND wnd, wnd0, dwnd;
INT n;
DWORD err;
POINT pos = { 100, 200 };
int width = 150;
int height = 150;
RECT window_rect;
RECT client_rect;
/* Create test windows */
wnd = CreateWindow("static", "test1", WS_POPUP, pos.x, pos.y, width, height, NULL, NULL, NULL, NULL);
ok(wnd != NULL, "Failed %p\n", wnd);
wnd0 = CreateWindow("static", "test2", WS_POPUP, 0, 0, width, height, NULL, NULL, NULL, NULL);
ok(wnd0 != NULL, "Failed %p\n", wnd);
dwnd = CreateWindow("static", "test3", 0, 200, 300, 150, 150, NULL, NULL, NULL, NULL);
DestroyWindow(dwnd);
ok(dwnd != NULL, "Failed %p\n", dwnd);
/* Verify window rect and client rect (they should have the same width and height) */
GetWindowRect(wnd, &window_rect);
ok(window_rect.left == pos.x, "left is %d instead of %d\n", window_rect.left, pos.x);
ok(window_rect.top == pos.y, "top is %d instead of %d\n", window_rect.top, pos.y);
ok(window_rect.right == pos.x + width, "right is %d instead of %d\n", window_rect.right, pos.x + width);
ok(window_rect.bottom == pos.y + height, "bottom is %d instead of %d\n", window_rect.bottom, pos.y + height);
GetClientRect(wnd, &client_rect);
ok(client_rect.left == 0, "left is %d instead of 0\n", client_rect.left);
ok(client_rect.top == 0, "top is %d instead of 0\n", client_rect.top);
ok(client_rect.right == width, "right is %d instead of %d\n", client_rect.right, width);
ok(client_rect.bottom == height, "bottom is %d instead of %d\n", client_rect.bottom, height);
/* Test MapWindowPoints */
/* MapWindowPoints(NULL or wnd, NULL or wnd, NULL, 1); crashes on Windows */
SetLastError(0xdeadbeef);
n = MapWindowPoints(NULL, NULL, NULL, 0);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
SetLastError(0xdeadbeef);
n = MapWindowPoints(wnd, wnd, NULL, 0);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
n = MapWindowPoints(wnd, NULL, NULL, 0);
ok(n == MAKELONG(window_rect.left, window_rect.top), "Got %x, expected %x\n",
n, MAKELONG(window_rect.left, window_rect.top));
n = MapWindowPoints(NULL, wnd, NULL, 0);
ok(n == MAKELONG(-window_rect.left, -window_rect.top), "Got %x, expected %x\n",
n, MAKELONG(-window_rect.left, -window_rect.top));
SetLastError(0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(dwnd, NULL, &p, 1);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(dwnd, wnd, &p, 1);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(NULL, dwnd, &p, 1);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(wnd, dwnd, &p, 1);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(dwnd, dwnd, &p, 1);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(NULL, NULL, &p, 1);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(wnd, wnd, &p, 1);
err = GetLastError();
ok(n == 0, "Got %d, expected %d\n", n, 0);
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
p.x = p.y = 100;
n = MapWindowPoints(wnd, NULL, &p, 1);
ok(n == MAKELONG(window_rect.left, window_rect.top), "Got %x, expected %x\n",
n, MAKELONG(window_rect.left, window_rect.top));
ok((p.x == (window_rect.left + 100)) && (p.y == (window_rect.top + 100)), "Failed got (%d, %d), expected (%d, %d)\n",
p.x, p.y, window_rect.left + 100, window_rect.top + 100);
p.x = p.y = 100;
n = MapWindowPoints(NULL, wnd, &p, 1);
ok(n == MAKELONG(-window_rect.left, -window_rect.top), "Got %x, expected %x\n",
n, MAKELONG(-window_rect.left, -window_rect.top));
ok((p.x == (-window_rect.left + 100)) && (p.y == (-window_rect.top + 100)), "Failed got (%d, %d), expected (%d, %d)\n",
p.x, p.y, -window_rect.left + 100, -window_rect.top + 100);
SetLastError(0xdeadbeef);
p.x = p.y = 0;
n = MapWindowPoints(wnd0, NULL, &p, 1);
err = GetLastError();
ok(n == 0, "Got %x, expected 0\n", n);
ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
SetLastError(0xdeadbeef);
p.x = p.y = 0;
n = MapWindowPoints(NULL, wnd0, &p, 1);
err = GetLastError();
ok(n == 0, "Got %x, expected 0\n", n);
ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
/* Test ClientToScreen */
/* ClientToScreen(wnd, NULL); crashes on Windows */
SetLastError(0xdeadbeef);
ret = ClientToScreen(NULL, NULL);
err = GetLastError();
ok(!ret, "Should fail\n");
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
ret = ClientToScreen(NULL, &p);
err = GetLastError();
ok(!ret, "Should fail\n");
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
ret = ClientToScreen(dwnd, &p);
err = GetLastError();
ok(!ret, "Should fail\n");
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
p.x = p.y = 100;
ret = ClientToScreen(wnd, &p);
ok(ret, "Failed with error %u\n", GetLastError());
ok((p.x == (window_rect.left + 100)) && (p.y == (window_rect.top + 100)), "Failed got (%d, %d), expected (%d, %d)\n",
p.x, p.y, window_rect.left + 100, window_rect.top + 100);
p.x = p.y = 0;
ret = ClientToScreen(wnd0, &p);
ok(ret, "Failed with error %u\n", GetLastError());
ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
/* Test ScreenToClient */
/* ScreenToClient(wnd, NULL); crashes on Windows */
SetLastError(0xdeadbeef);
ret = ScreenToClient(NULL, NULL);
err = GetLastError();
ok(!ret, "Should fail\n");
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
ret = ScreenToClient(NULL, &p);
err = GetLastError();
ok(!ret, "Should fail\n");
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
SetLastError(0xdeadbeef);
p.x = p.y = 100;
ret = ScreenToClient(dwnd, &p);
err = GetLastError();
ok(!ret, "Should fail\n");
ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
p.x = p.y = 100;
ret = ScreenToClient(wnd, &p);
ok(ret, "Failed with error %u\n", GetLastError());
ok((p.x == (-window_rect.left + 100)) && (p.y == (-window_rect.top + 100)), "Failed got(%d, %d), expected (%d, %d)\n",
p.x, p.y, -window_rect.left + 100, -window_rect.top + 100);
p.x = p.y = 0;
ret = ScreenToClient(wnd0, &p);
ok(ret, "Failed with error %u\n", GetLastError());
ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
DestroyWindow(wnd);
DestroyWindow(wnd0);
}
START_TEST(win)
{
HMODULE user32 = GetModuleHandleA( "user32.dll" );
@ -7072,6 +7336,7 @@ START_TEST(win)
pGetLayeredWindowAttributes = (void *)GetProcAddress( user32, "GetLayeredWindowAttributes" );
pSetLayeredWindowAttributes = (void *)GetProcAddress( user32, "SetLayeredWindowAttributes" );
pUpdateLayeredWindow = (void *)GetProcAddress( user32, "UpdateLayeredWindow" );
pUpdateLayeredWindowIndirect = (void *)GetProcAddress( user32, "UpdateLayeredWindowIndirect" );
pGetMonitorInfoA = (void *)GetProcAddress( user32, "GetMonitorInfoA" );
pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
@ -7172,6 +7437,7 @@ START_TEST(win)
test_shell_window();
test_handles( hwndMain );
test_winregion();
test_map_points();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);