Revert "Fix fields initialization in wxCommandEvent copy ctor."

This reverts commit 62763ad541 which seems to
have been completely unnecessary as the fields had been already initialized
and this commit actually broke initialization of the propagation level of the
copied wxCommandEvent objects.

Add a unit test proving that things do work.

Closes #16739.
This commit is contained in:
Vadim Zeitlin
2016-01-30 05:00:43 +01:00
parent a7d31701ab
commit 5dd5d68e67
2 changed files with 32 additions and 10 deletions

View File

@@ -248,6 +248,7 @@ private:
#endif
CPPUNIT_TEST( DocView );
WXUISIM_TEST( ContextMenuEvent );
CPPUNIT_TEST( PropagationLevel );
CPPUNIT_TEST_SUITE_END();
void OneHandler();
@@ -260,6 +261,7 @@ private:
void MenuEvent();
void DocView();
void ContextMenuEvent();
void PropagationLevel();
wxDECLARE_NO_COPY_CLASS(EventPropagationTestCase);
};
@@ -669,4 +671,31 @@ void EventPropagationTestCase::ContextMenuEvent()
CPPUNIT_ASSERT_EQUAL( "p", g_str );
}
// Helper function: get the event propagation level.
int GetPropagationLevel(wxEvent& e)
{
const int level = e.StopPropagation();
e.ResumePropagation(level);
return level;
}
void EventPropagationTestCase::PropagationLevel()
{
wxSizeEvent se;
CPPUNIT_ASSERT_EQUAL( GetPropagationLevel(se), (int)wxEVENT_PROPAGATE_NONE );
wxCommandEvent ce;
CPPUNIT_ASSERT_EQUAL( GetPropagationLevel(ce), (int)wxEVENT_PROPAGATE_MAX );
wxCommandEvent ce2(ce);
CPPUNIT_ASSERT_EQUAL( GetPropagationLevel(ce2), (int)wxEVENT_PROPAGATE_MAX );
wxCommandEvent ce3;
ce3.ResumePropagation(17);
CPPUNIT_ASSERT_EQUAL( GetPropagationLevel(ce3), 17 );
wxCommandEvent ce4(ce3);
CPPUNIT_ASSERT_EQUAL( GetPropagationLevel(ce4), 17 );
}
#endif // wxUSE_UIACTIONSIMULATOR