Commit cb9f5e7d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

user32/tests: Remove some workarounds for older Windows versions.

parent 8a13cc64
...@@ -2010,15 +2010,10 @@ static int log_all_parent_messages; ...@@ -2010,15 +2010,10 @@ static int log_all_parent_messages;
static CRITICAL_SECTION sequence_cs; static CRITICAL_SECTION sequence_cs;
/* user32 functions */ /* user32 functions */
static HWND (WINAPI *pGetAncestor)(HWND,UINT);
static BOOL (WINAPI *pGetMenuInfo)(HMENU,LPCMENUINFO);
static void (WINAPI *pNotifyWinEvent)(DWORD, HWND, LONG, LONG); static void (WINAPI *pNotifyWinEvent)(DWORD, HWND, LONG, LONG);
static BOOL (WINAPI *pSetMenuInfo)(HMENU,LPCMENUINFO);
static HWINEVENTHOOK (WINAPI *pSetWinEventHook)(DWORD, DWORD, HMODULE, WINEVENTPROC, DWORD, DWORD, DWORD); static HWINEVENTHOOK (WINAPI *pSetWinEventHook)(DWORD, DWORD, HMODULE, WINEVENTPROC, DWORD, DWORD, DWORD);
static BOOL (WINAPI *pTrackMouseEvent)(TRACKMOUSEEVENT*); static BOOL (WINAPI *pTrackMouseEvent)(TRACKMOUSEEVENT*);
static BOOL (WINAPI *pUnhookWinEvent)(HWINEVENTHOOK); static BOOL (WINAPI *pUnhookWinEvent)(HWINEVENTHOOK);
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD); static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
static UINT_PTR (WINAPI *pSetSystemTimer)(HWND, UINT_PTR, UINT, TIMERPROC); static UINT_PTR (WINAPI *pSetSystemTimer)(HWND, UINT_PTR, UINT, TIMERPROC);
static UINT_PTR (WINAPI *pKillSystemTimer)(HWND, UINT_PTR); static UINT_PTR (WINAPI *pKillSystemTimer)(HWND, UINT_PTR);
...@@ -2037,15 +2032,10 @@ static void init_procs(void) ...@@ -2037,15 +2032,10 @@ static void init_procs(void)
trace("GetProcAddress(%s) failed\n", #func); \ trace("GetProcAddress(%s) failed\n", #func); \
} }
GET_PROC(user32, GetAncestor)
GET_PROC(user32, GetMenuInfo)
GET_PROC(user32, NotifyWinEvent) GET_PROC(user32, NotifyWinEvent)
GET_PROC(user32, SetMenuInfo)
GET_PROC(user32, SetWinEventHook) GET_PROC(user32, SetWinEventHook)
GET_PROC(user32, TrackMouseEvent) GET_PROC(user32, TrackMouseEvent)
GET_PROC(user32, UnhookWinEvent) GET_PROC(user32, UnhookWinEvent)
GET_PROC(user32, GetMonitorInfoA)
GET_PROC(user32, MonitorFromPoint)
GET_PROC(user32, UpdateLayeredWindow) GET_PROC(user32, UpdateLayeredWindow)
GET_PROC(user32, SetSystemTimer) GET_PROC(user32, SetSystemTimer)
GET_PROC(user32, KillSystemTimer) GET_PROC(user32, KillSystemTimer)
...@@ -9469,8 +9459,7 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message, ...@@ -9469,8 +9459,7 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message,
} }
/* fall through */ /* fall through */
case WM_DESTROY: case WM_DESTROY:
if (pGetAncestor) ok(GetAncestor(hwnd, GA_PARENT) != 0, "parent should NOT be unlinked at this point\n");
ok(pGetAncestor(hwnd, GA_PARENT) != 0, "parent should NOT be unlinked at this point\n");
if (test_DestroyWindow_flag) if (test_DestroyWindow_flag)
{ {
DWORD style = GetWindowLongA(hwnd, GWL_STYLE); DWORD style = GetWindowLongA(hwnd, GWL_STYLE);
...@@ -11172,10 +11161,8 @@ static void test_DestroyWindow(void) ...@@ -11172,10 +11161,8 @@ static void test_DestroyWindow(void)
test = GetParent(child2); test = GetParent(child2);
ok(test == GetDesktopWindow(), "wrong parent %p\n", test); ok(test == GetDesktopWindow(), "wrong parent %p\n", test);
ok(!IsChild(parent, child2), "wrong parent/child %p/%p\n", parent, child2); ok(!IsChild(parent, child2), "wrong parent/child %p/%p\n", parent, child2);
if(pGetAncestor) { test = GetAncestor(child2, GA_PARENT);
test = pGetAncestor(child2, GA_PARENT); ok(test == GetDesktopWindow(), "wrong parent %p\n", test);
ok(test == GetDesktopWindow(), "wrong parent %p\n", test);
}
test = GetWindow(child2, GW_OWNER); test = GetWindow(child2, GW_OWNER);
ok(!test, "wrong owner %p\n", test); ok(!test, "wrong owner %p\n", test);
...@@ -11186,10 +11173,8 @@ static void test_DestroyWindow(void) ...@@ -11186,10 +11173,8 @@ static void test_DestroyWindow(void)
test = GetParent(parent); test = GetParent(parent);
ok(!test, "wrong parent %p\n", test); ok(!test, "wrong parent %p\n", test);
ok(!IsChild(GetDesktopWindow(), parent), "wrong parent/child %p/%p\n", GetDesktopWindow(), parent); ok(!IsChild(GetDesktopWindow(), parent), "wrong parent/child %p/%p\n", GetDesktopWindow(), parent);
if(pGetAncestor) { test = GetAncestor(parent, GA_PARENT);
test = pGetAncestor(parent, GA_PARENT); ok(test == GetDesktopWindow(), "wrong parent %p\n", test);
ok(test == GetDesktopWindow(), "wrong parent %p\n", test);
}
test = GetWindow(parent, GW_OWNER); test = GetWindow(parent, GW_OWNER);
ok(!test, "wrong owner %p\n", test); ok(!test, "wrong owner %p\n", test);
...@@ -11197,10 +11182,8 @@ static void test_DestroyWindow(void) ...@@ -11197,10 +11182,8 @@ static void test_DestroyWindow(void)
test = GetParent(child1); test = GetParent(child1);
ok(test == parent, "wrong parent %p\n", test); ok(test == parent, "wrong parent %p\n", test);
ok(IsChild(parent, child1), "wrong parent/child %p/%p\n", parent, child1); ok(IsChild(parent, child1), "wrong parent/child %p/%p\n", parent, child1);
if(pGetAncestor) { test = GetAncestor(child1, GA_PARENT);
test = pGetAncestor(child1, GA_PARENT); ok(test == parent, "wrong parent %p\n", test);
ok(test == parent, "wrong parent %p\n", test);
}
test = GetWindow(child1, GW_OWNER); test = GetWindow(child1, GW_OWNER);
ok(!test, "wrong owner %p\n", test); ok(!test, "wrong owner %p\n", test);
...@@ -11208,10 +11191,8 @@ static void test_DestroyWindow(void) ...@@ -11208,10 +11191,8 @@ static void test_DestroyWindow(void)
test = GetParent(child2); test = GetParent(child2);
ok(test == parent, "wrong parent %p\n", test); ok(test == parent, "wrong parent %p\n", test);
ok(IsChild(parent, child2), "wrong parent/child %p/%p\n", parent, child2); ok(IsChild(parent, child2), "wrong parent/child %p/%p\n", parent, child2);
if(pGetAncestor) { test = GetAncestor(child2, GA_PARENT);
test = pGetAncestor(child2, GA_PARENT); ok(test == parent, "wrong parent %p\n", test);
ok(test == parent, "wrong parent %p\n", test);
}
test = GetWindow(child2, GW_OWNER); test = GetWindow(child2, GW_OWNER);
ok(!test, "wrong owner %p\n", test); ok(!test, "wrong owner %p\n", test);
...@@ -11219,10 +11200,8 @@ static void test_DestroyWindow(void) ...@@ -11219,10 +11200,8 @@ static void test_DestroyWindow(void)
test = GetParent(child3); test = GetParent(child3);
ok(test == child1, "wrong parent %p\n", test); ok(test == child1, "wrong parent %p\n", test);
ok(IsChild(parent, child3), "wrong parent/child %p/%p\n", parent, child3); ok(IsChild(parent, child3), "wrong parent/child %p/%p\n", parent, child3);
if(pGetAncestor) { test = GetAncestor(child3, GA_PARENT);
test = pGetAncestor(child3, GA_PARENT); ok(test == child1, "wrong parent %p\n", test);
ok(test == child1, "wrong parent %p\n", test);
}
test = GetWindow(child3, GW_OWNER); test = GetWindow(child3, GW_OWNER);
ok(!test, "wrong owner %p\n", test); ok(!test, "wrong owner %p\n", test);
...@@ -11230,10 +11209,8 @@ static void test_DestroyWindow(void) ...@@ -11230,10 +11209,8 @@ static void test_DestroyWindow(void)
test = GetParent(child4); test = GetParent(child4);
ok(test == parent, "wrong parent %p\n", test); ok(test == parent, "wrong parent %p\n", test);
ok(!IsChild(parent, child4), "wrong parent/child %p/%p\n", parent, child4); ok(!IsChild(parent, child4), "wrong parent/child %p/%p\n", parent, child4);
if(pGetAncestor) { test = GetAncestor(child4, GA_PARENT);
test = pGetAncestor(child4, GA_PARENT); ok(test == GetDesktopWindow(), "wrong parent %p\n", test);
ok(test == GetDesktopWindow(), "wrong parent %p\n", test);
}
test = GetWindow(child4, GW_OWNER); test = GetWindow(child4, GW_OWNER);
ok(test == parent, "wrong owner %p\n", test); ok(test == parent, "wrong owner %p\n", test);
...@@ -13440,6 +13417,9 @@ static void test_ShowWindow(void) ...@@ -13440,6 +13417,9 @@ static void test_ShowWindow(void)
INT i; INT i;
WINDOWPLACEMENT wp; WINDOWPLACEMENT wp;
RECT win_rc, work_rc = {0, 0, 0, 0}; RECT win_rc, work_rc = {0, 0, 0, 0};
HMONITOR hmon;
MONITORINFO mi;
POINT pt = {0, 0};
#define WS_BASE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_POPUP|WS_CLIPSIBLINGS) #define WS_BASE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_POPUP|WS_CLIPSIBLINGS)
hwnd = CreateWindowExA(0, "ShowWindowClass", NULL, WS_BASE, hwnd = CreateWindowExA(0, "ShowWindowClass", NULL, WS_BASE,
...@@ -13453,24 +13433,17 @@ static void test_ShowWindow(void) ...@@ -13453,24 +13433,17 @@ static void test_ShowWindow(void)
flush_events(); flush_events();
flush_sequence(); flush_sequence();
if (pGetMonitorInfoA && pMonitorFromPoint) SetLastError(0xdeadbeef);
{ hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
HMONITOR hmon; ok(hmon != 0, "MonitorFromPoint error %u\n", GetLastError());
MONITORINFO mi;
POINT pt = {0, 0};
SetLastError(0xdeadbeef);
hmon = pMonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
ok(hmon != 0, "MonitorFromPoint error %u\n", GetLastError());
mi.cbSize = sizeof(mi); mi.cbSize = sizeof(mi);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetMonitorInfoA(hmon, &mi); ret = GetMonitorInfoA(hmon, &mi);
ok(ret, "GetMonitorInfo error %u\n", GetLastError()); ok(ret, "GetMonitorInfo error %u\n", GetLastError());
trace("monitor %s, work %s\n", wine_dbgstr_rect(&mi.rcMonitor), trace("monitor %s, work %s\n", wine_dbgstr_rect(&mi.rcMonitor),
wine_dbgstr_rect(&mi.rcWork)); wine_dbgstr_rect(&mi.rcWork));
work_rc = mi.rcWork; work_rc = mi.rcWork;
}
GetWindowRect(hwnd, &win_rc); GetWindowRect(hwnd, &win_rc);
OffsetRect(&win_rc, -work_rc.left, -work_rc.top); OffsetRect(&win_rc, -work_rc.left, -work_rc.top);
...@@ -15258,7 +15231,7 @@ static void set_menu_style(HMENU hmenu, DWORD style) ...@@ -15258,7 +15231,7 @@ static void set_menu_style(HMENU hmenu, DWORD style)
mi.fMask = MIM_STYLE; mi.fMask = MIM_STYLE;
mi.dwStyle = style; mi.dwStyle = style;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetMenuInfo(hmenu, &mi); ret = SetMenuInfo(hmenu, &mi);
ok(ret, "SetMenuInfo error %u\n", GetLastError()); ok(ret, "SetMenuInfo error %u\n", GetLastError());
} }
...@@ -15271,7 +15244,7 @@ static DWORD get_menu_style(HMENU hmenu) ...@@ -15271,7 +15244,7 @@ static DWORD get_menu_style(HMENU hmenu)
mi.fMask = MIM_STYLE; mi.fMask = MIM_STYLE;
mi.dwStyle = 0; mi.dwStyle = 0;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetMenuInfo(hmenu, &mi); ret = GetMenuInfo(hmenu, &mi);
ok(ret, "GetMenuInfo error %u\n", GetLastError()); ok(ret, "GetMenuInfo error %u\n", GetLastError());
return mi.dwStyle; return mi.dwStyle;
...@@ -15286,11 +15259,6 @@ static void test_menu_messages(void) ...@@ -15286,11 +15259,6 @@ static void test_menu_messages(void)
DWORD style; DWORD style;
BOOL us_kbd = (GetKeyboardLayout(0) == (HKL)(ULONG_PTR)0x04090409); BOOL us_kbd = (GetKeyboardLayout(0) == (HKL)(ULONG_PTR)0x04090409);
if (!pGetMenuInfo || !pSetMenuInfo)
{
win_skip("GetMenuInfo and/or SetMenuInfo are not available\n");
return;
}
cls.style = 0; cls.style = 0;
cls.lpfnWndProc = parent_menu_proc; cls.lpfnWndProc = parent_menu_proc;
cls.cbClsExtra = 0; cls.cbClsExtra = 0;
......
...@@ -50,15 +50,12 @@ ...@@ -50,15 +50,12 @@
void dump_region(HRGN hrgn); void dump_region(HRGN hrgn);
static HWND (WINAPI *pGetAncestor)(HWND,UINT);
static BOOL (WINAPI *pGetWindowInfo)(HWND,WINDOWINFO*); static BOOL (WINAPI *pGetWindowInfo)(HWND,WINDOWINFO*);
static UINT (WINAPI *pGetWindowModuleFileNameA)(HWND,LPSTR,UINT); static UINT (WINAPI *pGetWindowModuleFileNameA)(HWND,LPSTR,UINT);
static BOOL (WINAPI *pGetLayeredWindowAttributes)(HWND,COLORREF*,BYTE*,DWORD*); static BOOL (WINAPI *pGetLayeredWindowAttributes)(HWND,COLORREF*,BYTE*,DWORD*);
static BOOL (WINAPI *pSetLayeredWindowAttributes)(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 *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
static BOOL (WINAPI *pUpdateLayeredWindowIndirect)(HWND,const UPDATELAYEREDWINDOWINFO*); 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); static int (WINAPI *pGetWindowRgnBox)(HWND,LPRECT);
static BOOL (WINAPI *pGetGUIThreadInfo)(DWORD, GUITHREADINFO*); static BOOL (WINAPI *pGetGUIThreadInfo)(DWORD, GUITHREADINFO*);
static BOOL (WINAPI *pGetProcessDefaultLayout)( DWORD *layout ); static BOOL (WINAPI *pGetProcessDefaultLayout)( DWORD *layout );
...@@ -135,24 +132,18 @@ static void check_parents( HWND hwnd, HWND ga_parent, HWND gwl_parent, HWND get_ ...@@ -135,24 +132,18 @@ static void check_parents( HWND hwnd, HWND ga_parent, HWND gwl_parent, HWND get_
{ {
HWND res; HWND res;
if (pGetAncestor) res = GetAncestor( hwnd, GA_PARENT );
{ ok( res == ga_parent, "Wrong result for GA_PARENT %p expected %p\n", res, ga_parent );
res = pGetAncestor( hwnd, GA_PARENT );
ok( res == ga_parent, "Wrong result for GA_PARENT %p expected %p\n", res, ga_parent );
}
res = (HWND)GetWindowLongPtrA( hwnd, GWLP_HWNDPARENT ); res = (HWND)GetWindowLongPtrA( hwnd, GWLP_HWNDPARENT );
ok( res == gwl_parent, "Wrong result for GWL_HWNDPARENT %p expected %p\n", res, gwl_parent ); ok( res == gwl_parent, "Wrong result for GWL_HWNDPARENT %p expected %p\n", res, gwl_parent );
res = GetParent( hwnd ); res = GetParent( hwnd );
ok( res == get_parent, "Wrong result for GetParent %p expected %p\n", res, get_parent ); ok( res == get_parent, "Wrong result for GetParent %p expected %p\n", res, get_parent );
res = GetWindow( hwnd, GW_OWNER ); res = GetWindow( hwnd, GW_OWNER );
ok( res == gw_owner, "Wrong result for GW_OWNER %p expected %p\n", res, gw_owner ); ok( res == gw_owner, "Wrong result for GW_OWNER %p expected %p\n", res, gw_owner );
if (pGetAncestor) res = GetAncestor( hwnd, GA_ROOT );
{ ok( res == ga_root, "Wrong result for GA_ROOT %p expected %p\n", res, ga_root );
res = pGetAncestor( hwnd, GA_ROOT ); res = GetAncestor( hwnd, GA_ROOTOWNER );
ok( res == ga_root, "Wrong result for GA_ROOT %p expected %p\n", res, ga_root ); ok( res == ga_root_owner, "Wrong result for GA_ROOTOWNER %p expected %p\n", res, ga_root_owner );
res = pGetAncestor( hwnd, GA_ROOTOWNER );
ok( res == ga_root_owner, "Wrong result for GA_ROOTOWNER %p expected %p\n", res, ga_root_owner );
}
} }
#define check_wnd_state(a,b,c,d) check_wnd_state_(__FILE__,__LINE__,a,b,c,d) #define check_wnd_state(a,b,c,d) check_wnd_state_(__FILE__,__LINE__,a,b,c,d)
...@@ -1267,19 +1258,16 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam) ...@@ -1267,19 +1258,16 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
if (0) if (0)
{ {
/* Uncomment this once the test succeeds in all cases */ /* Uncomment this once the test succeeds in all cases */
if (pGetAncestor) ok(GetAncestor(hwnd, GA_PARENT) == hwndMessage, "GA_PARENT should be set to hwndMessage at this point\n");
{ ok(GetAncestor(hwnd, GA_ROOT) == hwnd,
ok(pGetAncestor(hwnd, GA_PARENT) == hwndMessage, "GA_PARENT should be set to hwndMessage at this point\n"); "GA_ROOT is set to %p, expected %p\n", GetAncestor(hwnd, GA_ROOT), hwnd);
ok(pGetAncestor(hwnd, GA_ROOT) == hwnd,
"GA_ROOT is set to %p, expected %p\n", pGetAncestor(hwnd, GA_ROOT), hwnd);
if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD) if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
ok(pGetAncestor(hwnd, GA_ROOTOWNER) == hwndMessage, ok(GetAncestor(hwnd, GA_ROOTOWNER) == hwndMessage,
"GA_ROOTOWNER should be set to hwndMessage at this point\n"); "GA_ROOTOWNER should be set to hwndMessage at this point\n");
else else
ok(pGetAncestor(hwnd, GA_ROOTOWNER) == hwnd, ok(GetAncestor(hwnd, GA_ROOTOWNER) == hwnd,
"GA_ROOTOWNER is set to %p, expected %p\n", pGetAncestor(hwnd, GA_ROOTOWNER), hwnd); "GA_ROOTOWNER is set to %p, expected %p\n", GetAncestor(hwnd, GA_ROOTOWNER), hwnd);
}
ok(GetWindowRect(hwnd, &rc), "GetWindowRect failed\n"); ok(GetWindowRect(hwnd, &rc), "GetWindowRect failed\n");
ok(EqualRect(&rc, &rc_null), "window rect should be set to 0 HCBT_CREATEWND\n"); ok(EqualRect(&rc, &rc_null), "window rect should be set to 0 HCBT_CREATEWND\n");
...@@ -5265,17 +5253,9 @@ static void test_params(void) ...@@ -5265,17 +5253,9 @@ static void test_params(void)
ok(!IsWindow(HWND_TOPMOST), "IsWindow(HWND_TOPMOST)\n"); ok(!IsWindow(HWND_TOPMOST), "IsWindow(HWND_TOPMOST)\n");
/* Just a param check */ /* Just a param check */
if (pGetMonitorInfoA) SetLastError(0xdeadbeef);
{ rc = GetWindowTextA(hwndMain2, NULL, 1024);
SetLastError(0xdeadbeef); ok(!rc, "GetWindowText: rc=%d err=%d\n",rc,GetLastError());
rc = GetWindowTextA(hwndMain2, NULL, 1024);
ok( rc==0, "GetWindowText: rc=%d err=%d\n",rc,GetLastError());
}
else
{
/* Skips actually on Win95 and NT4 */
win_skip("Test would crash on Win95\n");
}
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hwnd=CreateWindowA("LISTBOX", "TestList", hwnd=CreateWindowA("LISTBOX", "TestList",
...@@ -8040,31 +8020,28 @@ static void test_hwnd_message(void) ...@@ -8040,31 +8020,28 @@ static void test_hwnd_message(void)
{ GWLP_WNDPROC, 0, ERROR_ACCESS_DENIED }, { GWLP_WNDPROC, 0, ERROR_ACCESS_DENIED },
{ DWLP_MSGRESULT, 0, ERROR_INVALID_INDEX } { DWLP_MSGRESULT, 0, ERROR_INVALID_INDEX }
}; };
HWND root, desktop = GetDesktopWindow();
DWORD_PTR result; DWORD_PTR result;
char buffer[100];
int i; int i;
hwnd = CreateWindowExW(0, mainwindowclassW, message_windowW, WS_CAPTION | WS_VISIBLE, hwnd = CreateWindowExW(0, mainwindowclassW, message_windowW, WS_CAPTION | WS_VISIBLE,
100, 100, 200, 200, HWND_MESSAGE, 0, 0, NULL); 100, 100, 200, 200, HWND_MESSAGE, 0, 0, NULL);
ok( hwnd != 0, "CreateWindowExW with parent HWND_MESSAGE failed\n" ); ok( hwnd != 0, "CreateWindowExW with parent HWND_MESSAGE failed\n" );
ok( !GetParent(hwnd), "GetParent should return 0 for message only windows\n" ); ok( !GetParent(hwnd), "GetParent should return 0 for message only windows\n" );
if (pGetAncestor)
{ parent = GetAncestor(hwnd, GA_PARENT);
char buffer[100]; ok(parent != 0, "GetAncestor(GA_PARENT) should not return 0 for message windows\n");
HWND root, desktop = GetDesktopWindow(); ok(parent != desktop, "GetAncestor(GA_PARENT) should not return desktop for message windows\n");
root = GetAncestor(hwnd, GA_ROOT);
parent = pGetAncestor(hwnd, GA_PARENT); ok(root == hwnd, "GetAncestor(GA_ROOT) should return hwnd for message windows\n");
ok(parent != 0, "GetAncestor(GA_PARENT) should not return 0 for message windows\n"); ok( !GetAncestor(parent, GA_PARENT),
ok(parent != desktop, "GetAncestor(GA_PARENT) should not return desktop for message windows\n"); "parent shouldn't have parent %p\n", GetAncestor(parent, GA_PARENT) );
root = pGetAncestor(hwnd, GA_ROOT); if (!GetClassNameA( parent, buffer, sizeof(buffer) )) buffer[0] = 0;
ok(root == hwnd, "GetAncestor(GA_ROOT) should return hwnd for message windows\n"); ok( !lstrcmpiA( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
ok( !pGetAncestor(parent, GA_PARENT), GetWindowRect( parent, &rect );
"parent shouldn't have parent %p\n", pGetAncestor(parent, GA_PARENT) ); ok( rect.left == 0 && rect.right == 100 && rect.top == 0 && rect.bottom == 100,
if (!GetClassNameA( parent, buffer, sizeof(buffer) )) buffer[0] = 0; "wrong parent rect %s\n", wine_dbgstr_rect( &rect ));
ok( !lstrcmpiA( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
GetWindowRect( parent, &rect );
ok( rect.left == 0 && rect.right == 100 && rect.top == 0 && rect.bottom == 100,
"wrong parent rect %s\n", wine_dbgstr_rect( &rect ));
}
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
ok( rect.left == 100 && rect.right == 300 && rect.top == 100 && rect.bottom == 300, ok( rect.left == 100 && rect.right == 300 && rect.top == 100 && rect.bottom == 300,
"wrong window rect %s\n", wine_dbgstr_rect( &rect )); "wrong window rect %s\n", wine_dbgstr_rect( &rect ));
...@@ -8344,20 +8321,14 @@ static void test_fullscreen(void) ...@@ -8344,20 +8321,14 @@ static void test_fullscreen(void)
HMONITOR hmon; HMONITOR hmon;
LRESULT ret; LRESULT ret;
if (!pGetMonitorInfoA || !pMonitorFromPoint)
{
win_skip("GetMonitorInfoA or MonitorFromPoint are not available on this platform\n");
return;
}
pt.x = pt.y = 0; pt.x = pt.y = 0;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hmon = pMonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
ok(hmon != 0, "MonitorFromPoint error %u\n", GetLastError()); ok(hmon != 0, "MonitorFromPoint error %u\n", GetLastError());
mi.cbSize = sizeof(mi); mi.cbSize = sizeof(mi);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetMonitorInfoA(hmon, &mi); ret = GetMonitorInfoA(hmon, &mi);
ok(ret, "GetMonitorInfo error %u\n", GetLastError()); ok(ret, "GetMonitorInfo error %u\n", GetLastError());
trace("monitor %s, work %s\n", wine_dbgstr_rect(&mi.rcMonitor), wine_dbgstr_rect(&mi.rcWork)); trace("monitor %s, work %s\n", wine_dbgstr_rect(&mi.rcMonitor), wine_dbgstr_rect(&mi.rcWork));
...@@ -11873,15 +11844,12 @@ START_TEST(win) ...@@ -11873,15 +11844,12 @@ START_TEST(win)
int argc = winetest_get_mainargs( &argv ); int argc = winetest_get_mainargs( &argv );
HMODULE user32 = GetModuleHandleA( "user32.dll" ); HMODULE user32 = GetModuleHandleA( "user32.dll" );
HMODULE gdi32 = GetModuleHandleA("gdi32.dll"); HMODULE gdi32 = GetModuleHandleA("gdi32.dll");
pGetAncestor = (void *)GetProcAddress( user32, "GetAncestor" );
pGetWindowInfo = (void *)GetProcAddress( user32, "GetWindowInfo" ); pGetWindowInfo = (void *)GetProcAddress( user32, "GetWindowInfo" );
pGetWindowModuleFileNameA = (void *)GetProcAddress( user32, "GetWindowModuleFileNameA" ); pGetWindowModuleFileNameA = (void *)GetProcAddress( user32, "GetWindowModuleFileNameA" );
pGetLayeredWindowAttributes = (void *)GetProcAddress( user32, "GetLayeredWindowAttributes" ); pGetLayeredWindowAttributes = (void *)GetProcAddress( user32, "GetLayeredWindowAttributes" );
pSetLayeredWindowAttributes = (void *)GetProcAddress( user32, "SetLayeredWindowAttributes" ); pSetLayeredWindowAttributes = (void *)GetProcAddress( user32, "SetLayeredWindowAttributes" );
pUpdateLayeredWindow = (void *)GetProcAddress( user32, "UpdateLayeredWindow" ); pUpdateLayeredWindow = (void *)GetProcAddress( user32, "UpdateLayeredWindow" );
pUpdateLayeredWindowIndirect = (void *)GetProcAddress( user32, "UpdateLayeredWindowIndirect" ); pUpdateLayeredWindowIndirect = (void *)GetProcAddress( user32, "UpdateLayeredWindowIndirect" );
pGetMonitorInfoA = (void *)GetProcAddress( user32, "GetMonitorInfoA" );
pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" ); pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
pGetGUIThreadInfo = (void *)GetProcAddress( user32, "GetGUIThreadInfo" ); pGetGUIThreadInfo = (void *)GetProcAddress( user32, "GetGUIThreadInfo" );
pGetProcessDefaultLayout = (void *)GetProcAddress( user32, "GetProcessDefaultLayout" ); pGetProcessDefaultLayout = (void *)GetProcAddress( user32, "GetProcessDefaultLayout" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment