Wrong selection in wxOSX wxNotebook after deleting a page
|Reported by:||vadz||Owned by:|
|Keywords:||notebook selection inconsistency||Cc:||csomor@…|
We have a unit test failure currently:
Test name: NotebookTestCase::PageManagement equality assertion failed - Expected: 1 - Actual : 2
and running the widgets sample, creating 3 pages on its notebook page, selecting the page 1 and removing the page 0 makes the selection indeed jump to the old page 2, i.e. another page. This is unexpected, it should really stay on the same page and the selection value should change.
I thought fixing this would be easy and tried
diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index 90dc488..728d405 100644
a b wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage) 176 176 177 177 MacSetupTabs(); 178 178 179 if ( m_selection >= (int)GetPageCount()) 180 m_selection = GetPageCount() - 1; 179 if () 180 m_selection; 181 181 182 182 if (m_selection >= 0) 183 183 m_pages[m_selection]->Show(true);
but while this does make the unit test pass, it breaks the behaviour in an even worse way: now after the same actions in the widgets sample, no page is shown at all.
I see that Show(true) actually has no effect because the page is already considered to be shown at wxWindow level, but this seems correct. What I don't understand is why is it in fact really hidden. Would you have any idea about this, Stefan?
It would be nice to fix this but if not, we need to at least document the discrepancy in behaviour and disable the failing test.