From 6944d128ef7f1904b907fd47a03d3636814386ae Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 7 Jul 2016 17:22:10 +0000 Subject: [PATCH] [USER32_WINETEST] Sync with Wine Staging 1.9.11 Part 3. CORE-11368 svn path=/trunk/; revision=71849 --- rostests/winetests/user32/dialog.c | 47 +++++++++++++++++++++++++-- rostests/winetests/user32/resource.rc | 15 +++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/rostests/winetests/user32/dialog.c b/rostests/winetests/user32/dialog.c index cada3193395..b837c8c7e96 100755 --- a/rostests/winetests/user32/dialog.c +++ b/rostests/winetests/user32/dialog.c @@ -539,6 +539,26 @@ static LRESULT CALLBACK testDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam, return DefDlgProcA (hwnd, uiMsg, wParam, lParam); } +static LRESULT CALLBACK test_control_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch(msg) + { + case WM_CREATE: + { + static const short sample[] = { 10,1,2,3,4,5 }; + CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam; + short *data = cs->lpCreateParams; + ok(!memcmp(data, sample, sizeof(sample)), "data mismatch: %d,%d,%d,%d,%d\n", data[0], data[1], data[2], data[3], data[4]); + } + return 0; + + default: + break; + } + + return DefWindowProcA(hwnd, msg, wparam, lparam); +} + static BOOL RegisterWindowClasses (void) { WNDCLASSA cls; @@ -558,7 +578,10 @@ static BOOL RegisterWindowClasses (void) cls.lpfnWndProc = main_window_procA; cls.lpszClassName = "IsDialogMessageWindowClass"; + if (!RegisterClassA (&cls)) return FALSE; + cls.lpfnWndProc = test_control_procA; + cls.lpszClassName = "TESTCONTROL"; if (!RegisterClassA (&cls)) return FALSE; GetClassInfoA(0, "#32770", &cls); @@ -1221,6 +1244,11 @@ static void test_DialogBoxParamA(void) broken(GetLastError() == 0xdeadbeef), "got %d, expected ERROR_RESOURCE_NAME_NOT_FOUND\n",GetLastError()); + SetLastError(0xdeadbeef); + ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DIALOG_INVALID_CLASS", 0, DestroyDlgWinProc, 0); + ok(ret == -1, "DialogBoxParamA returned %ld, expected -1\n", ret); + ok(GetLastError() == 0, "got %d\n", GetLastError()); + SetLastError(0xdeadbeef); ret = DefDlgProcA(0, WM_ERASEBKGND, 0, 0); ok(ret == 0, "DefDlgProcA returned %ld, expected 0\n", ret); @@ -1472,6 +1500,19 @@ static void test_timer_message(void) DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc); } +static INT_PTR CALLBACK custom_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_INITDIALOG) + EndDialog(hdlg, 0); + + return FALSE; +} + +static void test_dialog_custom_data(void) +{ + DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc); +} + struct create_window_params { BOOL owner; @@ -1516,6 +1557,7 @@ static HWND wait_for_window(const char *caption) } } + Sleep(50); return hwnd; } @@ -1551,7 +1593,7 @@ static void test_MessageBox(void) hwnd = wait_for_window(params.caption); ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE); - ok((ex_style & test[i].ex_style) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style); + ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style); PostMessageA(hwnd, WM_COMMAND, IDCANCEL, 0); @@ -1572,7 +1614,7 @@ static void test_MessageBox(void) hwnd = wait_for_window(params.caption); ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE); - ok((ex_style & test[i].ex_style) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style); + ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style); PostMessageA(hwnd, WM_COMMAND, IDCANCEL, 0); @@ -1588,6 +1630,7 @@ START_TEST(dialog) if (!RegisterWindowClasses()) assert(0); test_MessageBox(); + test_dialog_custom_data(); test_GetNextDlgItem(); test_IsDialogMessage(); test_WM_NEXTDLGCTL(); diff --git a/rostests/winetests/user32/resource.rc b/rostests/winetests/user32/resource.rc index f116b85825f..a9e45e90ce1 100755 --- a/rostests/winetests/user32/resource.rc +++ b/rostests/winetests/user32/resource.rc @@ -124,6 +124,12 @@ FONT 8, "MS Shell Dlg" EDITTEXT 200,4,4,50,14 } +TEST_DIALOG_INVALID_CLASS DIALOG 0, 0, 60, 30 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +{ + CONTROL "",1,"wine invalid class",WS_CHILD,0,0,40,10 +} + IDD_DIALOG DIALOG 0, 0, 186, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" @@ -200,6 +206,15 @@ FONT 8, "MS Shell Dlg" EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_READONLY } +CUSTOM_TEST_DIALOG DIALOGEX 6, 15, 207, 111 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Custom Test Dialog" +FONT 8, "MS Sans Serif" +{ + CONTROL "evenlengthtext", -1, "TESTCONTROL", WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP, 10,10,100,50 { 1,2,3,4,5 } + CONTROL "oddlengthtext", -1, "TESTCONTROL", WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP, 10,60,100,50 { 1,2,3,4,5 } +} + /* @makedep: test_mono.bmp */ 100 BITMAP test_mono.bmp