Nikolay Sivov : comctl32/listview: Fix item count tests to be dpi aware.

Alexandre Julliard julliard at winehq.org
Tue Jun 9 10:45:27 CDT 2009


Module: wine
Branch: master
Commit: f531271d707bd0e5ce922fb68d2b105bf751b725
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f531271d707bd0e5ce922fb68d2b105bf751b725

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Mon Jun  8 22:54:56 2009 +0400

comctl32/listview: Fix item count tests to be dpi aware.

---

 dlls/comctl32/tests/listview.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 8e87651..ca72fa5 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1570,6 +1570,11 @@ static void test_item_count(void)
 
     HWND hwnd;
     DWORD r;
+    HDC hdc;
+    HFONT hOldFont;
+    TEXTMETRICA tm;
+    RECT rect;
+    INT height;
 
     LVITEM item0;
     LVITEM item1;
@@ -1581,6 +1586,19 @@ static void test_item_count(void)
     hwnd = create_listview_control(0);
     ok(hwnd != NULL, "failed to create a listview window\n");
 
+    /* resize in dpiaware manner to fit all 3 items added */
+    hdc = GetDC(0);
+    hOldFont = SelectObject(hdc, GetStockObject(SYSTEM_FONT));
+    GetTextMetricsA(hdc, &tm);
+    /* 2 extra pixels for bounds and header border */
+    height = tm.tmHeight + 2;
+    SelectObject(hdc, hOldFont);
+    ReleaseDC(0, hdc);
+
+    GetWindowRect(hwnd, &rect);
+    /* 3 items + 1 header + 1 to be sure */
+    MoveWindow(hwnd, 0, 0, rect.right - rect.left, 5 * height, FALSE);
+
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     trace("test item count\n");




More information about the wine-cvs mailing list