]> git.saurik.com Git - wxWidgets.git/commitdiff
added a test for white space after CDATA (see #10552)
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 21 Jul 2009 11:26:01 +0000 (11:26 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 21 Jul 2009 11:26:01 +0000 (11:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/xml/xmltest.cpp

index 6d7faeb3c84ef8b2b2d9d91100bac8c504b6548e..d8cda12b03896d59a834f54a31a79654e9c9e835 100644 (file)
@@ -75,11 +75,13 @@ private:
         CPPUNIT_TEST( InsertChild );
         CPPUNIT_TEST( InsertChildAfter );
         CPPUNIT_TEST( LoadSave );
+        CPPUNIT_TEST( CDATA );
     CPPUNIT_TEST_SUITE_END();
 
     void InsertChild();
     void InsertChildAfter();
     void LoadSave();
+    void CDATA();
 
     DECLARE_NO_COPY_CLASS(XmlTestCase)
 };
@@ -189,3 +191,26 @@ void XmlTestCase::LoadSave()
                           wxString(sos8.GetString().ToUTF8()) );
 }
 
+void XmlTestCase::CDATA()
+{
+    const char *xmlText =
+        "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n"
+        "<name>\n"
+        "  <![CDATA[Giovanni Mittone]]>\n"
+        "</name>\n"
+    ;
+
+    wxStringInputStream sis(xmlText);
+    wxXmlDocument doc;
+    CPPUNIT_ASSERT( doc.Load(sis) );
+
+    wxXmlNode *n = doc.GetRoot();
+    CPPUNIT_ASSERT( n );
+
+    n = n->GetChildren();
+    CPPUNIT_ASSERT( n );
+
+    // currently leading white space is stripped by trailing is preserved (see
+    // #10552)
+    CPPUNIT_ASSERT_EQUAL( "Giovanni Mittone\n", n->GetContent() );
+}