X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dbd5b2ce42875058a7f109168d7887c95d893d28..62795f413a7222863b4aee76c08764071f94bd87:/tests/events/propagation.cpp diff --git a/tests/events/propagation.cpp b/tests/events/propagation.cpp index 53441b75c7..a69a97b098 100644 --- a/tests/events/propagation.cpp +++ b/tests/events/propagation.cpp @@ -3,7 +3,6 @@ // Purpose: Test events propagation // Author: Vadim Zeitlin // Created: 2009-01-16 -// RCS-ID: $Id$ // Copyright: (c) 2009 Vadim Zeitlin /////////////////////////////////////////////////////////////////////////////// @@ -29,6 +28,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 @@ -540,11 +540,14 @@ void EventPropagationTestCase::DocView() wxDocument* const doc = docTemplate.CreateDocument(""); wxView* const view = doc->GetFirstView(); - wxScopedPtr + wxScopedPtr child(new wxDocMDIChildFrame(doc, view, parent.get(), wxID_ANY, "Child")); wxMenu* const menuChild = CreateTestMenu(child.get()); + // Ensure that the child that we've just created is the active one. + child->Activate(); + #ifdef __WXGTK__ // There are a lot of hacks related to child frame menu bar handling in // wxGTK and, in particular, the code in src/gtk/mdi.cpp relies on getting @@ -575,6 +578,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