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
This commit is contained in:
Vadim Zeitlin 2013-06-13 13:57:51 +00:00
parent 1c25a4c2ae
commit 2e1e56d0ce

View File

@ -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();
}