Add support for retrieving the currently selected text. Implement on all backends, document and unit test.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-10 18:11:43 +00:00
parent 63a6507091
commit c9355a3df6
8 changed files with 71 additions and 6 deletions

View File

@@ -41,6 +41,7 @@ private:
CPPUNIT_TEST( HistoryClear );
CPPUNIT_TEST( HistoryList );
CPPUNIT_TEST( Editable );
CPPUNIT_TEST( Selection );
CPPUNIT_TEST_SUITE_END();
void Title();
@@ -50,6 +51,7 @@ private:
void HistoryClear();
void HistoryList();
void Editable();
void Selection();
void LoadUrl(const wxString& url, int times = 1);
wxWebView* m_browser;
@@ -181,4 +183,19 @@ void WebTestCase::Editable()
CPPUNIT_ASSERT(!m_browser->IsEditable());
}
void WebTestCase::Selection()
{
m_browser->SetPage("<html><body>Some text</body></html>", "");
CPPUNIT_ASSERT(!m_browser->HasSelection());
m_browser->SelectAll();
CPPUNIT_ASSERT(m_browser->HasSelection());
CPPUNIT_ASSERT_EQUAL("Some text", m_browser->GetSelectedText());
m_browser->DeleteSelection();
CPPUNIT_ASSERT(!m_browser->HasSelection());
}
#endif //wxUSE_WEB