user32: Add test to check the MDI child switching
Dmitry Timoshkov
dmitry at codeweavers.com
Tue Oct 14 02:40:45 CDT 2008
"Ilya Shpigor" <shpigor at etersoft.ru> wrote:
> --- a/dlls/user32/tests/win.c
> +++ b/dlls/user32/tests/win.c
> @@ -1674,9 +1674,78 @@ static BOOL mdi_RegisterWindowClasses(void)
> cls.lpszClassName = "MDI_child_Class_2";
> if(!RegisterClassA(&cls)) return FALSE;
>
> + cls.lpfnWndProc = DefWindowProcW;
> + cls.lpszClassName = "MDI_parent_Class_def";
> + if(!RegisterClassA(&cls)) return FALSE;
> +
> + cls.lpfnWndProc = DefMDIChildProcW;
> + cls.lpszClassName = "MDI_child_Class_def";
> + if(!RegisterClassA(&cls)) return FALSE;
The above A/W mishmash can't work.
> +HWND CreateNewMDIChild(HWND hMDIClient)
> +{
> + HWND hChild;
> +
> + hChild=CreateMDIWindow("MDI_child_Class_def", "MDI child", WS_CHILD | WS_VISIBLE,
> + CW_USEDEFAULT,
> + CW_USEDEFAULT,
> + CW_USEDEFAULT,
> + CW_USEDEFAULT,
> + hMDIClient,
> + GetModuleHandle(NULL), 0);
> +
> + if(!hChild)
> + {
> + ok(0,"MDI child creation failed\n");
> + }
It's better to not use ok(0) statements, and do the actual check inside
of ok(), in this case ok(hChild != 0).
> + active = (HWND)SendMessageW(mdi_client, WM_MDIGETACTIVE, 0, 0);
> + SendMessageW(mdi_client, WM_MDINEXT, 0, 0);
> + SendMessageW(mdi_client, WM_MDINEXT, 0, 0);
> + ok(active != (HWND)SendMessageW(mdi_client, WM_MDIGETACTIVE, 0, 0), "MDI child switching error\n");
Wouldn't it be much easier to just add 4 lines above into existing tests?
--
Dmitry.
More information about the wine-devel
mailing list