Listbox: item height test

Dimitrie O. Paun dpaun at rogers.com
Sat Jan 1 13:18:18 CST 2005


I think this will fail on Windows, let's see.

ChangeLog
    Add test for the listbox item height.


Index: dlls/user/tests/listbox.c
===================================================================
RCS file: /var/cvs/wine/dlls/user/tests/listbox.c,v
retrieving revision 1.3
diff -u -r1.3 listbox.c
--- dlls/user/tests/listbox.c	5 Oct 2004 22:31:00 -0000	1.3
+++ dlls/user/tests/listbox.c	1 Jan 2005 19:12:16 -0000
@@ -137,6 +137,26 @@
   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 @@
   check (MS);
   trace (" ... with NOSEL\n");
   check (MS_NS);
+
+  check_item_height();
 }

-- 
Dimi.



More information about the wine-patches mailing list