Module: wine Branch: master Commit: 38c66289114d1ebbc03634843392aff4eaabd43c URL: http://source.winehq.org/git/wine.git/?a=commit;h=38c66289114d1ebbc036348433...
Author: Vincent Povirk vincent@codeweavers.com Date: Thu Feb 18 14:47:43 2010 -0600
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); }