- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 - 37
 - 38
 - 39
 - 40
 - 41
 - 42
 - 43
 - 44
 - 45
 - 46
 - 47
 - 48
 - 49
 - 50
 - 51
 - 52
 - 53
 - 54
 - 55
 - 56
 - 57
 - 58
 - 59
 - 60
 - 61
 - 62
 - 63
 - 64
 - 65
 - 66
 - 67
 - 68
 - 69
 - 70
 - 71
 - 72
 - 73
 - 74
 - 75
 - 76
 - 77
 - 78
 
                        void SimpleTest::testTrivial() {
    wxTst::TempInteractive interactive;
    wxTst::ModalDialogTimer timer(wxID_OK);
   // *** Loop up top level containers ***
    CPPUNIT_ASSERT_MESSAGE ("Application top window invalid", 
			    wxTheApp->GetTopWindow () != NULL);
    wxMDIParentFrame *topFrame = 
	dynamic_cast< wxMDIParentFrame * >(wxTheApp->GetTopWindow ());
    CPPUNIT_ASSERT_MESSAGE ("Top window is not an MDI Parent frame", 
			    topFrame != NULL);
    wxMenuBar *menuBar = topFrame->GetMenuBar ();
    CPPUNIT_ASSERT_MESSAGE ("Menubar not found", menuBar != NULL);
//    interactive.ShowCurrentGui (_T(__FILE__), __LINE__);
    // *** Check menu item ***
    int platformMenuItemId = menuBar->FindMenuItem (_("Advanced"), 
            MC _T("Platform Specific Example"));
    CPPUNIT_ASSERT_MESSAGE ("Menu item ID 'platformMenuItem' not found",
            platformMenuItemId != wxNOT_FOUND);
    wxMenuItem *platformMenuItem = menuBar->FindItem (
            platformMenuItemId);
    CPPUNIT_ASSERT_MESSAGE ("Menu item 'platformMenuItem' not found",
            platformMenuItem != NULL);
    wxTst::EventSimulationHelper::SelectMenuItem (
            platformMenuItemId, topFrame);
    wxTst::WxGuiTestHelper::FlushEventQueue ();
    wxWindow* wdw = topFrame->FindWindow(_T("platform_child"));
    if (wdw == NULL)
	wdw = wxWindow::FindWindowByName(_T("platform_child"));
    CPPUNIT_ASSERT_MESSAGE("First Child not found", wdw != NULL);
    wxMDIChildFrame* child1 = dynamic_cast<wxMDIChildFrame*>(wdw);
    CPPUNIT_ASSERT_MESSAGE("Window isn't an MDI Child", child1 != NULL);
    wxTst::WxGuiTestHelper::FlushEventQueue ();
    interactive.ShowCurrentGui (_T(__FILE__), __LINE__);
    wxTst::EventSimulationHelper::SelectMenuItem (
            platformMenuItemId, topFrame);
    wxTst::WxGuiTestHelper::FlushEventQueue ();
//    interactive.ShowCurrentGui (_T(__FILE__), __LINE__);
    wxMDIChildFrame* child2 = topFrame->GetActiveChild();
    CPPUNIT_ASSERT_MESSAGE("Second child not found", child2 != NULL);
    CPPUNIT_ASSERT_MESSAGE("Second child same as first ", child2 != child1);
    child2->Close();
    int derived_toolMenuItemId = menuBar->FindMenuItem (_("Advanced"),
            MC _T("Custom Class Example"));
    CPPUNIT_ASSERT_MESSAGE ("Menu item ID 'derived_toolMenuItem' not found",
            derived_toolMenuItemId != wxNOT_FOUND);
    wxMenuItem *derived_toolMenuItem = menuBar->FindItem (
            derived_toolMenuItemId);
    CPPUNIT_ASSERT_MESSAGE ("Menu item 'derived_toolMenuItem' not found",
            derived_toolMenuItem != NULL);
    wxTst::EventSimulationHelper::SelectMenuItem (
            derived_toolMenuItemId, topFrame);
    wxTst::WxGuiTestHelper::FlushEventQueue ();
     wxWindow *custom_child = 
	 wxWindow::FindWindowByName (_T("custom_class_child"));
     CPPUNIT_ASSERT_MESSAGE ("Container window for button 'wxID_OK' not found", 
 			    custom_child != NULL);
//    interactive.ShowCurrentGui (_T(__FILE__), __LINE__);
    wxWindow *wxID_OKWdw4 = custom_child->FindWindow (XRCID("wxID_OK"));
    CPPUNIT_ASSERT_MESSAGE ("Window for button 'wxID_OK' not found", 
            wxID_OKWdw4 != NULL);
    wxTst::EventSimulationHelper::ClickButton (wxID_OKWdw4->GetId (), 
            wxID_OKWdw4);
    wxTst::WxGuiTestHelper::FlushEventQueue ();
    CPPUNIT_ASSERT_MESSAGE("OK Button didn't hide Mac Specific Dialog",
			   custom_child->IsShown() == false);
}