]> git.saurik.com Git - wxWidgets.git/commitdiff
Test handling of events from the toolbar in an MDI parent frame.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 Jul 2013 22:18:18 +0000 (22:18 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 Jul 2013 22:18:18 +0000 (22:18 +0000)
These events must be received by the currently active child.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/events/propagation.cpp

index 9f4b05ffcba5af231b1dd49c84703b5930d4c4fa..21ece32df29f21d5a6c618ca1ecc91fcb60ac58e 100644 (file)
@@ -29,6 +29,7 @@
 #include "wx/menu.h"
 #include "wx/scopedptr.h"
 #include "wx/scopeguard.h"
+#include "wx/toolbar.h"
 #include "wx/uiaction.h"
 
 // FIXME: Currently under OS X testing paint event doesn't work because neither
@@ -578,6 +579,22 @@ void EventPropagationTestCase::DocView()
     // Check that wxDocument, wxView, wxDocManager, child frame and the parent
     // get the event in order.
     ASSERT_MENU_EVENT_RESULT( menuChild, "advmcpA" );
+
+
+#if wxUSE_TOOLBAR
+    // Also check that toolbar events get forwarded to the active child.
+    wxToolBar* const tb = parent->CreateToolBar(wxTB_NOICONS);
+    tb->AddTool(wxID_APPLY, "Apply", wxNullBitmap);
+    tb->Realize();
+
+    // As in CheckMenuEvent(), use toolbar method actually sending the event
+    // instead of bothering with wxUIActionSimulator which would have been
+    // trickier.
+    g_str.clear();
+    tb->OnLeftClick(wxID_APPLY, true /* doesn't matter */);
+
+    CPPUNIT_ASSERT_EQUAL( "advmcpA", g_str );
+#endif // wxUSE_TOOLBAR
 }
 
 #if wxUSE_UIACTIONSIMULATOR