Commit 1eacb105 authored by Austin Lund's avatar Austin Lund Committed by Alexandre Julliard

comctl32/tests: Fix band info tests that depend on system font heights.

parent e062d4a6
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
static RECT height_change_notify_rect; static RECT height_change_notify_rect;
static HWND hMainWnd; static HWND hMainWnd;
static int system_font_height;
#define check_rect(name, val, exp) ok(val.top == exp.top && val.bottom == exp.bottom && \ #define check_rect(name, val, exp) ok(val.top == exp.top && val.bottom == exp.bottom && \
...@@ -65,6 +66,17 @@ static BOOL is_font_installed(const char *name) ...@@ -65,6 +66,17 @@ static BOOL is_font_installed(const char *name)
return ret; return ret;
} }
static void init_system_font_height(void) {
HDC hDC;
TEXTMETRIC tm;
hDC = CreateCompatibleDC(NULL);
GetTextMetrics(hDC, &tm);
DeleteDC(NULL);
system_font_height = tm.tmHeight;
}
static HWND create_rebar_control(void) static HWND create_rebar_control(void)
{ {
HWND hwnd; HWND hwnd;
...@@ -814,13 +826,13 @@ static void test_bandinfo(void) ...@@ -814,13 +826,13 @@ static void test_bandinfo(void)
rb.fMask = RBBIM_TEXT; rb.fMask = RBBIM_TEXT;
rb.lpText = szABC; rb.lpText = szABC;
ok(SendMessageA(hRebar, RB_SETBANDINFOA, 0, (LPARAM)&rb), "RB_SETBANDINFO failed\n"); ok(SendMessageA(hRebar, RB_SETBANDINFOA, 0, (LPARAM)&rb), "RB_SETBANDINFO failed\n");
expect_band_content(hRebar, 0, 0, 0, GetSysColor(COLOR_3DFACE), "ABC", -1, NULL, 15, 20, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 35, -1); expect_band_content(hRebar, 0, 0, 0, GetSysColor(COLOR_3DFACE), "ABC", -1, NULL, 15, 20, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 3 + 2*system_font_height, -1);
rb.cbSize = REBARBANDINFOA_V6_SIZE; rb.cbSize = REBARBANDINFOA_V6_SIZE;
rb.fMask = 0; rb.fMask = 0;
ok(SendMessageA(hRebar, RB_INSERTBANDA, 1, (LPARAM)&rb), "RB_INSERTBAND failed\n"); ok(SendMessageA(hRebar, RB_INSERTBANDA, 1, (LPARAM)&rb), "RB_INSERTBAND failed\n");
expect_band_content(hRebar, 1, 0, 0, GetSysColor(COLOR_3DFACE), "", -1, NULL, 0, 0, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 9, -1); expect_band_content(hRebar, 1, 0, 0, GetSysColor(COLOR_3DFACE), "", -1, NULL, 0, 0, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 9, -1);
expect_band_content(hRebar, 0, 0, 0, GetSysColor(COLOR_3DFACE), "ABC", -1, NULL, 15, 20, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 40, -1); expect_band_content(hRebar, 0, 0, 0, GetSysColor(COLOR_3DFACE), "ABC", -1, NULL, 15, 20, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 8 + 2*system_font_height, -1);
rb.fMask = RBBIM_HEADERSIZE; rb.fMask = RBBIM_HEADERSIZE;
rb.cxHeader = 50; rb.cxHeader = 50;
...@@ -839,7 +851,7 @@ static void test_bandinfo(void) ...@@ -839,7 +851,7 @@ static void test_bandinfo(void)
rb.fStyle = RBBS_VARIABLEHEIGHT; rb.fStyle = RBBS_VARIABLEHEIGHT;
rb.lpText = szABC; rb.lpText = szABC;
ok(SendMessageA(hRebar, RB_SETBANDINFOA, 0, (LPARAM)&rb), "RB_SETBANDINFO failed\n"); ok(SendMessageA(hRebar, RB_SETBANDINFOA, 0, (LPARAM)&rb), "RB_SETBANDINFO failed\n");
expect_band_content(hRebar, 0, RBBS_VARIABLEHEIGHT, 0, GetSysColor(COLOR_3DFACE), "ABC", -1, NULL, 15, 20, 0, NULL, 0, 20, 0x7fffffff, 0, 0, 0, 40, 5); expect_band_content(hRebar, 0, RBBS_VARIABLEHEIGHT, 0, GetSysColor(COLOR_3DFACE), "ABC", -1, NULL, 15, 20, 0, NULL, 0, 20, 0x7fffffff, 0, 0, 0, 8 + 2*system_font_height, 5);
DestroyWindow(hRebar); DestroyWindow(hRebar);
} }
...@@ -962,6 +974,8 @@ START_TEST(rebar) ...@@ -962,6 +974,8 @@ START_TEST(rebar)
INITCOMMONCONTROLSEX iccex; INITCOMMONCONTROLSEX iccex;
MSG msg; MSG msg;
init_system_font_height();
/* LoadLibrary is needed. This file has no references to functions in comctl32 */ /* LoadLibrary is needed. This file has no references to functions in comctl32 */
hComctl32 = LoadLibraryA("comctl32.dll"); hComctl32 = LoadLibraryA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx"); pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment