Commit b4c78be5 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

shell32: Add tests for SHAppBarMessage.

parent ced5cb67
......@@ -6,6 +6,7 @@ TESTDLL = shell32.dll
IMPORTS = shell32 ole32 oleaut32 user32 advapi32 kernel32
CTESTS = \
appbar.c \
generated.c \
shelllink.c \
shellpath.c \
......
......@@ -27,7 +27,6 @@
static HWND hMainWnd;
static BOOL (WINAPI *pShell_NotifyIconW)(DWORD,PNOTIFYICONDATAW);
static HMONITOR (WINAPI *pMonitorFromWindow)(HWND, DWORD);
void test_cbsize(void)
{
......@@ -76,74 +75,16 @@ void test_cbsize(void)
ok(!Shell_NotifyIconA(NIM_DELETE, &nidA), "The icon was not deleted\n");
}
static void test_SHAppBarMessage(void)
{
APPBARDATA abd;
HWND hwnd, foregnd;
UINT_PTR ret;
memset(&abd, 0xcc, sizeof(abd));
abd.cbSize = sizeof(abd);
abd.uEdge = ABE_BOTTOM;
hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd);
ok(abd.hWnd == (HWND)0xcccccccc, "hWnd overwritten\n");
if (!pMonitorFromWindow)
{
skip("MonitorFromWindow is not available\n");
}
else
{
/* Presumably one can pass a hwnd with ABM_GETAUTOHIDEBAR to specify a monitor.
Pass the foreground window and check */
foregnd = GetForegroundWindow();
if(foregnd)
{
abd.hWnd = foregnd;
hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd);
ok(abd.hWnd == foregnd, "hWnd overwritten\n");
if(hwnd)
{
HMONITOR appbar_mon, foregnd_mon;
appbar_mon = pMonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
foregnd_mon = pMonitorFromWindow(foregnd, MONITOR_DEFAULTTONEAREST);
ok(appbar_mon == foregnd_mon, "Windows on different monitors\n");
}
}
}
memset(&abd, 0xcc, sizeof(abd));
abd.cbSize = sizeof(abd);
ret = SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
if(ret)
{
ok(abd.hWnd == (HWND)0xcccccccc, "hWnd overwritten\n");
todo_wine
{
ok(abd.uEdge <= ABE_BOTTOM, "uEdge not returned\n");
ok(abd.rc.left != 0xcccccccc, "rc not updated\n");
}
}
return;
}
START_TEST(systray)
{
WNDCLASSA wc;
MSG msg;
RECT rc;
HMODULE huser32, hshell32;
HMODULE hshell32;
hshell32 = GetModuleHandleA("shell32.dll");
pShell_NotifyIconW = (void*)GetProcAddress(hshell32, "Shell_NotifyIconW");
huser32 = GetModuleHandleA("user32.dll");
pMonitorFromWindow = (void*)GetProcAddress(huser32, "MonitorFromWindow");
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
......@@ -169,6 +110,4 @@ START_TEST(systray)
DispatchMessageA(&msg);
}
DestroyWindow(hMainWnd);
test_SHAppBarMessage();
}
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