X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e3778b4d9c7eebc39f496a9dd055638e06fb9140..11f1e38e26e948d3c675c4d780eecee1073c0f99:/tests/xml/xmltest.cpp diff --git a/tests/xml/xmltest.cpp b/tests/xml/xmltest.cpp index ee41451a38..ce807b607e 100644 --- a/tests/xml/xmltest.cpp +++ b/tests/xml/xmltest.cpp @@ -82,6 +82,7 @@ private: CPPUNIT_TEST( DetachRoot ); CPPUNIT_TEST( AppendToProlog ); CPPUNIT_TEST( SetRoot ); + CPPUNIT_TEST( CopyNode ); CPPUNIT_TEST_SUITE_END(); void InsertChild(); @@ -93,6 +94,7 @@ private: void DetachRoot(); void AppendToProlog(); void SetRoot(); + void CopyNode(); DECLARE_NO_COPY_CLASS(XmlTestCase) }; @@ -469,3 +471,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() ); +}