user32/tests: Add some more tests for HWND_MESSAGE windows.

This commit is contained in:
Alexandre Julliard 2008-06-25 15:24:02 +02:00
parent 782403085f
commit 9b9dbb20f2
1 changed files with 41 additions and 17 deletions

View File

@ -4707,27 +4707,51 @@ static void test_GetWindowModuleFileName(void)
ok(!ret1, "expected 0, got %u\n", ret1);
}
static void test_hwnd_message(void)
{
HWND parent = 0, hwnd;
RECT rect;
hwnd = CreateWindowExA(0, "MainWindowClass", "message window", WS_CAPTION | WS_VISIBLE,
100, 100, 200, 200, HWND_MESSAGE, 0, 0, NULL);
if (!hwnd)
{
win_skip("CreateWindowExA with parent HWND_MESSAGE failed\n");
return;
}
ok( !GetParent(hwnd), "GetParent should return 0 for message only windows\n" );
if (pGetAncestor)
{
char buffer[100];
HWND root, desktop = GetDesktopWindow();
parent = pGetAncestor(hwnd, GA_PARENT);
ok(parent != 0, "GetAncestor(GA_PARENT) should not return 0 for message windows\n");
ok(parent != desktop, "GetAncestor(GA_PARENT) should not return desktop for message windows\n");
root = pGetAncestor(hwnd, GA_ROOT);
ok(root == hwnd, "GetAncestor(GA_ROOT) should return hwnd for message windows\n");
ok( !pGetAncestor(parent, GA_PARENT), "parent shouldn't have a parent\n" );
trace("parent %p root %p desktop %p\n", parent, root, desktop);
if (!GetClassNameA( parent, buffer, sizeof(buffer) )) buffer[0] = 0;
ok( !lstrcmpi( 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 %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
}
GetWindowRect( hwnd, &rect );
ok( rect.left == 100 && rect.right == 300 && rect.top == 100 && rect.bottom == 300,
"wrong window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
DestroyWindow(hwnd);
}
START_TEST(win)
{
pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
pGetWindowInfo = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetWindowInfo" );
pGetWindowModuleFileNameA = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetWindowModuleFileNameA" );
hwndMain = CreateWindowExA(0, "static", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, NULL);
if (hwndMain)
{
ok(!GetParent(hwndMain), "GetParent should return 0 for message only windows\n");
if (pGetAncestor)
{
hwndMessage = pGetAncestor(hwndMain, GA_PARENT);
ok(hwndMessage != 0, "GetAncestor(GA_PARENT) should not return 0 for message only windows\n");
trace("hwndMessage %p\n", hwndMessage);
}
DestroyWindow(hwndMain);
}
else
trace("CreateWindowExA with parent HWND_MESSAGE failed\n");
if (!RegisterWindowClasses()) assert(0);
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
@ -4738,8 +4762,6 @@ START_TEST(win)
WS_MAXIMIZEBOX | WS_POPUP,
100, 100, 200, 200,
0, 0, GetModuleHandle(0), NULL);
test_nonclient_area(hwndMain);
hwndMain2 = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window 2",
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_POPUP,
@ -4751,6 +4773,8 @@ START_TEST(win)
our_pid = GetWindowThreadProcessId(hwndMain, NULL);
/* Add the tests below this line */
test_hwnd_message();
test_nonclient_area(hwndMain);
test_params();
test_GetWindowModuleFileName();
test_capture_1();