From 87d194dd1de7ab1473a805a8d4c5602a8d2d2f53 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 28 Nov 2018 09:03:11 +0300 Subject: [PATCH] user32/tests: Add a focus test for an empty dialog that returns TRUE in WM_INITDIALOG. Signed-off-by: Dmitry Timoshkov Signed-off-by: Alexandre Julliard --- dlls/user32/tests/msg.c | 42 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index f78858f4d49..2fdb118e840 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -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();