summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNiels Weber <niels.weber@digia.com>2014-11-11 09:32:20 +0100
committerNiels Weber <niels.weber@digia.com>2014-11-17 16:18:17 +0100
commit778af9e97d5652c84e027b3e3ccad62122fc92b6 (patch)
tree69f2508a9288c5fb57f8f91f0736cd9c0109256a /tests
parent32296ab72fd1fc6d460aef00dab74b14cb4120e9 (diff)
Allow spaces in RunProgramArguments
This changes the syntax of the RunProgramArguments entry in the config.xml. <Argument> sub tags need to be used to specify the RunProgramArguments now. Task-number: QTIFW-227 Change-Id: Ife007bf660cdcf4ff5e8e31bb9bb5ac2e5037616 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/settings/data/unexpectedattribute_config.xml8
-rw-r--r--tests/auto/installer/settings/data/unexpectedtag_config.xml8
-rw-r--r--tests/auto/installer/settings/settings.qrc2
-rw-r--r--tests/auto/installer/settings/tst_settings.cpp40
4 files changed, 57 insertions, 1 deletions
diff --git a/tests/auto/installer/settings/data/unexpectedattribute_config.xml b/tests/auto/installer/settings/data/unexpectedattribute_config.xml
new file mode 100644
index 000000000..67cbb4eea
--- /dev/null
+++ b/tests/auto/installer/settings/data/unexpectedattribute_config.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Installer>
+ <Name>Your application</Name>
+ <Version>1.2.3</Version>
+ <RunProgramArguments>
+ <Argument foo="bar">Test</Argument>
+ </RunProgramArguments>
+</Installer>
diff --git a/tests/auto/installer/settings/data/unexpectedtag_config.xml b/tests/auto/installer/settings/data/unexpectedtag_config.xml
new file mode 100644
index 000000000..f8bc87b60
--- /dev/null
+++ b/tests/auto/installer/settings/data/unexpectedtag_config.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Installer>
+ <Name>Your application</Name>
+ <Version>1.2.3</Version>
+ <RunProgramArguments>
+ <Foo>Bar</Foo>
+ </RunProgramArguments>
+</Installer>
diff --git a/tests/auto/installer/settings/settings.qrc b/tests/auto/installer/settings/settings.qrc
index 2dbffd927..c86847993 100644
--- a/tests/auto/installer/settings/settings.qrc
+++ b/tests/auto/installer/settings/settings.qrc
@@ -7,5 +7,7 @@
<file>data/tutorial_config.xml</file>
<file>data/unknown_element_config.xml</file>
<file>data/minimal_config_tag_defaults.xml</file>
+ <file>data/unexpectedtag_config.xml</file>
+ <file>data/unexpectedattribute_config.xml</file>
</qresource>
</RCC>
diff --git a/tests/auto/installer/settings/tst_settings.cpp b/tests/auto/installer/settings/tst_settings.cpp
index 6567df11f..54d6dc66e 100644
--- a/tests/auto/installer/settings/tst_settings.cpp
+++ b/tests/auto/installer/settings/tst_settings.cpp
@@ -21,6 +21,8 @@ private slots:
void loadUnknownElementConfigInStrictParseMode();
void loadUnknownElementConfigInRelaxedParseMode();
void loadMinimalConfigTagDefaults();
+ void loadUnexpectedAttributeConfig();
+ void loadUnexpectedTagConfig();
};
void tst_Settings::loadTutorialConfig()
@@ -57,7 +59,7 @@ void tst_Settings::loadTutorialConfig()
QCOMPARE(settings.wizardStyle(), QString());
QCOMPARE(settings.titleColor(), QString());
QCOMPARE(settings.runProgram(), QString());
- QCOMPARE(settings.runProgramArguments(), QString());
+ QCOMPARE(settings.runProgramArguments(), QStringList());
QCOMPARE(settings.runProgramDescription(), QString());
QCOMPARE(settings.adminTargetDir(), QString());
QCOMPARE(settings.removeTargetDir(), QLatin1String("true"));
@@ -169,6 +171,42 @@ void tst_Settings::loadMinimalConfigTagDefaults()
QCOMPARE(settings.maintenanceToolIniFile(), QLatin1String("maintenancetool.ini"));
}
+void tst_Settings::loadUnexpectedAttributeConfig()
+{
+ QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Error in "
+ ":///data/unexpectedattribute_config.xml, line 6, column 27: Unexpected attribute "
+ "for element 'Argument'.\" ");
+
+ try {
+ Settings::fromFileAndPrefix(":///data/unexpectedattribute_config.xml", ":///data");
+ } catch (const Error &error) {
+ QCOMPARE(error.message(), QLatin1String("Error in :///data/unexpectedattribute_config.xml,"
+ " line 6, column 27: Unexpected attribute for element 'Argument'."));
+ return;
+ }
+ QFAIL("No exception thrown");
+
+ return;
+}
+
+void tst_Settings::loadUnexpectedTagConfig()
+{
+ QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Error in "
+ ":///data/unexpectedtag_config.xml, line 6, column 12: Unexpected element 'Foo'.\" ");
+
+ try {
+ Settings::fromFileAndPrefix(":///data/unexpectedtag_config.xml", ":///data");
+ } catch (const Error &error) {
+ QCOMPARE(error.message(), QLatin1String("Error in :///data/unexpectedtag_config.xml,"
+ " line 6, column 12: Unexpected element 'Foo'."));
+ return;
+ }
+ QFAIL("No exception thrown");
+
+ return;
+}
+
+
QTEST_MAIN(tst_Settings)
#include "tst_settings.moc"