[PATCH] comctl32/tests: Make the test dpi and Theme aware: use SM_CYSIZE
Detlef Riekenberg
wine.dev at web.de
Sun Feb 1 05:48:30 CST 2009
---
dlls/comctl32/tests/status.c | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/tests/status.c b/dlls/comctl32/tests/status.c
index 8b8facf..1409710 100644
--- a/dlls/comctl32/tests/status.c
+++ b/dlls/comctl32/tests/status.c
@@ -40,6 +40,8 @@ static WNDPROC g_status_wndproc;
static RECT g_rcCreated;
static HWND g_hMainWnd;
static int g_wmsize_count = 0;
+static DWORD g_height;
+static DWORD g_have_9x = FALSE;
static HWND create_status_control(DWORD style, DWORD exstyle)
{
@@ -113,10 +115,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 (g_have_9x && 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 +140,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);
@@ -165,7 +177,12 @@ static void test_height(void)
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "Tahoma");
g_wmsize_count = 0;
- SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
+ SendMessageW(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
+ if (!g_wmsize_count)
+ {
+ g_have_9x++;
+ SendMessageA(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
+ }
if (!g_wmsize_count)
{
skip("Status control not resized in win95, skipping broken tests.\n");
@@ -213,7 +230,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
--=-dR3y4yeeyFQ2UjoWtK06--
More information about the wine-patches
mailing list