Fix wxListCtrl test failing under wxQt

The wxListCtrl would assert with this message: '../src/qt/listctrl.cpp(452):
assert "col < columnCount()" failed in SetItem(): Invalid col'

Because under wxQt: no columns means no items, and no items means
no selection can be made at all.
This commit is contained in:
ali kettab 2023-10-04 10:33:47 +01:00
parent f7e7c037c2
commit ae0d707166

View file

@ -81,6 +81,7 @@ void VirtListCtrlTestCase::setUp()
};
m_list = new VirtListCtrl;
m_list->AppendColumn("Col0");
}
void VirtListCtrlTestCase::tearDown()
@ -101,15 +102,19 @@ void VirtListCtrlTestCase::UpdateSelection()
CPPUNIT_ASSERT_EQUAL( 2, m_list->GetSelectedItemCount() );
// The item 7 is now invalid and so shouldn't be counted as selected any
// more.
// more. Notice that under wxQt, the selection is lost/cleared when the
// model is reset
m_list->SetItemCount(5);
#ifndef __WXQT__
CPPUNIT_ASSERT_EQUAL( 1, m_list->GetSelectedItemCount() );
#else
CPPUNIT_ASSERT_EQUAL( 0, m_list->GetSelectedItemCount() );
#endif
}
void VirtListCtrlTestCase::DeselectedEvent()
{
#if wxUSE_UIACTIONSIMULATOR
m_list->AppendColumn("Col0");
m_list->SetItemCount(1);
wxListCtrl* const list = m_list;