[PATCH] comctl32/tests: Make the test dpi and Theme aware: use SM_CYSIZE

Detlef Riekenberg wine.dev at web.de
Tue Feb 3 17:35:57 CST 2009


---
 dlls/comctl32/tests/status.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/tests/status.c b/dlls/comctl32/tests/status.c
index 8b8facf..f47d3ea 100644
--- a/dlls/comctl32/tests/status.c
+++ b/dlls/comctl32/tests/status.c
@@ -40,6 +40,7 @@ static WNDPROC g_status_wndproc;
 static RECT g_rcCreated;
 static HWND g_hMainWnd;
 static int g_wmsize_count = 0;
+static DWORD g_height;
 
 static HWND create_status_control(DWORD style, DWORD exstyle)
 {
@@ -113,10 +114,16 @@ static int CALLBACK check_height_font_enumproc(ENUMLOGFONTEX *enumlf, NEWTEXTMET
 {
     HWND hwndStatus = (HWND)lParam;
     HDC hdc = GetDC(NULL);
-    static const int sizes[] = {8, 9, 10, 12, 16, 22, 28, 36, 48, 72};
-    int i;
+    static const int sizes[] = { 6,  7,  8,  9, 10, 11, 12, 13, 15, 16,
+                                20, 22, 28, 36, 48, 72};
+    DWORD i;
+    DWORD y;
+    LPSTR facename = (CHAR *)enumlf->elfFullName;
+
+    /* on win9x, enumlf->elfFullName is only valid for truetype fonts */
+    if (type != TRUETYPE_FONTTYPE)
+        facename = enumlf->elfLogFont.lfFaceName;
 
-    trace("Font %s\n", enumlf->elfFullName);
     for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++)
     {
         HFONT hFont;
@@ -132,7 +139,11 @@ static int CALLBACK check_height_font_enumproc(ENUMLOGFONTEX *enumlf, NEWTEXTMET
 
         GetClientRect(hwndStatus, &rcCtrl);
         GetTextMetrics(hdc, &tm);
-        expect(max(tm.tmHeight + (tm.tmInternalLeading ? tm.tmInternalLeading : 2) + 4, 20), rcCtrl.bottom);
+        y = tm.tmHeight + (tm.tmInternalLeading ? tm.tmInternalLeading : 2) + 4;
+
+        ok( rcCtrl.bottom == max(y, g_height),
+            "got %d (expected %d) for %s #%d\n",
+            rcCtrl.bottom, max(y, g_height), facename, sizes[i]);
 
         SelectObject(hdc, hOldFont);
         SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hCtrlFont, TRUE);
@@ -213,7 +224,11 @@ static void test_height(void)
     ZeroMemory(&lf, sizeof(lf));
     SendMessage(hwndStatus, SB_SETMINHEIGHT, 0, 0);
     hdc = GetDC(NULL);
-    trace("dpi=%d\n", GetDeviceCaps(hdc, LOGPIXELSY));
+
+    g_height = GetSystemMetrics(SM_CYSIZE) + 2;
+    if (g_height & 1) g_height--;   /* The height is always even */
+
+    trace("dpi=%d (min height: %d)\n", GetDeviceCaps(hdc, LOGPIXELSY), g_height);
     EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)check_height_family_enumproc, (LPARAM)hwndStatus, 0);
     ReleaseDC(NULL, hdc);
 
-- 
1.5.4.3


--=-ttggeu8c+FTQ/wUGqIWE--




More information about the wine-patches mailing list