From 2e1e56d0cef7f37676a42d051e9e67aed29a1571 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 13 Jun 2013 13:57:51 +0000 Subject: [PATCH] Check wxListCtrl::GetItemRect() origin in the unit tests. Verify that the top item is _not_ at (0, 0) when the header is present in the control, as the control client coordinates should not take the header into account. This test passes when using wxGenericListCtrl since r74197, add it to ensure that it doesn't get broken again later. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74232 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/controls/listbasetest.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/controls/listbasetest.cpp b/tests/controls/listbasetest.cpp index f1162417a6..4c3f042cf2 100644 --- a/tests/controls/listbasetest.cpp +++ b/tests/controls/listbasetest.cpp @@ -131,6 +131,21 @@ void ListBaseTestCase::ItemRect() WX_ASSERT_FAILS_WITH_ASSERT( list->GetSubItemRect(0, 3, r) ); + + // As we have a header, the top item shouldn't be at (0, 0), but somewhere + // below the header. + // + // Notice that we consider that the header can't be less than 10 pixels + // because we don't know its exact height. + CPPUNIT_ASSERT( list->GetItemRect(0, r) ); + CPPUNIT_ASSERT( r.y >= 10 ); + + // However if we remove the header now, the item should be at (0, 0). + list->SetWindowStyle(wxLC_REPORT | wxLC_NO_HEADER); + CPPUNIT_ASSERT( list->GetItemRect(0, r) ); + CPPUNIT_ASSERT_EQUAL( 0, r.y ); + + //tidy up when we are finished list->ClearAll(); } -- 2.47.2