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.
This commit is contained in:
Vadim Zeitlin 2022-12-09 00:36:11 +01:00
parent 4b2e6a5a4c
commit b732010138

View file

@ -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());
}