Add "GTK" prefix to wxChoice::{Dis,En}ableEvents() methods in wxGTK.
This is more than a cosmetic change: adding "GTK" prefix in wxComboBox and not doing it in wxChoice in r64436 broke the event generation for wxComboBox as it didn't override wxChoice methods any longer but defined its own (useless) ones. Using the same name for the methods in both classes notably fixes unexpected event generation from wxComboBox::SetSelection(). Closes #12568. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65818 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include "wx/ctrlsub.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/scopeguard.h"
|
||||
|
||||
#include "itemcontainertest.h"
|
||||
|
||||
void ItemContainerTestCase::Append()
|
||||
@@ -243,3 +245,38 @@ void ItemContainerTestCase::SetString()
|
||||
CPPUNIT_ASSERT_EQUAL("", container->GetString(2));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ItemContainerTestCase::SetSelection()
|
||||
{
|
||||
wxItemContainer * const container = GetContainer();
|
||||
|
||||
container->Append("first");
|
||||
container->Append("second");
|
||||
|
||||
// This class is used to check that SetSelection() doesn't generate any
|
||||
// events, as documented.
|
||||
class CommandEventHandler : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
virtual bool ProcessEvent(wxEvent& event)
|
||||
{
|
||||
CPPUNIT_ASSERT_MESSAGE
|
||||
(
|
||||
"unexpected command event from SetSelection",
|
||||
!event.IsCommandEvent()
|
||||
);
|
||||
|
||||
return wxEvtHandler::ProcessEvent(event);
|
||||
}
|
||||
} h;
|
||||
|
||||
wxWindow * const win = GetContainerWindow();
|
||||
win->PushEventHandler(&h);
|
||||
wxON_BLOCK_EXIT_OBJ1( *win, wxWindow::PopEventHandler, false );
|
||||
|
||||
container->SetSelection(0);
|
||||
CPPUNIT_ASSERT_EQUAL( 0, container->GetSelection() );
|
||||
|
||||
container->SetSelection(1);
|
||||
CPPUNIT_ASSERT_EQUAL( 1, container->GetSelection() );
|
||||
}
|
||||
|
Reference in New Issue
Block a user