user32/tests: Add a test for custom dialog control data.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-10-01 14:47:37 +08:00 committed by Alexandre Julliard
parent b79fd400c0
commit 606b027277
2 changed files with 47 additions and 0 deletions

View File

@ -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();

View File

@ -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