From 606b0272776ec2a4e6146aa29a993fc88e98214b Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 1 Oct 2018 14:47:37 +0800 Subject: [PATCH] user32/tests: Add a test for custom dialog control data. Signed-off-by: Dmitry Timoshkov Signed-off-by: Alexandre Julliard --- dlls/user32/tests/dialog.c | 38 +++++++++++++++++++++++++++++++++++ dlls/user32/tests/resource.rc | 9 +++++++++ 2 files changed, 47 insertions(+) diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c index 0604423acf8..b75759ba0ab 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -544,6 +544,27 @@ 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; +todo_wine + 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; @@ -563,7 +584,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); @@ -2048,12 +2072,26 @@ static void test_MessageBox(void) UnhookWindowsHookEx(hook); } +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); +} + START_TEST(dialog) { g_hinst = GetModuleHandleA (0); if (!RegisterWindowClasses()) assert(0); + test_dialog_custom_data(); test_GetNextDlgItem(); test_IsDialogMessage(); test_WM_NEXTDLGCTL(); diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc index 756e38f0f73..a9e45e90ce1 100644 --- a/dlls/user32/tests/resource.rc +++ b/dlls/user32/tests/resource.rc @@ -206,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