]> git.saurik.com Git - wxWidgets.git/blob - tests/html/htmlparser.cpp
Don't link with QuickTime framework in 64 bit wxOSX builds.
[wxWidgets.git] / tests / html / htmlparser.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/html/htmlparser.cpp
3 // Purpose: wxHtmlParser tests
4 // Author: Vadim Zeitlin
5 // Created: 2011-01-13
6 // RCS-ID: $Id$
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 ///////////////////////////////////////////////////////////////////////////////
9
10 // ----------------------------------------------------------------------------
11 // headers
12 // ----------------------------------------------------------------------------
13
14 #include "testprec.h"
15
16 #if wxUSE_HTML
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #ifndef WX_PRECOMP
23 #endif // WX_PRECOMP
24
25 #include "wx/html/htmlpars.h"
26
27 // ----------------------------------------------------------------------------
28 // test class
29 // ----------------------------------------------------------------------------
30
31 class HtmlParserTestCase : public CppUnit::TestCase
32 {
33 public:
34 HtmlParserTestCase() { }
35
36 private:
37 CPPUNIT_TEST_SUITE( HtmlParserTestCase );
38 CPPUNIT_TEST( Invalid );
39 CPPUNIT_TEST_SUITE_END();
40
41 void Invalid();
42
43 wxDECLARE_NO_COPY_CLASS(HtmlParserTestCase);
44 };
45
46 // register in the unnamed registry so that these tests are run by default
47 CPPUNIT_TEST_SUITE_REGISTRATION( HtmlParserTestCase );
48
49 // also include in its own registry so that these tests can be run alone
50 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HtmlParserTestCase, "HtmlParserTestCase" );
51
52 // ----------------------------------------------------------------------------
53 // tests themselves
54 // ----------------------------------------------------------------------------
55
56 // Test that parsing invalid HTML simply fails but doesn't crash for example.
57 void HtmlParserTestCase::Invalid()
58 {
59 class NullParser : public wxHtmlParser
60 {
61 public:
62 virtual wxObject *GetProduct() { return NULL; }
63
64 protected:
65 virtual void AddText(const wxString& WXUNUSED(txt)) { }
66 };
67
68 NullParser p;
69 p.Parse("<");
70 p.Parse("<foo");
71 p.Parse("<!--");
72 p.Parse("<!---");
73 }
74
75 #endif //wxUSE_HTML