]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/textctrltest.cpp
Add empty paragraph in wxRichTextTable::AddColumns() and AddRows().
[wxWidgets.git] / tests / controls / textctrltest.cpp
index 970dbb5a5c35a41662cef0c81142c1a3b6e2139a..a541f74b29f634513acbe083a3fd2b55553f717f 100644 (file)
@@ -49,13 +49,36 @@ private:
     virtual wxTextEntry *GetTestEntry() const { return m_text; }
     virtual wxWindow *GetTestWindow() const { return m_text; }
 
+    #define SINGLE_AND_MULTI_TESTS() \
+        WXUISIM_TEST( ReadOnly ); \
+        CPPUNIT_TEST( StreamInput ); \
+        CPPUNIT_TEST( Redirector )
+
     CPPUNIT_TEST_SUITE( TextCtrlTestCase );
+        // These tests run for single line text controls.
         wxTEXT_ENTRY_TESTS();
-        WXUISIM_TEST( ReadOnly );
         WXUISIM_TEST( MaxLength );
-        CPPUNIT_TEST( StreamInput );
-        CPPUNIT_TEST( Redirector );
+        SINGLE_AND_MULTI_TESTS();
+
+        // Now switch to the multi-line text controls.
         CPPUNIT_TEST( PseudoTestSwitchToMultiLineStyle );
+
+        // Rerun some of the tests above. Notice that not all of them pass, so
+        // we can't just use wxTEXT_ENTRY_TESTS() here. For some of them it's
+        // normal, e.g. Hint() test isn't supposed to work for multi-line
+        // controls. Others, such as InsertionPoint() and TextChangeEvents()
+        // don't pass neither but this could be a bug.
+        CPPUNIT_TEST( SetValue );
+        CPPUNIT_TEST( Selection );
+        CPPUNIT_TEST( Replace );
+        WXUISIM_TEST( Editable );
+        CPPUNIT_TEST( CopyPaste );
+        CPPUNIT_TEST( UndoRedo );
+
+        SINGLE_AND_MULTI_TESTS();
+
+
+        // All tests from now on are for multi-line controls only.
         CPPUNIT_TEST( MultiLineReplace );
         //WXUISIM_TEST( ProcessEnter );
         WXUISIM_TEST( Url );
@@ -165,7 +188,7 @@ void TextCtrlTestCase::ReadOnly()
     delete m_text;
     CreateText(wxTE_READONLY);
 
-    EventCounter updated(m_text, wxEVT_COMMAND_TEXT_UPDATED);
+    EventCounter updated(m_text, wxEVT_TEXT);
 
     m_text->SetFocus();
 
@@ -190,8 +213,8 @@ void TextCtrlTestCase::ReadOnly()
 void TextCtrlTestCase::MaxLength()
 {
 #if wxUSE_UIACTIONSIMULATOR
-    EventCounter updated(m_text, wxEVT_COMMAND_TEXT_UPDATED);
-    EventCounter maxlen(m_text, wxEVT_COMMAND_TEXT_MAXLEN);
+    EventCounter updated(m_text, wxEVT_TEXT);
+    EventCounter maxlen(m_text, wxEVT_TEXT_MAXLEN);
 
     m_text->SetFocus();
     m_text->SetMaxLength(10);
@@ -296,7 +319,7 @@ void TextCtrlTestCase::ProcessEnter()
     wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
                                           wxTestableFrame);
 
-    EventCounter count(m_text, wxEVT_COMMAND_TEXT_ENTER);
+    EventCounter count(m_text, wxEVT_TEXT_ENTER);
 
     m_text->SetFocus();
 
@@ -304,7 +327,7 @@ void TextCtrlTestCase::ProcessEnter()
     sim.Char(WXK_RETURN);
     wxYield();
 
-    CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_ENTER));
+    CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_TEXT_ENTER));
 
     // we need a text control with wxTE_PROCESS_ENTER for this test
     delete m_text;
@@ -315,7 +338,7 @@ void TextCtrlTestCase::ProcessEnter()
     sim.Char(WXK_RETURN);
     wxYield();
 
-    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TEXT_ENTER));
+    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_TEXT_ENTER));
 #endif
 }
 #endif
@@ -326,7 +349,7 @@ void TextCtrlTestCase::Url()
     delete m_text;
     CreateText(wxTE_RICH | wxTE_AUTO_URL);
 
-    EventCounter url(m_text, wxEVT_COMMAND_TEXT_URL);
+    EventCounter url(m_text, wxEVT_TEXT_URL);
 
     m_text->AppendText("http://www.wxwidgets.org");