+
+ entry->SetValue("something different"); // should still reset the caret
+ CPPUNIT_ASSERT_EQUAL( 0, entry->GetInsertionPoint() );
+}
+
+void TextEntryTestCase::Replace()
+{
+ wxTextEntry * const entry = GetTestEntry();
+
+ entry->SetValue("Hello replace!"
+ "0123456789012");
+ entry->SetInsertionPoint(0);
+
+ entry->Replace(6, 13, "changed");
+
+ CPPUNIT_ASSERT_EQUAL("Hello changed!"
+ "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());
+}
+
+void TextEntryTestCase::Editable()
+{
+#if wxUSE_UIACTIONSIMULATOR
+ wxTextEntry * const entry = GetTestEntry();
+ wxWindow * const window = GetTestWindow();
+
+ EventCounter updated(window, wxEVT_COMMAND_TEXT_UPDATED);
+
+ window->SetFocus();
+ wxYield();
+
+ wxUIActionSimulator sim;
+ sim.Text("abcdef");
+ wxYield();
+
+ CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
+ CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
+
+ updated.Clear();
+
+ entry->SetEditable(false);
+ sim.Text("gh");
+ wxYield();
+
+ CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
+ CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
+#endif
+}
+
+void TextEntryTestCase::Hint()
+{
+ GetTestEntry()->SetHint("This is a hint");
+ CPPUNIT_ASSERT_EQUAL("", GetTestEntry()->GetValue());
+}
+
+void TextEntryTestCase::CopyPaste()
+{
+#ifndef __WXOSX__
+ wxTextEntry * const entry = GetTestEntry();
+
+ entry->AppendText("sometext");
+ entry->SelectAll();
+
+ if(entry->CanCopy() && entry->CanPaste())
+ {
+ entry->Copy();
+ entry->Clear();
+ CPPUNIT_ASSERT(entry->IsEmpty());
+
+ wxYield();
+
+ entry->Paste();
+ CPPUNIT_ASSERT_EQUAL("sometext", entry->GetValue());
+ }
+#endif