X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9bb9964e261781d575353864cc027b3ca8ba445e..e1efca652844273c3e8d32c7e5f442b87e455ca7:/tests/controls/markuptest.cpp?ds=sidebyside diff --git a/tests/controls/markuptest.cpp b/tests/controls/markuptest.cpp index 789598b946..c13c38d673 100644 --- a/tests/controls/markuptest.cpp +++ b/tests/controls/markuptest.cpp @@ -27,10 +27,12 @@ private: CPPUNIT_TEST_SUITE( MarkupTestCase ); CPPUNIT_TEST( RoundTrip ); CPPUNIT_TEST( Quote ); + CPPUNIT_TEST( Strip ); CPPUNIT_TEST_SUITE_END(); void RoundTrip(); void Quote(); + void Strip(); wxDECLARE_NO_COPY_CLASS(MarkupTestCase); }; @@ -38,7 +40,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( MarkupTestCase ); -// also include in it's own registry so that these tests can be run alone +// also include in its own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MarkupTestCase, "MarkupTestCase" ); void MarkupTestCase::RoundTrip() @@ -84,13 +86,13 @@ void MarkupTestCase::RoundTrip() m_text << "bar" ); CHECK_PARSES_OK( "123456" ); - CHECK_PARSES_OK( "first second last" ); - CHECK_PARSES_OK( "first second last" ); - CHECK_PARSES_OK( "10pt" ); - CHECK_PARSES_OK( "much smaller" ); - CHECK_PARSES_OK( "larger" ); + CHECK_PARSES_OK( "first second last" ); + CHECK_PARSES_OK( "first second last" ); + CHECK_PARSES_OK( "10pt" ); + CHECK_PARSES_OK( "much smaller" ); + CHECK_PARSES_OK( "larger" ); CHECK_PARSES_OK ( - "Please notice: any " - "bugs in this code are NOT allowed." + "Please notice: any " + "bugs in this code are NOT allowed." ); CHECK_PARSES_OK( "foo&bar" ); @@ -196,3 +198,23 @@ void MarkupTestCase::Quote() CPPUNIT_ASSERT_EQUAL( "B&B", wxMarkupParser::Quote("B&B") ); CPPUNIT_ASSERT_EQUAL( """", wxMarkupParser::Quote("\"\"") ); } + +void MarkupTestCase::Strip() +{ + #define CHECK_STRIP( text, stripped ) \ + CPPUNIT_ASSERT_EQUAL( stripped, wxMarkupParser::Strip(text) ) + + CHECK_STRIP( "", "" ); + CHECK_STRIP( "foo", "foo" ); + CHECK_STRIP( "<foo>", "" ); + CHECK_STRIP( "Big problem", "Big problem" ); + CHECK_STRIP( "c" + "o" + "l" + "o" + "u" + "r", + "colour" ); + + #undef CHECK_STRIP +}