From b7320101386483d26c95c2e3320fc3df2b868570 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 9 Dec 2022 00:36:11 +0100 Subject: [PATCH] Add a simple way to test loading arbitrary XML files This test is disabled by default but can be run explicitly to check if loading the given XML file works. See #23026. --- tests/xml/xmltest.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/xml/xmltest.cpp b/tests/xml/xmltest.cpp index b12f9b6efe..8b83e5685a 100644 --- a/tests/xml/xmltest.cpp +++ b/tests/xml/xmltest.cpp @@ -608,3 +608,20 @@ void XmlTestCase::Doctype() dt = wxXmlDoctype( "root", "O'Reilly (\"editor\")", "Public-ID" ); CPPUNIT_ASSERT( !dt.IsValid() ); } + +// This test is disabled by default as it requires the environment variable +// below to be defined to point to a XML file to load. +TEST_CASE("XML::Load", "[xml][.]") +{ + wxString file; + REQUIRE( wxGetEnv("WX_TEST_XML_FILE", &file) ); + + wxXmlDocument doc; + REQUIRE( doc.Load(file) ); + CHECK( doc.IsOk() ); + + wxStringOutputStream sos; + REQUIRE( doc.Save(sos) ); + + WARN("Dump of " << file << ":\n" << sos.GetString()); +}