Add a test for WriteText and fix implementation in wxQt
This commit is contained in:
committed by
Vadim Zeitlin
parent
3618356cf1
commit
4c05b3650a
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user