]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/textentrytest.cpp
return URLs, not filenames, from wxFileSystem::FindFirst/FindNext() for the file...
[wxWidgets.git] / tests / controls / textentrytest.cpp
index 03adf476800945f205ff26db2b577cd3b1d130fe..70cc1f77ba658bcfcde070dfc4fa5c7b7d6b9d32 100644 (file)
@@ -36,7 +36,7 @@ void TextEntryTestCase::SetValue()
     CPPUNIT_ASSERT_EQUAL( "bye", entry->GetValue() );
 }
 
-void TextEntryTestCase::TextChangeEvents()
+namespace
 {
     class TextTestEventHandler : public wxEvtHandler
     {
@@ -55,7 +55,12 @@ void TextEntryTestCase::TextChangeEvents()
 
     private:
         int m_events;
-    } handler;
+    };
+}
+
+void TextEntryTestCase::TextChangeEvents()
+{
+    TextTestEventHandler handler;
 
     GetTestWindow()->Connect
                      (
@@ -165,3 +170,27 @@ void TextEntryTestCase::InsertionPoint()
     CPPUNIT_ASSERT_EQUAL( 1, entry->GetInsertionPoint() );
 }
 
+void TextEntryTestCase::Replace()
+{
+    wxTextEntry * const entry = GetTestEntry();
+
+    entry->SetValue("Hello replace\n"
+                    "0123456789012");
+    entry->SetInsertionPoint(0);
+
+    entry->Replace(6, 13, "changed");
+
+    CPPUNIT_ASSERT_EQUAL("Hello changed\n"
+                         "0123456789012",
+                         entry->GetValue());
+    CPPUNIT_ASSERT_EQUAL(13, entry->GetInsertionPoint());
+
+    entry->Replace(13, -1, "");
+    CPPUNIT_ASSERT_EQUAL("Hello changed", entry->GetValue());
+    CPPUNIT_ASSERT_EQUAL(13, entry->GetInsertionPoint());
+
+    entry->Replace(0, 6, "Un");
+    CPPUNIT_ASSERT_EQUAL("Unchanged", entry->GetValue());
+    CPPUNIT_ASSERT_EQUAL(2, entry->GetInsertionPoint());
+}
+