]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/bitmaptogglebuttontest.cpp
Add a test for eol-native file existence in the release script.
[wxWidgets.git] / tests / controls / bitmaptogglebuttontest.cpp
index a14230ab4e927b0d3e9cc1f7c838e62b3de4e88e..03a7e7eac03869009e2129dbae743f3621b00707 100644 (file)
     #pragma hdrstop
 #endif
 
     #pragma hdrstop
 #endif
 
+#include "wx/tglbtn.h"
+
+#ifdef wxHAS_BITMAPTOGGLEBUTTON
+
 #ifndef WX_PRECOMP
     #include "wx/app.h"
 #endif // WX_PRECOMP
 #ifndef WX_PRECOMP
     #include "wx/app.h"
 #endif // WX_PRECOMP
@@ -22,7 +26,6 @@
 #include "testableframe.h"
 #include "wx/uiaction.h"
 #include "wx/artprov.h"
 #include "testableframe.h"
 #include "wx/uiaction.h"
 #include "wx/artprov.h"
-#include "wx/tglbtn.h"
 
 class BitmapToggleButtonTestCase : public CppUnit::TestCase
 {
 
 class BitmapToggleButtonTestCase : public CppUnit::TestCase
 {
@@ -49,7 +52,7 @@ private:
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( BitmapToggleButtonTestCase );
 
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( BitmapToggleButtonTestCase );
 
-// also include in it's own registry so that these tests can be run alone
+// also include in its own registry so that these tests can be run alone
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( BitmapToggleButtonTestCase,
                                       "BitmapToggleButtonTestCase" );
 
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( BitmapToggleButtonTestCase,
                                       "BitmapToggleButtonTestCase" );
 
@@ -71,10 +74,7 @@ void BitmapToggleButtonTestCase::tearDown()
 void BitmapToggleButtonTestCase::Click()
 {
 #if wxUSE_UIACTIONSIMULATOR
 void BitmapToggleButtonTestCase::Click()
 {
 #if wxUSE_UIACTIONSIMULATOR
-    wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
-                                          wxTestableFrame);
-
-    EventCounter count(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
+    EventCounter clicked(m_button, wxEVT_TOGGLEBUTTON);
 
     wxUIActionSimulator sim;
 
 
     wxUIActionSimulator sim;
 
@@ -85,25 +85,23 @@ void BitmapToggleButtonTestCase::Click()
     sim.MouseClick();
     wxYield();
 
     sim.MouseClick();
     wxYield();
 
-    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+    CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
     CPPUNIT_ASSERT(m_button->GetValue());
 
     CPPUNIT_ASSERT(m_button->GetValue());
 
+    clicked.Clear();
     wxMilliSleep(1000);
 
     sim.MouseClick();
     wxYield();
 
     wxMilliSleep(1000);
 
     sim.MouseClick();
     wxYield();
 
-    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+    CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
     CPPUNIT_ASSERT(!m_button->GetValue());
 #endif // wxUSE_UIACTIONSIMULATOR
 }
 
 void BitmapToggleButtonTestCase::Value()
 {
     CPPUNIT_ASSERT(!m_button->GetValue());
 #endif // wxUSE_UIACTIONSIMULATOR
 }
 
 void BitmapToggleButtonTestCase::Value()
 {
-    wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
-                                          wxTestableFrame);
-
-    EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
+    EventCounter clicked(m_button, wxEVT_BUTTON);
 
     m_button->SetValue(true);
 
 
     m_button->SetValue(true);
 
@@ -113,7 +111,9 @@ void BitmapToggleButtonTestCase::Value()
 
     CPPUNIT_ASSERT(!m_button->GetValue());
 
 
     CPPUNIT_ASSERT(!m_button->GetValue());
 
-    CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
+    CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
 }
 
 }
 
-#endif
+#endif // wxHAS_BITMAPTOGGLEBUTTON
+
+#endif // wxUSE_TOGGLEBTN