Removes the text starting at the first given position up to
(but not including) the character at the last position.
+ This function puts the current insertion point position at @a to as a
+ side effect.
+
@param from
The first position.
@param to
Replaces the text starting at the first position up to
(but not including) the character at the last position with the given text.
+ This function puts the current insertion point position at @a to as a
+ side effect.
+
@param from
The first position.
@param to
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());
+}
+
CPPUNIT_TEST( SetValue ); \
CPPUNIT_TEST( TextChangeEvents ); \
CPPUNIT_TEST( Selection ); \
- CPPUNIT_TEST( InsertionPoint )
+ CPPUNIT_TEST( InsertionPoint ); \
+ CPPUNIT_TEST( Replace )
void SetValue();
void TextChangeEvents();
void Selection();
void InsertionPoint();
+ void Replace();
private:
// Selection() test helper: verify that selection is as described by the