diff --git a/tests/controls/textentrytest.cpp b/tests/controls/textentrytest.cpp index 9c1dbe7d95..b053e80489 100644 --- a/tests/controls/textentrytest.cpp +++ b/tests/controls/textentrytest.cpp @@ -201,6 +201,28 @@ void TextEntryTestCase::Replace() CPPUNIT_ASSERT_EQUAL(2, entry->GetInsertionPoint()); } +void TextEntryTestCase::WriteText() +{ + wxTextEntry * const entry = GetTestEntry(); + + entry->SetValue("foo"); + entry->SetInsertionPoint(3); + entry->WriteText("bar"); + CPPUNIT_ASSERT_EQUAL( "foobar", entry->GetValue() ); + + entry->SetValue("foo"); + entry->SetInsertionPoint(0); + entry->WriteText("bar"); + CPPUNIT_ASSERT_EQUAL( "barfoo", entry->GetValue() ); + + entry->SetValue("abxxxhi"); + entry->SetSelection(2, 5); + entry->WriteText("cdefg"); + CPPUNIT_ASSERT_EQUAL( "abcdefghi", entry->GetValue() ); + CPPUNIT_ASSERT_EQUAL( 7, entry->GetInsertionPoint() ); + CPPUNIT_ASSERT_EQUAL( false, entry->HasSelection() ); +} + #if wxUSE_UIACTIONSIMULATOR class TextEventHandler diff --git a/tests/controls/textentrytest.h b/tests/controls/textentrytest.h index 648d601872..fc784c9d6f 100644 --- a/tests/controls/textentrytest.h +++ b/tests/controls/textentrytest.h @@ -44,7 +44,8 @@ protected: WXUISIM_TEST( Editable ); \ CPPUNIT_TEST( Hint ); \ CPPUNIT_TEST( CopyPaste ); \ - CPPUNIT_TEST( UndoRedo ) + CPPUNIT_TEST( UndoRedo ); \ + CPPUNIT_TEST( WriteText ) void SetValue(); void TextChangeEvents(); @@ -55,6 +56,7 @@ protected: void Hint(); void CopyPaste(); void UndoRedo(); + void WriteText(); private: // Selection() test helper: verify that selection is as described by the