-void TextCtrlTestCase::AssertSelection(int from, int to, const char *sel)
-{
- CPPUNIT_ASSERT( m_text->HasSelection() );
-
- long fromReal,
- toReal;
- m_text->GetSelection(&fromReal, &toReal);
- CPPUNIT_ASSERT_EQUAL( from, fromReal );
- CPPUNIT_ASSERT_EQUAL( to, toReal );
- CPPUNIT_ASSERT_EQUAL( sel, m_text->GetStringSelection() );
-
- CPPUNIT_ASSERT_EQUAL( from, m_text->GetInsertionPoint() );
-}
-
-void TextCtrlTestCase::Selection()
-{
- m_text->SetValue("0123456789");
-
- m_text->SetSelection(2, 4);
- AssertSelection(2, 4, "23"); // not "234"!
-
- m_text->SetSelection(3, -1);
- AssertSelection(3, 10, "3456789");
-
- m_text->SelectAll();
- AssertSelection(0, 10, "0123456789");
-
- m_text->SetSelection(0, 0);
- CPPUNIT_ASSERT( !m_text->HasSelection() );
-}