comdlg32/tests: Font sizes are influenced by the display dpi.
authorVincent Povirk <vincent@codeweavers.com>
Thu, 18 Feb 2010 20:47:43 +0000 (14:47 -0600)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 19 Feb 2010 10:29:14 +0000 (11:29 +0100)
dlls/comdlg32/tests/fontdlg.c

index 885fb44216c2fb7d49be8fc301b31209e08e1067..a277e083abbe928ea831431ce5d734bf943bea4e 100644 (file)
 
 #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);
 }