From d6cf14d7b62f027f83ed2ace3371b4a3538d24fe Mon Sep 17 00:00:00 2001 From: "Dimitrie O. Paun" Date: Mon, 3 Jan 2005 14:40:13 +0000 Subject: [PATCH] Add test for the listbox item height. --- dlls/user/tests/listbox.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/user/tests/listbox.c b/dlls/user/tests/listbox.c index 96b1649cf15..f9e821c8694 100644 --- a/dlls/user/tests/listbox.c +++ b/dlls/user/tests/listbox.c @@ -137,6 +137,26 @@ check (const struct listbox_test test) DestroyWindow (hLB); } +void check_item_height() +{ + HWND hLB; + HDC hdc; + HFONT font; + TEXTMETRICW tm; + INT itemHeight; + + hLB = create_listbox (0); + ok ((hdc = GetDCEx( hLB, 0, DCX_CACHE )) != 0, "Can't get hdc\n"); + ok ((font = GetCurrentObject(hdc, OBJ_FONT)) != 0, "Can't get the current font\n"); + ok (GetTextMetricsW( hdc, &tm ), "Can't read font metrics\n"); + ReleaseDC( hLB, hdc); + + ok (SendMessageW(hLB, WM_SETFONT, (WPARAM)font, 0) == 0, "Can't set font\n"); + + itemHeight = SendMessageW(hLB, LB_GETITEMHEIGHT, 0, 0); + ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight); +} + START_TEST(listbox) { const struct listbox_test SS = @@ -170,4 +190,6 @@ START_TEST(listbox) check (MS); trace (" ... with NOSEL\n"); check (MS_NS); + + check_item_height(); }