[TRY2]user32/tests: add tests for creating subclassed builtinclass windows

Dmitry Timoshkov dmitry at codeweavers.com
Thu Aug 7 00:01:50 CDT 2008


"Hongbo Ni" <hongbo at njstar.com> wrote:

> +static void test_builtin_class_subclassed(char *classA, WCHAR *classW);

It is possible to avoid forward declarations by a proper function rearranging.
Also please add 'const' to classA/W.

> +
> +static void test_all_builtin_classes_subclassed(void)
> +{
> +    int i, n, len;
> +    WCHAR classW[80];

10 should be enough.

> +    CHAR *BUILTIN_CLASSES[MAX_BUILTIN_CLASSES] = {

'static const CHAR BUILTIN_CLASSES[][10]' as in the existing test would be
better IMO.

> +        "Edit",
> +        "Button",
> +        "Static",
> +        "ComboBox",
> +        "ComboLBox",
> +        "ListBox",
> +        "#32770",  /* dialog */
> +    };

You forgot "ScrollBar" and some other builtin classes.

> +
> +    for(i = 0; i < MAX_BUILTIN_CLASSES; i++)
> +    {
> +        len = strlen(BUILTIN_CLASSES[i]);
> +        for(n = 0; n < len; n++) classW[n] = BUILTIN_CLASSES[i][n];
> +        classW[n] = 0;

MultiByteToWideChar would be more appropriate here.

> +        test_builtin_class_subclassed(BUILTIN_CLASSES[i], classW);
> +    }
> +}
> +
> +static void test_builtin_class_subclassed(char *classA, WCHAR *classW)
> +{
> +    HWND hwnd, hwnd2;
> +    WNDPROC oldproc;
> +    
> +    hwnd = CreateWindowExA(0, classA, NULL, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 
> +                         CW_USEDEFAULT, 680, 260, NULL, NULL, NULL, 0);

It would be helpful to actually test whether window has been created, and what
type it has (ansi/unicode). Same is true for all similar cases.

Otherwise the test looks good, and it passes for me under XP SP3.

-- 
Dmitry.



More information about the wine-devel mailing list