user32/tests: Add a focus test for an empty dialog that returns TRUE in WM_INITDIALOG.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-11-28 09:03:11 +03:00 committed by Alexandre Julliard
parent 0c0aa90a90
commit 87d194dd1d
1 changed files with 41 additions and 1 deletions

View File

@ -13440,6 +13440,8 @@ static INT_PTR WINAPI test_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPAR
switch (message)
{
case WM_INITDIALOG:
return lParam;
case WM_GETDLGCODE:
return 0;
}
@ -13548,6 +13550,20 @@ static const struct message WmDefDlgSetFocus_2[] = {
{ 0 }
};
/* Creation of a dialog */
static const struct message WmCreateDialogParamSeq_0[] = {
{ HCBT_CREATEWND, hook },
{ WM_NCCREATE, sent },
{ WM_NCCALCSIZE, sent|wparam, 0 },
{ WM_CREATE, sent },
{ EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
{ WM_SIZE, sent|wparam, SIZE_RESTORED },
{ WM_MOVE, sent },
{ WM_SETFONT, sent },
{ WM_INITDIALOG, sent },
{ WM_CHANGEUISTATE, sent|optional },
{ 0 }
};
/* Creation of a dialog */
static const struct message WmCreateDialogParamSeq_1[] = {
{ HCBT_CREATEWND, hook },
{ WM_NCCREATE, sent },
@ -13558,6 +13574,14 @@ static const struct message WmCreateDialogParamSeq_1[] = {
{ WM_MOVE, sent },
{ WM_SETFONT, sent },
{ WM_INITDIALOG, sent },
{ WM_GETDLGCODE, sent|wparam|lparam, 0, 0 },
{ HCBT_SETFOCUS, hook },
{ HCBT_ACTIVATE, hook },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent },
{ WM_ACTIVATE, sent|wparam, 1 },
{ WM_SETFOCUS, sent },
{ WM_CHANGEUISTATE, sent|optional },
{ 0 }
};
@ -13721,9 +13745,25 @@ static void test_dialog_messages(void)
cls.lpfnWndProc = test_dlg_proc;
if (!RegisterClassA(&cls)) assert(0);
SetFocus(0);
flush_sequence();
hdlg = CreateDialogParamA(0, "CLASS_TEST_DIALOG_2", 0, test_dlg_proc, 0);
ok(IsWindow(hdlg), "CreateDialogParam failed\n");
ok_sequence(WmCreateDialogParamSeq_1, "CreateDialogParam_1", FALSE);
ok_sequence(WmCreateDialogParamSeq_0, "CreateDialogParam_0", FALSE);
hfocus = GetFocus();
ok(hfocus == 0, "wrong focus %p\n", hfocus);
EndDialog(hdlg, 0);
DestroyWindow(hdlg);
flush_sequence();
SetFocus(0);
flush_sequence();
hdlg = CreateDialogParamA(0, "CLASS_TEST_DIALOG_2", 0, test_dlg_proc, 1);
ok(IsWindow(hdlg), "CreateDialogParam failed\n");
ok_sequence(WmCreateDialogParamSeq_1, "CreateDialogParam_1", TRUE);
hfocus = GetFocus();
todo_wine
ok(hfocus == hdlg, "wrong focus %p\n", hfocus);
EndDialog(hdlg, 0);
DestroyWindow(hdlg);
flush_sequence();