From 53f3c8655c1eb0935bd6d4e082968120577d237f Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 18 Feb 2010 14:47:43 -0600 Subject: [PATCH] comdlg32/tests: Font sizes are influenced by the display dpi. --- dlls/comdlg32/tests/fontdlg.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/dlls/comdlg32/tests/fontdlg.c b/dlls/comdlg32/tests/fontdlg.c index 885fb44..a277e08 100644 --- a/dlls/comdlg32/tests/fontdlg.c +++ b/dlls/comdlg32/tests/fontdlg.c @@ -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); } -- 1.6.3.3