]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/buttontest.cpp
Add a test for eol-native file existence in the release script.
[wxWidgets.git] / tests / controls / buttontest.cpp
index bb540b2cfc89800cf9ce41f400be9d5cade7a44b..bb7d684428c0a38e11f532f3c5456eb98f34773a 100644 (file)
@@ -61,7 +61,7 @@ private:
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( ButtonTestCase );
 
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( ButtonTestCase );
 
-// 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( ButtonTestCase, "ButtonTestCase" );
 
 void ButtonTestCase::setUp()
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ButtonTestCase, "ButtonTestCase" );
 
 void ButtonTestCase::setUp()
@@ -80,12 +80,9 @@ void ButtonTestCase::tearDown()
 
 void ButtonTestCase::Click()
 {
 
 void ButtonTestCase::Click()
 {
-    wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
-                                          wxTestableFrame);
-
     //We use the internal class EventCounter which handles connecting and
     //disconnecting the control to the wxTestableFrame
     //We use the internal class EventCounter which handles connecting and
     //disconnecting the control to the wxTestableFrame
-    EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
+    EventCounter clicked(m_button, wxEVT_BUTTON);
 
     wxUIActionSimulator sim;
 
 
     wxUIActionSimulator sim;
 
@@ -97,15 +94,12 @@ void ButtonTestCase::Click()
     sim.MouseClick();
     wxYield();
 
     sim.MouseClick();
     wxYield();
 
-    CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+    CPPUNIT_ASSERT_EQUAL( 1, clicked.GetCount() );
 }
 
 void ButtonTestCase::Disabled()
 {
 }
 
 void ButtonTestCase::Disabled()
 {
-    wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
-                                          wxTestableFrame);
-
-    EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
+    EventCounter clicked(m_button, wxEVT_BUTTON);
 
     wxUIActionSimulator sim;
 
 
     wxUIActionSimulator sim;
 
@@ -118,7 +112,7 @@ void ButtonTestCase::Disabled()
     sim.MouseClick();
     wxYield();
 
     sim.MouseClick();
     wxYield();
 
-    CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
+    CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
 }
 
 #endif // wxUSE_UIACTIONSIMULATOR
 }
 
 #endif // wxUSE_UIACTIONSIMULATOR
@@ -147,7 +141,7 @@ void ButtonTestCase::Auth()
 
 void ButtonTestCase::BitmapMargins()
 {
 
 void ButtonTestCase::BitmapMargins()
 {
-    //Some functions only work on specific platfroms in which case we can use
+    //Some functions only work on specific platforms in which case we can use
     //a preprocessor check
 #ifdef __WXMSW__
     //We must set a bitmap before we can set its margins, when writing unit
     //a preprocessor check
 #ifdef __WXMSW__
     //We must set a bitmap before we can set its margins, when writing unit
@@ -167,19 +161,15 @@ void ButtonTestCase::BitmapMargins()
 
 void ButtonTestCase::Bitmap()
 {
 
 void ButtonTestCase::Bitmap()
 {
-#if !defined(__WXGTK__) && !defined(__WXOSX__)
     //We start with no bitmaps
     CPPUNIT_ASSERT(!m_button->GetBitmap().IsOk());
 
     //We start with no bitmaps
     CPPUNIT_ASSERT(!m_button->GetBitmap().IsOk());
 
-    //Set bitmap should set a bitmap for all states
-    m_button->SetBitmap(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER,
+
+    m_button->SetBitmap(wxArtProvider::GetIcon(wxART_INFORMATION, 
+                                               wxART_OTHER,
                                                wxSize(32, 32)));
 
                                                wxSize(32, 32)));
 
-    CPPUNIT_ASSERT(m_button->GetBitmapDisabled().IsOk());
-    CPPUNIT_ASSERT(m_button->GetBitmapPressed().IsOk());
-    CPPUNIT_ASSERT(m_button->GetBitmapCurrent().IsOk());
-    CPPUNIT_ASSERT(m_button->GetBitmapFocus().IsOk());
-#endif
+    CPPUNIT_ASSERT(m_button->GetBitmap().IsOk());
 }
 
 #endif //wxUSE_BUTTON
 }
 
 #endif //wxUSE_BUTTON