X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f0f6a32d4d276dd09ecf34cf60d435d2687731f9..32cdc45397d8c0a24735f84e1dcf83bba1980f2d:/tests/controls/textctrltest.cpp diff --git a/tests/controls/textctrltest.cpp b/tests/controls/textctrltest.cpp index afc923afa7..5f2cc77f4e 100644 --- a/tests/controls/textctrltest.cpp +++ b/tests/controls/textctrltest.cpp @@ -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()); +} +