]> git.saurik.com Git - wxWidgets.git/commitdiff
No real changes, just simplify wxBookCtrlBase unit test a little.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 16:39:15 +0000 (16:39 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 16:39:15 +0000 (16:39 +0000)
Add Realize() virtual function that can be overridden in ToolbookTestCase
instead of using explicit wxDynamicCasts.

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

tests/controls/bookctrlbasetest.cpp
tests/controls/bookctrlbasetest.h
tests/controls/toolbooktest.cpp

index c28e238a687a0aab6cbf148289bb7f8df01b26e2..c5065607e286997cd0dcc05bc688dab3ab5618fc 100644 (file)
@@ -17,8 +17,6 @@
 #include "wx/artprov.h"
 #include "wx/imaglist.h"
 #include "wx/bookctrl.h"
-#include "wx/toolbook.h"
-#include "wx/toolbar.h"
 #include "bookctrlbasetest.h"
 #include "testableframe.h"
 
@@ -35,11 +33,7 @@ void BookCtrlBaseTestCase::AddPanels()
 
     base->AssignImageList(m_list);
 
-    //We need to realize the toolbar if we ware running the wxToolbook tests
-    wxToolbook *book = wxDynamicCast(base, wxToolbook);
-
-    if(book)
-        book->GetToolBar()->Realize();
+    Realize();
 
     m_panel1 = new wxPanel(base);
     m_panel2 = new wxPanel(base);
@@ -96,11 +90,7 @@ void BookCtrlBaseTestCase::PageManagement()
 
     base->InsertPage(0, new wxPanel(base), "New Panel", true, 0);
 
-    //We need to realize the toolbar if we ware running the wxToolbook tests
-    wxToolbook *book = wxDynamicCast(base, wxToolbook);
-
-    if(book)
-        book->GetToolBar()->Realize();
+    Realize();
 
     CPPUNIT_ASSERT_EQUAL(0, base->GetSelection());
     CPPUNIT_ASSERT_EQUAL(4, base->GetPageCount());
index b72a5b47c272b370a40c9f5bb7e4123fcf2df8cc..2fec1e293a208abb2b5719c7b8c2a2d8ebbf65df 100644 (file)
@@ -48,6 +48,9 @@ protected:
     //the ctrl.
     void AddPanels();
 
+    // Override this to call Realize() on the toolbar in the wxToolbook test.
+    virtual void Realize() { }
+
     wxPanel* m_panel1;
     wxPanel* m_panel2;
     wxPanel* m_panel3;
index b1b0802bf223cb68cf7a52368fca526881cea828..58b8f535bab194314e574b2283de2824b5634a86 100644 (file)
@@ -41,6 +41,8 @@ private:
     virtual wxEventType GetChangingEvent() const
     { return wxEVT_TOOLBOOK_PAGE_CHANGING; }
 
+    virtual void Realize() { m_toolbook->GetToolBar()->Realize(); }
+
     CPPUNIT_TEST_SUITE( ToolbookTestCase );
         wxBOOK_CTRL_BASE_TESTS();
         CPPUNIT_TEST( ToolBar );