]>
git.saurik.com Git - wxWidgets.git/blob - tests/html/htmlwindow.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/html/htmlwindow.cpp
3 // Purpose: wxHtmlWindow tests
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2008 Vaclav Slavik <vslavik@fastmail.fm>
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
24 #include "wx/html/htmlwin.h"
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
30 class HtmlWindowTestCase
: public CppUnit::TestCase
33 HtmlWindowTestCase() { }
36 virtual void tearDown();
39 CPPUNIT_TEST_SUITE( HtmlWindowTestCase
);
40 CPPUNIT_TEST( SelectionToText
);
41 CPPUNIT_TEST_SUITE_END();
43 void SelectionToText();
47 DECLARE_NO_COPY_CLASS(HtmlWindowTestCase
)
50 // register in the unnamed registry so that these tests are run by default
51 CPPUNIT_TEST_SUITE_REGISTRATION( HtmlWindowTestCase
);
53 // also include in it's own registry so that these tests can be run alone
54 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HtmlWindowTestCase
, "HtmlWindowTestCase" );
56 // ----------------------------------------------------------------------------
57 // test initialization
58 // ----------------------------------------------------------------------------
60 void HtmlWindowTestCase::setUp()
62 m_win
= new wxHtmlWindow(wxTheApp
->GetTopWindow(), wxID_ANY
);
65 void HtmlWindowTestCase::tearDown()
71 // ----------------------------------------------------------------------------
73 // ----------------------------------------------------------------------------
75 static const char *TEST_MARKUP
=
82 static const char *TEST_PLAIN_TEXT
=
83 "Title\nA longer line\nand the last line.";
85 void HtmlWindowTestCase::SelectionToText()
87 m_win
->SetPage(TEST_MARKUP
);
90 CPPUNIT_ASSERT_EQUAL( TEST_PLAIN_TEXT
, m_win
->SelectionToText() );