Document and test wxItemContainer::Delete() selection handling
Add test checking that selection is reset when deleting the selected item or any item before, but not after, it. Also explicitly document this behaviour.
This commit is contained in:
@@ -270,6 +270,33 @@ void ItemContainerTestCase::SetString()
|
||||
#endif
|
||||
}
|
||||
|
||||
void ItemContainerTestCase::SelectionAfterDelete()
|
||||
{
|
||||
wxItemContainer * const container = GetContainer();
|
||||
|
||||
container->Append("item 0");
|
||||
container->Append("item 1");
|
||||
container->Append("item 2");
|
||||
container->Append("item 3");
|
||||
|
||||
container->SetSelection(1);
|
||||
CHECK( container->GetSelection() == 1 );
|
||||
|
||||
container->Delete(3);
|
||||
CHECK( container->GetSelection() == 1 );
|
||||
|
||||
container->Delete(1);
|
||||
CHECK( container->GetSelection() == wxNOT_FOUND );
|
||||
|
||||
container->SetSelection(1);
|
||||
container->Delete(1);
|
||||
CHECK( container->GetSelection() == wxNOT_FOUND );
|
||||
|
||||
container->SetSelection(0);
|
||||
container->Delete(0);
|
||||
CHECK( container->GetSelection() == wxNOT_FOUND );
|
||||
}
|
||||
|
||||
void ItemContainerTestCase::SetSelection()
|
||||
{
|
||||
wxItemContainer * const container = GetContainer();
|
||||
|
Reference in New Issue
Block a user