riched20: Move test class creation to a helper function.

This commit is contained in:
Evan Tang 2022-11-07 11:07:45 -06:00 committed by Alexandre Julliard
parent 21219fa315
commit f9083961ed

View file

@ -110,6 +110,22 @@ static HWND new_richeditW(HWND parent) {
return new_windowW(RICHEDIT_CLASS20W, ES_MULTILINE, parent);
}
static WNDCLASSA make_simple_class(WNDPROC wndproc, LPCSTR lpClassName)
{
WNDCLASSA cls;
cls.style = 0;
cls.lpfnWndProc = wndproc;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = lpClassName;
return cls;
}
/* Keeps the window reponsive for the deley_time in seconds.
* This is useful for debugging a test to see what is happening. */
static void keep_responsive(time_t delay_time)
@ -4070,16 +4086,7 @@ static void test_EM_SETTEXTEX(void)
* For some reason the scroll position is 0 after EM_SETTEXTEX
* with the ST_SELECTION flag only when the control has a parent
* window, even though the selection is at the end. */
cls.style = 0;
cls.lpfnWndProc = DefWindowProcA;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "ParentTestClass";
cls = make_simple_class(DefWindowProcA, "ParentTestClass");
if(!RegisterClassA(&cls)) assert(0);
parent = CreateWindowA(cls.lpszClassName, NULL, WS_POPUP|WS_VISIBLE,
@ -6599,16 +6606,7 @@ static void test_eventMask(void)
int eventMask;
/* register class to capture WM_COMMAND */
cls.style = 0;
cls.lpfnWndProc = ParentMsgCheckProcA;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "EventMaskParentClass";
cls = make_simple_class(ParentMsgCheckProcA, "EventMaskParentClass");
if(!RegisterClassA(&cls)) assert(0);
parent = CreateWindowA(cls.lpszClassName, NULL, WS_POPUP|WS_VISIBLE,
@ -6692,16 +6690,7 @@ static void test_WM_NOTIFY(void)
int sel_start, sel_end;
/* register class to capture WM_NOTIFY */
cls.style = 0;
cls.lpfnWndProc = WM_NOTIFY_ParentMsgCheckProcA;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "WM_NOTIFY_ParentClass";
cls = make_simple_class(WM_NOTIFY_ParentMsgCheckProcA, "WM_NOTIFY_ParentClass");
if(!RegisterClassA(&cls)) assert(0);
parent = CreateWindowA(cls.lpszClassName, NULL, WS_POPUP|WS_VISIBLE,
@ -6927,16 +6916,7 @@ static void test_EN_LINK(void)
};
/* register class to capture WM_NOTIFY */
cls.style = 0;
cls.lpfnWndProc = EN_LINK_ParentMsgCheckProcA;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "EN_LINK_ParentClass";
cls = make_simple_class(EN_LINK_ParentMsgCheckProcA, "EN_LINK_ParentClass");
if(!RegisterClassA(&cls)) assert(0);
parent = CreateWindowA(cls.lpszClassName, NULL, WS_POPUP|WS_VISIBLE,
@ -7973,16 +7953,7 @@ static void test_dialogmode(void)
int lcount, r;
WNDCLASSA cls;
cls.style = 0;
cls.lpfnWndProc = dialog_mode_wnd_proc;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "DialogModeParentClass";
cls = make_simple_class(dialog_mode_wnd_proc, "DialogModeParentClass");
if(!RegisterClassA(&cls)) assert(0);
hwParent = CreateWindowA("DialogModeParentClass", NULL, WS_OVERLAPPEDWINDOW,