Detlef Riekenberg : comctl32/tests: Make the test dpi and theme aware by using SM_CYSIZE.
Alexandre Julliard
julliard at winehq.org
Wed Feb 4 09:15:36 CST 2009
Module: wine
Branch: master
Commit: f78f4d89b70c31db0a5b95c623d500bd057926f2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f78f4d89b70c31db0a5b95c623d500bd057926f2
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Wed Feb 4 00:35:57 2009 +0100
comctl32/tests: Make the test dpi and theme aware by using SM_CYSIZE.
---
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);
More information about the wine-cvs
mailing list