comctl32/tests: Make the test dpi and theme aware by using SM_CYSIZE.
This commit is contained in:
parent
a14a75b85e
commit
f78f4d89b7
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue