X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6f24b81707fe53df2e2458ea928e071712f3bc72..62795f413a7222863b4aee76c08764071f94bd87:/tests/xml/xmltest.cpp diff --git a/tests/xml/xmltest.cpp b/tests/xml/xmltest.cpp index 0deaa5fed3..8a824e7e4a 100644 --- a/tests/xml/xmltest.cpp +++ b/tests/xml/xmltest.cpp @@ -3,7 +3,6 @@ // Purpose: XML classes unit test // Author: Vaclav Slavik // Created: 2008-03-29 -// RCS-ID: $Id$ // Copyright: (c) 2008 Vaclav Slavik /////////////////////////////////////////////////////////////////////////////// @@ -82,6 +81,7 @@ private: CPPUNIT_TEST( DetachRoot ); CPPUNIT_TEST( AppendToProlog ); CPPUNIT_TEST( SetRoot ); + CPPUNIT_TEST( CopyNode ); CPPUNIT_TEST_SUITE_END(); void InsertChild(); @@ -93,6 +93,7 @@ private: void DetachRoot(); void AppendToProlog(); void SetRoot(); + void CopyNode(); DECLARE_NO_COPY_CLASS(XmlTestCase) }; @@ -100,7 +101,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( XmlTestCase ); -// 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( XmlTestCase, "XmlTestCase" ); void XmlTestCase::InsertChild() @@ -469,3 +470,40 @@ void XmlTestCase::SetRoot() doc.SetRoot(root); CPPUNIT_ASSERT( doc.IsOk() ); } + +void XmlTestCase::CopyNode() +{ + const char *xmlText = +"\n" +"\n" +" \n" +" \n" +"\n" + ; + wxXmlDocument doc; + wxStringInputStream sis(xmlText); + CPPUNIT_ASSERT( doc.Load(sis) ); + + wxXmlNode* const root = doc.GetRoot(); + CPPUNIT_ASSERT( root ); + + wxXmlNode* const first = root->GetChildren(); + CPPUNIT_ASSERT( first ); + + wxXmlNode* const second = first->GetNext(); + CPPUNIT_ASSERT( second ); + + *first = *second; + + wxStringOutputStream sos; + CPPUNIT_ASSERT( doc.Save(sos) ); + + const char *xmlTextResult = +"\n" +"\n" +" \n" +" \n" +"\n" + ; + CPPUNIT_ASSERT_EQUAL( xmlTextResult, sos.GetString() ); +}