diff options
Diffstat (limited to 'tests/auto')
4 files changed, 25 insertions, 9 deletions
diff --git a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp index 1d23e1970..c8b314657 100644 --- a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp +++ b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp @@ -2,6 +2,7 @@ #include "packagemanagercore.h" #include <QFileInfo> +#include <QString> #include <QTest> using namespace KDUpdater; diff --git a/tests/auto/installer/repository/tst_repository.cpp b/tests/auto/installer/repository/tst_repository.cpp index e3b7b74a6..380d9a9a2 100644 --- a/tests/auto/installer/repository/tst_repository.cpp +++ b/tests/auto/installer/repository/tst_repository.cpp @@ -1,5 +1,6 @@ #include "repository.h" +#include <QString> #include <QTest> using namespace QInstaller; 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 cf61e0c9d..8db9edb11 100644 --- a/tests/auto/installer/settings/tst_settings.cpp +++ b/tests/auto/installer/settings/tst_settings.cpp @@ -1,9 +1,10 @@ -#include <QTest> #include "settings.h" #include "errors.h" #include "repository.h" #include <QFile> +#include <QString> +#include <QTest> using namespace QInstaller; @@ -17,13 +18,13 @@ private slots: void loadEmptyConfig(); void loadNotExistingConfig(); void loadMalformedConfig(); - void loadUnknownElementConfig(); + void loadUnknownElementConfigInStrictParseMode(); + void loadUnknownElementConfigInRelaxedParseMode(); }; void tst_Settings::loadTutorialConfig() { - Settings settings = - Settings::fromFileAndPrefix(":///data/tutorial_config.xml", ":///data"); + Settings settings = Settings::fromFileAndPrefix(":///data/tutorial_config.xml", ":///data"); // specified values QCOMPARE(settings.applicationName(), QLatin1String("Your application")); @@ -80,8 +81,7 @@ void tst_Settings::loadTutorialConfig() void tst_Settings::loadFullConfig() { QTest::ignoreMessage(QtWarningMsg, "Deprecated element 'Icon'. "); - Settings settings = - Settings::fromFileAndPrefix(":///data/full_config.xml", ":///data"); + Settings settings = Settings::fromFileAndPrefix(":///data/full_config.xml", ":///data"); } void tst_Settings::loadEmptyConfig() @@ -127,10 +127,10 @@ 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'.\" "); + QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Error in :/data/unknown_element_config.xml, " + "line 5, column 13: Unexpected element 'unknown'.\" "); try { Settings::fromFileAndPrefix(":/data/unknown_element_config.xml", ":/data"); } catch (const Error &error) { @@ -141,6 +141,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 TolerantParseMode: %1").arg(error.message()))); + } +} + QTEST_MAIN(tst_Settings) #include "tst_settings.moc" |