summaryrefslogtreecommitdiffstats
path: root/tests/auto/installer/environmentvariableoperation
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/installer/environmentvariableoperation')
-rw-r--r--tests/auto/installer/environmentvariableoperation/data/xmloperationrepository/Updates.xml25
-rw-r--r--tests/auto/installer/environmentvariableoperation/settings.qrc1
-rw-r--r--tests/auto/installer/environmentvariableoperation/tst_environmentvariableoperation.cpp54
3 files changed, 58 insertions, 22 deletions
diff --git a/tests/auto/installer/environmentvariableoperation/data/xmloperationrepository/Updates.xml b/tests/auto/installer/environmentvariableoperation/data/xmloperationrepository/Updates.xml
new file mode 100644
index 000000000..9c33caf6d
--- /dev/null
+++ b/tests/auto/installer/environmentvariableoperation/data/xmloperationrepository/Updates.xml
@@ -0,0 +1,25 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>false</Checksum>
+ <PackageUpdate>
+ <Name>A</Name>
+ <DisplayName>A</DisplayName>
+ <Description>Example component A</Description>
+ <Version>1.0.2-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <Operations>
+ <Operation name="EnvironmentVariable">
+ <Argument>IFW_UNIT_TEST_LOCAL</Argument>
+ <Argument>IFW_UNIT_TEST_VALUE</Argument>
+ <Argument>false</Argument>
+ </Operation>
+ <Operation name="EnvironmentVariable">
+ <Argument>IFW_UNIT_TEST_PERSISTENT</Argument>
+ <Argument>IFW_UNIT_TEST_PERSISTENT_VALUE</Argument>
+ <Argument>true</Argument>
+ </Operation>
+ </Operations>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/environmentvariableoperation/settings.qrc b/tests/auto/installer/environmentvariableoperation/settings.qrc
index d030220ab..04a7daf71 100644
--- a/tests/auto/installer/environmentvariableoperation/settings.qrc
+++ b/tests/auto/installer/environmentvariableoperation/settings.qrc
@@ -2,5 +2,6 @@
<qresource prefix="/">
<file>data/repository/Updates.xml</file>
<file>data/repository/A/1.0.2-1meta.7z</file>
+ <file>data/xmloperationrepository/Updates.xml</file>
</qresource>
</RCC>
diff --git a/tests/auto/installer/environmentvariableoperation/tst_environmentvariableoperation.cpp b/tests/auto/installer/environmentvariableoperation/tst_environmentvariableoperation.cpp
index 6cddad2e5..d0ded4c58 100644
--- a/tests/auto/installer/environmentvariableoperation/tst_environmentvariableoperation.cpp
+++ b/tests/auto/installer/environmentvariableoperation/tst_environmentvariableoperation.cpp
@@ -42,6 +42,32 @@ class tst_environmentvariableoperation : public QObject
{
Q_OBJECT
+private:
+ void installFromCLI(const QString &repository)
+ {
+ QString installDir = QInstaller::generateTemporaryFileName();
+ QVERIFY(QDir().mkpath(installDir));
+ PackageManagerCore *core = PackageManager::getPackageManagerWithInit
+ (installDir, repository);
+ core->installDefaultComponentsSilently();
+
+ QVERIFY(m_settings->value("IFW_UNIT_TEST_LOCAL").toString().isEmpty());
+
+ // Persistent is in settings in Windows platform only, otherwise it is written to local env.
+#ifdef Q_OS_WIN
+ QCOMPARE(m_settings->value("IFW_UNIT_TEST_PERSISTENT").toString(), QLatin1String("IFW_UNIT_TEST_PERSISTENT_VALUE"));
+#else
+ QCOMPARE(Environment::instance().value("IFW_UNIT_TEST_PERSISTENT"), QLatin1String("IFW_UNIT_TEST_PERSISTENT_VALUE"));
+#endif
+ QCOMPARE(Environment::instance().value("IFW_UNIT_TEST_LOCAL"), QLatin1String("IFW_UNIT_TEST_VALUE"));
+
+ core->commitSessionOperations();
+ core->setPackageManager();
+ core->uninstallComponentsSilently(QStringList() << "A");
+ QVERIFY(m_settings->value("IFW_UNIT_TEST_PERSISTENT").toString().isEmpty());
+ QVERIFY(Environment::instance().value("IFW_UNIT_TEST_LOCAL").isEmpty());
+ }
+
private slots:
void initTestCase()
{
@@ -135,30 +161,14 @@ private slots:
QCOMPARE(m_oldValue, Environment::instance().value(m_key));
}
- void testPerformingFromCLI()
+ void testEnvVariableFromScript()
{
- QString installDir = QInstaller::generateTemporaryFileName();
- QVERIFY(QDir().mkpath(installDir));
- PackageManagerCore *core = PackageManager::getPackageManagerWithInit
- (installDir, ":///data/repository");
- core->installDefaultComponentsSilently();
-
- QVERIFY(m_settings->value("IFW_UNIT_TEST_LOCAL").toString().isEmpty());
-
- // Persistent is in settings in Windows platform only, otherwise it is written to local env.
-#ifdef Q_OS_WIN
- QCOMPARE(QLatin1String("IFW_UNIT_TEST_PERSISTENT_VALUE"), m_settings->value("IFW_UNIT_TEST_PERSISTENT").toString());
-#else
- QCOMPARE(QLatin1String("IFW_UNIT_TEST_PERSISTENT_VALUE"), Environment::instance().value("IFW_UNIT_TEST_PERSISTENT"));
-#endif
- QCOMPARE(QLatin1String("IFW_UNIT_TEST_VALUE"), Environment::instance().value("IFW_UNIT_TEST_LOCAL"));
+ installFromCLI(":///data/repository");
+ }
- core->commitSessionOperations();
- core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << "A");
- QVERIFY(m_settings->value("IFW_UNIT_TEST_PERSISTENT").toString().isEmpty());
- QVERIFY(Environment::instance().value("IFW_UNIT_TEST_LOCAL").isEmpty());
- core->deleteLater();
+ void testEnvVariableFromSXML()
+ {
+ installFromCLI(":///data/xmloperationrepository");
}
private: