user32: FindWindow() should treat an empty title same way as NULL.
This commit is contained in:
parent
b08d3d2656
commit
2f0b9dd3bf
|
@ -6239,15 +6239,31 @@ static void test_rtl_layout(void)
|
||||||
|
|
||||||
static void test_FindWindowEx(void)
|
static void test_FindWindowEx(void)
|
||||||
{
|
{
|
||||||
HWND found;
|
HWND hwnd, found;
|
||||||
CHAR title[1];
|
CHAR title[1];
|
||||||
|
|
||||||
|
hwnd = CreateWindowExA( 0, "MainWindowClass", "caption", WS_POPUP, 0,0,0,0, 0, 0, 0, NULL );
|
||||||
|
ok( hwnd != 0, "CreateWindowExA error %d\n", GetLastError() );
|
||||||
|
|
||||||
title[0] = 0;
|
title[0] = 0;
|
||||||
|
|
||||||
found = FindWindowExA( 0, 0, "MainWindowClass", title );
|
found = FindWindowExA( 0, 0, "MainWindowClass", title );
|
||||||
ok( found == NULL, "expected a NULL hwnd\n" );
|
ok( found == NULL, "expected a NULL hwnd\n" );
|
||||||
found = FindWindowExA( 0, 0, "MainWindowClass", NULL );
|
found = FindWindowExA( 0, 0, "MainWindowClass", NULL );
|
||||||
ok( found != NULL, "found is NULL, expected a valid hwnd\n" );
|
ok( found == hwnd, "found is %p, expected a valid hwnd\n", found );
|
||||||
|
|
||||||
|
DestroyWindow( hwnd );
|
||||||
|
|
||||||
|
hwnd = CreateWindowExA( 0, "MainWindowClass", NULL, WS_POPUP, 0,0,0,0, 0, 0, 0, NULL );
|
||||||
|
ok( hwnd != 0, "CreateWindowExA error %d\n", GetLastError() );
|
||||||
|
|
||||||
|
found = FindWindowExA( 0, 0, "MainWindowClass", title );
|
||||||
|
ok( found == hwnd, "found is %p, expected a valid hwnd\n", found );
|
||||||
|
found = FindWindowExA( 0, 0, "MainWindowClass", NULL );
|
||||||
|
ok( found == hwnd, "found is %p, expected a valid hwnd\n", found );
|
||||||
|
|
||||||
|
DestroyWindow( hwnd );
|
||||||
|
|
||||||
/* test behaviour with a window title that is an empty character */
|
/* test behaviour with a window title that is an empty character */
|
||||||
found = FindWindowExA( 0, 0, "Shell_TrayWnd", title );
|
found = FindWindowExA( 0, 0, "Shell_TrayWnd", title );
|
||||||
todo_wine
|
todo_wine
|
||||||
|
@ -6307,6 +6323,9 @@ START_TEST(win)
|
||||||
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
|
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
|
||||||
if (!hhook) win_skip( "Cannot set CBT hook, skipping some tests\n" );
|
if (!hhook) win_skip( "Cannot set CBT hook, skipping some tests\n" );
|
||||||
|
|
||||||
|
/* make sure that FindWindow tests are executed first */
|
||||||
|
test_FindWindowEx();
|
||||||
|
|
||||||
hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window",
|
hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window",
|
||||||
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
|
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
|
||||||
WS_MAXIMIZEBOX | WS_POPUP,
|
WS_MAXIMIZEBOX | WS_POPUP,
|
||||||
|
@ -6374,7 +6393,6 @@ START_TEST(win)
|
||||||
test_Expose();
|
test_Expose();
|
||||||
test_layered_window();
|
test_layered_window();
|
||||||
|
|
||||||
test_FindWindowEx();
|
|
||||||
test_SetForegroundWindow(hwndMain);
|
test_SetForegroundWindow(hwndMain);
|
||||||
test_shell_window();
|
test_shell_window();
|
||||||
test_handles( hwndMain );
|
test_handles( hwndMain );
|
||||||
|
|
|
@ -1767,7 +1767,14 @@ HWND WINAPI FindWindowExW( HWND parent, HWND child, LPCWSTR className, LPCWSTR t
|
||||||
{
|
{
|
||||||
while (list[i])
|
while (list[i])
|
||||||
{
|
{
|
||||||
if (GetWindowTextW( list[i], buffer, len + 1 ) && !strcmpiW( buffer, title )) break;
|
if (GetWindowTextW( list[i], buffer, len + 1 ))
|
||||||
|
{
|
||||||
|
if (!strcmpiW( buffer, title )) break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!title[0]) break;
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue