]> git.saurik.com Git - wxWidgets.git/commitdiff
Add test for absence of events from wxSpinCtrlDouble ctor.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 6 Aug 2013 16:59:54 +0000 (16:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 6 Aug 2013 16:59:54 +0000 (16:59 +0000)
Run the same NoEventsInCtor() test as we already had for wxSpinCtrl for
wxSpinCtrlDouble as well.

Unfortunately currently there is no way to reuse the tests between these two
classes, we should refactor these test cases to use a common
SpinCtrlTestCaseBase<T> base class.

See #15375 which fixed the underlying bug.

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

tests/controls/spinctrldbltest.cpp

index 32660e76b262c0caaea8db4c9c9291dae30e2730..b320d986e961dc24e3a2ea343336f66415fb5d5b 100644 (file)
@@ -30,6 +30,7 @@ public:
 
 private:
     CPPUNIT_TEST_SUITE( SpinCtrlDoubleTestCase );
+        CPPUNIT_TEST( NoEventsInCtor );
         WXUISIM_TEST( Arrows );
         WXUISIM_TEST( Wrap );
         CPPUNIT_TEST( Range );
@@ -38,6 +39,7 @@ private:
         CPPUNIT_TEST( Digits );
     CPPUNIT_TEST_SUITE_END();
 
+    void NoEventsInCtor();
     void Arrows();
     void Wrap();
     void Range();
@@ -66,6 +68,23 @@ void SpinCtrlDoubleTestCase::tearDown()
     wxDELETE(m_spin);
 }
 
+void SpinCtrlDoubleTestCase::NoEventsInCtor()
+{
+    // Verify that creating the control does not generate any events. This is
+    // unexpected and shouldn't happen.
+    wxWindow* const parent = m_spin->GetParent();
+    delete m_spin;
+    m_spin = new wxSpinCtrlDouble;
+
+    EventCounter updated(m_spin, wxEVT_SPINCTRLDOUBLE);
+
+    m_spin->Create(parent, wxID_ANY, "",
+                   wxDefaultPosition, wxDefaultSize, 0,
+                   0., 100., 17.);
+
+    CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
+}
+
 void SpinCtrlDoubleTestCase::Arrows()
 {
 #ifndef __WXGTK__