Add wxBookCtrlBase::DoSetSelectionAfterRemoval() and use it in wxSimplebook.
This fixes the wrong handling of the selection in wxSimplebook when the currently selected page was deleted. Also extend the unit tests to check for this bug. Closes #15188. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -95,19 +95,25 @@ void BookCtrlBaseTestCase::PageManagement()
|
||||
CPPUNIT_ASSERT_EQUAL(0, base->GetSelection());
|
||||
CPPUNIT_ASSERT_EQUAL(4, base->GetPageCount());
|
||||
|
||||
// Change the selection to verify that deleting a page before the currently
|
||||
// selected one correctly updates the selection.
|
||||
base->SetSelection(2);
|
||||
CPPUNIT_ASSERT_EQUAL(2, base->GetSelection());
|
||||
|
||||
base->DeletePage(1);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(3, base->GetPageCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, base->GetSelection());
|
||||
|
||||
base->RemovePage(0);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(2, base->GetPageCount());
|
||||
CPPUNIT_ASSERT_EQUAL(0, base->GetSelection());
|
||||
|
||||
base->DeleteAllPages();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, base->GetPageCount());
|
||||
|
||||
AddPanels();
|
||||
CPPUNIT_ASSERT_EQUAL(-1, base->GetSelection());
|
||||
}
|
||||
|
||||
void BookCtrlBaseTestCase::ChangeEvents()
|
||||
|
Reference in New Issue
Block a user