CPPUNIT_TEST( ColumnsOrder );
#endif // wxHAS_LISTCTRL_COLUMN_ORDER
CPPUNIT_TEST( ItemRect );
+ CPPUNIT_TEST( ChangeMode );
CPPUNIT_TEST_SUITE_END();
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
void ColumnsOrder();
#endif // wxHAS_LISTCTRL_COLUMN_ORDER
void ItemRect();
+ void ChangeMode();
wxListCtrl *m_list;
void ListCtrlTestCase::ColumnsOrder()
{
- static const int NUM_COLS;
int n;
wxListItem li;
li.SetMask(wxLIST_MASK_TEXT);
// first set up some columns
+ static const int NUM_COLS = 3;
+
m_list->InsertColumn(0, "Column 0");
m_list->InsertColumn(1, "Column 1");
m_list->InsertColumn(2, "Column 2");
CPPUNIT_ASSERT_EQUAL( "second in second", li.GetText() );
}
+#endif // wxHAS_LISTCTRL_COLUMN_ORDER
+
void ListCtrlTestCase::ItemRect()
{
// set up for the test
// do test
wxRect r;
- CPPUNIT_ASSERT( !m_list->GetItemRect(1, r) );
+ WX_ASSERT_FAILS_WITH_ASSERT( m_list->GetItemRect(1, r) );
CPPUNIT_ASSERT( m_list->GetItemRect(0, r) );
CPPUNIT_ASSERT_EQUAL( 150, r.GetWidth() );
WX_ASSERT_FAILS_WITH_ASSERT( m_list->GetSubItemRect(0, 3, r) );
}
-#endif // wxHAS_LISTCTRL_COLUMN_ORDER
+void ListCtrlTestCase::ChangeMode()
+{
+ m_list->InsertColumn(0, "Header");
+ m_list->InsertItem(0, "First");
+ m_list->InsertItem(1, "Second");
+ CPPUNIT_ASSERT_EQUAL( 2, m_list->GetItemCount() );
+
+ // check that switching the mode preserves the items
+ m_list->SetWindowStyle(wxLC_ICON);
+ CPPUNIT_ASSERT_EQUAL( 2, m_list->GetItemCount() );
+ CPPUNIT_ASSERT_EQUAL( "First", m_list->GetItemText(0) );
+
+ // and so does switching back
+ m_list->SetWindowStyle(wxLC_REPORT);
+ CPPUNIT_ASSERT_EQUAL( 2, m_list->GetItemCount() );
+ CPPUNIT_ASSERT_EQUAL( "First", m_list->GetItemText(0) );
+}
+