[1/2] comctl32/listview: Fix item count tests to be dpi aware
Nikolay Sivov
bunglehead at gmail.com
Mon Jun 8 16:14:46 CDT 2009
This patch fixes depi-related test failures on native platforms.
Items added do not fit in control window height =>
window resized => resing related messages logged => test failure.
Tested on 2k with 120 dpi resolution set.
Related to bug http://bugs.winehq.org/show_bug.cgi?id=16060
Changelog:
- Fix item count tests to be dpi aware
>From 2065940ff2f4516ab1493145b20461fa8bb1e45d Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Mon, 8 Jun 2009 22:54:56 +0400
Subject: 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");
--
1.5.6.5
More information about the wine-patches
mailing list