From e5790dba972172feba72c823cfa10685e3a19dc1 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Fri, 28 Jul 2017 17:54:38 +0300 Subject: [PATCH] Test nodes deletion via document --- xmltest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xmltest.cpp b/xmltest.cpp index 10c7dba..08af615 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -1756,6 +1756,24 @@ int main( int argc, const char ** argv ) doc.DeleteNode(pRoot); } + { + XMLDocument doc; + XMLElement* root = doc.NewElement( "Root" ); + XMLTest( "Node document before insertion", true, &doc == root->GetDocument() ); + doc.InsertEndChild( root ); + XMLTest( "Node document after insertion", true, &doc == root->GetDocument() ); + } + + { + // If this doesn't assert in DEBUG, all is well. + XMLDocument doc; + XMLElement* unlinkedRoot = doc.NewElement( "Root" ); + XMLElement* linkedRoot = doc.NewElement( "Root" ); + doc.InsertFirstChild( linkedRoot ); + unlinkedRoot->GetDocument()->DeleteNode( linkedRoot ); + unlinkedRoot->GetDocument()->DeleteNode( unlinkedRoot ); + } + { // Should not assert in DEBUG XMLPrinter printer;