[1/3] comctl32/listview: Some LVM_GETITEMRECT tests
Nikolay Sivov
bunglehead at gmail.com
Tue May 26 16:34:57 CDT 2009
Changelog:
- Some LVM_GETITEMRECT tests
>From 55568e4fe509bddf1b4144592e10ee70b625f3d9 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 26 May 2009 20:28:39 +0400
Subject: Some LVM_GETITEMRECT tests
---
dlls/comctl32/tests/listview.c | 90 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 47477a4..fdf3a3d 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2564,6 +2564,95 @@ static void test_columnscreation(void)
DestroyWindow(hwnd);
}
+static void test_getitemrect(void)
+{
+ HWND hwnd;
+ RECT rect;
+ DWORD r;
+ LVITEMA item;
+ LVCOLUMNA col;
+ INT order[2];
+ POINT pt;
+
+ hwnd = create_listview_control(0);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+
+ /* empty item */
+ memset(&item, 0, sizeof(item));
+ item.iItem = 0;
+ item.iSubItem = 0;
+ r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
+ expect(0, r);
+
+ rect.left = LVIR_BOUNDS;
+ rect.right = rect.top = rect.bottom = -1;
+ r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+ expect(TRUE, r);
+
+ /* zero width rectangle */
+todo_wine {
+ expect(0, rect.left);
+ expect(0, rect.right);
+}
+
+ insert_column(hwnd, 0);
+ insert_column(hwnd, 1);
+
+ col.mask = LVCF_WIDTH;
+ col.cx = 50;
+ r = SendMessage(hwnd, LVM_SETCOLUMN, 0, (LPARAM)&col);
+ expect(TRUE, r);
+
+ col.mask = LVCF_WIDTH;
+ col.cx = 100;
+ r = SendMessage(hwnd, LVM_SETCOLUMN, 1, (LPARAM)&col);
+ expect(TRUE, r);
+
+ rect.left = LVIR_BOUNDS;
+ rect.right = rect.top = rect.bottom = -1;
+ r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+ expect(TRUE, r);
+
+ /* still no left padding */
+todo_wine {
+ expect(0, rect.left);
+}
+
+ rect.left = LVIR_SELECTBOUNDS;
+ rect.right = rect.top = rect.bottom = -1;
+ r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+ expect(TRUE, r);
+ /* padding */
+ todo_wine expect(2, rect.left);
+
+ /* change order */
+ order[0] = 1; order[1] = 0;
+ r = SendMessage(hwnd, LVM_SETCOLUMNORDERARRAY, 2, (LPARAM)&order);
+ expect(TRUE, r);
+ pt.x = -1;
+ r = SendMessage(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM)&pt);
+ expect(TRUE, r);
+ /* 1 indexed column width + padding */
+ todo_wine expect(102, pt.x);
+ /* rect is at zero too */
+ rect.left = LVIR_BOUNDS;
+ rect.right = rect.top = rect.bottom = -1;
+ r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+ expect(TRUE, r);
+ todo_wine expect(0, rect.left);
+ /* just width sum */
+ todo_wine expect(150, rect.right);
+
+ rect.left = LVIR_SELECTBOUNDS;
+ rect.right = rect.top = rect.bottom = -1;
+ r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+ expect(TRUE, r);
+ /* column width + padding */
+ todo_wine expect(102, rect.left);
+
+ DestroyWindow(hwnd);
+}
+
START_TEST(listview)
{
HMODULE hComctl32;
@@ -2601,6 +2690,7 @@ START_TEST(listview)
test_columns();
test_getorigin();
test_multiselect();
+ test_getitemrect();
test_subitem_rect();
test_sorting();
test_ownerdata();
--
1.5.6.5
More information about the wine-patches
mailing list