[v2 PATCH 1/3] user32/button: Do not restore font after button has been painted

Dmitry Timoshkov dmitry at baikal.ru
Mon Feb 6 04:05:43 CST 2017


Nikolay Sivov <nsivov at codeweavers.com> wrote:

> +        /* Test that original font is not selected back after painting */
> +        hdc = CreateCompatibleDC(0);
> +
> +        prevfont = SelectObject(hdc, hfont2);
> +        SendMessageA(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, 0);
> +        ok(zfont == GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PRINTCLIENT %p, "
> +            "expected %p\n", i, GetCurrentObject(hdc, OBJ_FONT), zfont);

The test works by a pure luck. It should check current dc font against prevfont
instead of zfont. Changing zfont to DEFAULT_GUI_FONT makes the test fail because
of that mistake.

> +        prevfont = SelectObject(hdc, hfont2);
> +        SendMessageA(hwnd, WM_PAINT, (WPARAM)hdc, 0);
> +        ok(zfont == GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PAINT %p, "
> +            "expected %p\n", i, GetCurrentObject(hdc, OBJ_FONT), zfont);

Same here.

-- 
Dmitry.



More information about the wine-devel mailing list