user32/tests: Test to show that original font is not selected back after painting buttons.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7a2b07e2a6
commit
a423f14a56
@ -5800,10 +5800,11 @@ static void test_button_messages(void)
|
|||||||
WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq,
|
WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq,
|
||||||
WmSetTextButtonSeq },
|
WmSetTextButtonSeq },
|
||||||
};
|
};
|
||||||
|
LOGFONTA logfont = { 0 };
|
||||||
|
HFONT zfont, hfont2;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
HWND hwnd, parent;
|
HWND hwnd, parent;
|
||||||
DWORD dlg_code;
|
DWORD dlg_code;
|
||||||
HFONT zfont;
|
|
||||||
|
|
||||||
/* selection with VK_SPACE should capture button window */
|
/* selection with VK_SPACE should capture button window */
|
||||||
hwnd = CreateWindowExA(0, "button", "test", BS_CHECKBOX | WS_VISIBLE | WS_POPUP,
|
hwnd = CreateWindowExA(0, "button", "test", BS_CHECKBOX | WS_VISIBLE | WS_POPUP,
|
||||||
@ -5822,11 +5823,21 @@ static void test_button_messages(void)
|
|||||||
100, 100, 200, 200, 0, 0, 0, NULL);
|
100, 100, 200, 200, 0, 0, 0, NULL);
|
||||||
ok(parent != 0, "Failed to create parent window\n");
|
ok(parent != 0, "Failed to create parent window\n");
|
||||||
|
|
||||||
|
memset(&logfont, 0, sizeof(logfont));
|
||||||
|
logfont.lfHeight = -12;
|
||||||
|
logfont.lfWeight = FW_NORMAL;
|
||||||
|
strcpy(logfont.lfFaceName, "Tahoma");
|
||||||
|
|
||||||
|
hfont2 = CreateFontIndirectA(&logfont);
|
||||||
|
ok(hfont2 != NULL, "Failed to create Tahoma font\n");
|
||||||
|
|
||||||
for (i = 0; i < sizeof(button)/sizeof(button[0]); i++)
|
for (i = 0; i < sizeof(button)/sizeof(button[0]); i++)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
DWORD style, state;
|
DWORD style, state;
|
||||||
|
HFONT prevfont;
|
||||||
char desc[64];
|
char desc[64];
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
trace("button style %08x\n", button[i].style);
|
trace("button style %08x\n", button[i].style);
|
||||||
|
|
||||||
@ -6001,15 +6012,35 @@ static void test_button_messages(void)
|
|||||||
ok_sequence(button[i].lbuttonup, desc, FALSE);
|
ok_sequence(button[i].lbuttonup, desc, FALSE);
|
||||||
|
|
||||||
flush_sequence();
|
flush_sequence();
|
||||||
zfont = GetStockObject(SYSTEM_FONT);
|
zfont = GetStockObject(DEFAULT_GUI_FONT);
|
||||||
SendMessageA(hwnd, WM_SETFONT, (WPARAM)zfont, TRUE);
|
SendMessageA(hwnd, WM_SETFONT, (WPARAM)zfont, TRUE);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
sprintf(desc, "button[%i]: WM_SETFONT on a button", i);
|
sprintf(desc, "button[%i]: WM_SETFONT on a button", i);
|
||||||
ok_sequence(button[i].setfont, desc, FALSE);
|
ok_sequence(button[i].setfont, desc, FALSE);
|
||||||
|
|
||||||
|
/* Test that original font is not selected back after painting */
|
||||||
|
hdc = CreateCompatibleDC(0);
|
||||||
|
|
||||||
|
prevfont = SelectObject(hdc, hfont2);
|
||||||
|
ok(prevfont == GetStockObject(SYSTEM_FONT), "Unexpected default font\n");
|
||||||
|
SendMessageA(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, 0);
|
||||||
|
todo_wine
|
||||||
|
ok(GetStockObject(SYSTEM_FONT) == GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PRINTCLIENT\n", i);
|
||||||
|
SelectObject(hdc, prevfont);
|
||||||
|
|
||||||
|
prevfont = SelectObject(hdc, hfont2);
|
||||||
|
ok(prevfont == GetStockObject(SYSTEM_FONT), "Unexpected default font\n");
|
||||||
|
SendMessageA(hwnd, WM_PAINT, (WPARAM)hdc, 0);
|
||||||
|
todo_wine
|
||||||
|
ok(GetStockObject(SYSTEM_FONT) == GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PAINT\n", i);
|
||||||
|
SelectObject(hdc, prevfont);
|
||||||
|
|
||||||
|
DeleteDC(hdc);
|
||||||
|
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeleteObject(hfont2);
|
||||||
DestroyWindow(parent);
|
DestroyWindow(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user