comdlg32/tests: Font sizes are influenced by the display dpi.

This commit is contained in:
Vincent Povirk 2010-02-18 14:47:43 -06:00 committed by Alexandre Julliard
parent cce35e2e7a
commit 38c6628911
1 changed files with 19 additions and 1 deletions

View File

@ -32,6 +32,18 @@
#include "wine/test.h"
static int get_dpiy(void)
{
HDC hdc;
int result;
hdc = GetDC(0);
result = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(0, hdc);
return result;
}
static UINT_PTR CALLBACK CFHookProcOK(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch (msg)
@ -49,6 +61,8 @@ static void test_ChooseFontA(void)
LOGFONTA lfa;
CHOOSEFONTA cfa;
BOOL ret;
int dpiy = get_dpiy();
int expected_pointsize, expected_lfheight;
memset(&lfa, 0, sizeof(LOGFONTA));
lfa.lfHeight = -16;
@ -63,8 +77,12 @@ static void test_ChooseFontA(void)
ret = ChooseFontA(&cfa);
expected_pointsize = MulDiv(16, 72, dpiy) * 10;
expected_lfheight = -MulDiv(expected_pointsize, dpiy, 720);
ok(ret == TRUE, "ChooseFontA returned FALSE\n");
ok(lfa.lfHeight == -16, "Expected -16, got %i\n", lfa.lfHeight);
ok(cfa.iPointSize == expected_pointsize, "Expected %i, got %i\n", expected_pointsize, cfa.iPointSize);
ok(lfa.lfHeight == expected_lfheight, "Expected %i, got %i\n", expected_lfheight, lfa.lfHeight);
ok(lfa.lfWeight == FW_NORMAL, "Expected FW_NORMAL, got %i\n", lfa.lfWeight);
ok(strcmp(lfa.lfFaceName, "Symbol") == 0, "Expected Symbol, got %s\n", lfa.lfFaceName);
}