]> git.saurik.com Git - wxWidgets.git/commitdiff
only run tests using multiline strings with multiline text control; document that...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 14 Apr 2009 13:22:09 +0000 (13:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 14 Apr 2009 13:22:09 +0000 (13:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

interface/wx/textctrl.h
tests/controls/textctrltest.cpp
tests/controls/textentrytest.cpp

index c4a470e1d80e4c67e1ad9b8385cf1da107940ca1..a8178169ea2bb895cc5d41f640ce2e2714cadce7 100644 (file)
@@ -863,7 +863,9 @@ public:
            instead. For the control created with this style, you can still use
            Ctrl-Enter to pass to the next control from the keyboard.
     @style{wxTE_MULTILINE}
-           The text control allows multiple lines.
+           The text control allows multiple lines. If this style is not
+           specified, line break characters should not be used in the controls
+           value.
     @style{wxTE_PASSWORD}
            The text will be echoed as asterisks.
     @style{wxTE_READONLY}
index afc923afa799729726c0fc67f28442bc61eae94e..5f2cc77f4e6a6bbb955aea5a2bb6fbefa813558c 100644 (file)
@@ -42,8 +42,11 @@ private:
 
     CPPUNIT_TEST_SUITE( TextCtrlTestCase );
         wxTEXT_ENTRY_TESTS();
+        CPPUNIT_TEST( MultiLineReplace );
     CPPUNIT_TEST_SUITE_END();
 
+    void MultiLineReplace();
+
     wxTextCtrl *m_text;
 
     DECLARE_NO_COPY_CLASS(TextCtrlTestCase)
@@ -74,3 +77,27 @@ void TextCtrlTestCase::tearDown()
 // tests themselves
 // ----------------------------------------------------------------------------
 
+void TextCtrlTestCase::MultiLineReplace()
+{
+    // we need a multiline control for this test so recreate it
+    delete m_text;
+    m_text = new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY, "",
+                            wxDefaultPosition, wxDefaultSize,
+                            wxTE_MULTILINE);
+
+    m_text->SetValue("Hello replace\n"
+                    "0123456789012");
+    m_text->SetInsertionPoint(0);
+
+    m_text->Replace(6, 13, "changed");
+
+    CPPUNIT_ASSERT_EQUAL("Hello changed\n"
+                         "0123456789012",
+                         m_text->GetValue());
+    CPPUNIT_ASSERT_EQUAL(13, m_text->GetInsertionPoint());
+
+    m_text->Replace(13, -1, "");
+    CPPUNIT_ASSERT_EQUAL("Hello changed", m_text->GetValue());
+    CPPUNIT_ASSERT_EQUAL(13, m_text->GetInsertionPoint());
+}
+
index 70cc1f77ba658bcfcde070dfc4fa5c7b7d6b9d32..fcd911cf8ce2476e659fd3ce5be99aa31f53e946 100644 (file)
@@ -174,13 +174,13 @@ void TextEntryTestCase::Replace()
 {
     wxTextEntry * const entry = GetTestEntry();
 
-    entry->SetValue("Hello replace\n"
+    entry->SetValue("Hello replace!"
                     "0123456789012");
     entry->SetInsertionPoint(0);
 
     entry->Replace(6, 13, "changed");
 
-    CPPUNIT_ASSERT_EQUAL("Hello changed\n"
+    CPPUNIT_ASSERT_EQUAL("Hello changed!"
                          "0123456789012",
                          entry->GetValue());
     CPPUNIT_ASSERT_EQUAL(13, entry->GetInsertionPoint());