diff options
author | kh1 <karsten.heimrich@digia.com> | 2013-03-26 13:10:09 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2013-03-26 13:21:01 +0100 |
commit | e29ef32ec02e01d51065962e0b0f88c70121b3de (patch) | |
tree | b6e741e56acd46567fa59c4fe0f8c6edd9a7a1d1 /tests | |
parent | 2774e4fd95a6e8d6777fab1e708bf04aa6055c39 (diff) |
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/installer/settings/data/unknown_element_config.xml | 1 | ||||
-rw-r--r-- | tests/auto/installer/settings/tst_settings.cpp | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/auto/installer/settings/data/unknown_element_config.xml b/tests/auto/installer/settings/data/unknown_element_config.xml index 0d97564e6..ee9e0ef1a 100644 --- a/tests/auto/installer/settings/data/unknown_element_config.xml +++ b/tests/auto/installer/settings/data/unknown_element_config.xml @@ -3,4 +3,5 @@ <Name>Your application</Name> <Version>1.2.3</Version> <unknown></unknown> + <Title>Your application Installer</Title> </Installer> diff --git a/tests/auto/installer/settings/tst_settings.cpp b/tests/auto/installer/settings/tst_settings.cpp index 1cc0fef00..be2643ec2 100644 --- a/tests/auto/installer/settings/tst_settings.cpp +++ b/tests/auto/installer/settings/tst_settings.cpp @@ -17,7 +17,8 @@ private slots: void loadEmptyConfig(); void loadNotExistingConfig(); void loadMalformedConfig(); - void loadUnknownElementConfig(); + void loadUnknownElementConfigInStrictParseMode(); + void loadUnknownElementConfigInRelaxedParseMode(); }; void tst_Settings::loadTutorialConfig() @@ -119,7 +120,7 @@ void tst_Settings::loadMalformedConfig() QFAIL("No exception thrown"); } -void tst_Settings::loadUnknownElementConfig() +void tst_Settings::loadUnknownElementConfigInStrictParseMode() { QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Error in :/data/unknown_element_config.xml, line 5, " "column 13: Unexpected element 'unknown'.\" "); @@ -133,6 +134,19 @@ void tst_Settings::loadUnknownElementConfig() QFAIL("No exception thrown"); } +void tst_Settings::loadUnknownElementConfigInRelaxedParseMode() +{ + QTest::ignoreMessage(QtWarningMsg, "\"Ignoring following settings reader error in " + ":/data/unknown_element_config.xml, line 5, column 13: \" "); + try { + Settings settings = Settings::fromFileAndPrefix(":/data/unknown_element_config.xml", ":/data", + Settings::RelaxedParseMode); + QCOMPARE(settings.title(), QLatin1String("Your application Installer")); + } catch (const Error &error) { + QFAIL(qPrintable(QString::fromLatin1("Got an exception in FaultTolerantParseMode: %1").arg(error.message()))); + } +} + QTEST_MAIN(tst_Settings) #include "tst_settings.moc" |