summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2020-03-30 16:42:21 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2020-04-07 15:43:00 +0300
commit21aef7e78341b1931ca029dda5e5118172bdaafa (patch)
treeece1e5c3900cca1fa300fb9447ea0df11054b874 /tests
parentd3021e3cc23b7df322bf9dd7f80df5bbde7cc166 (diff)
Remove existing installation from command line
Add new "purge" command to command line interface. This removes all components and all program directory contents. Add test function to unit tests. Task-number: QTIFW-1574 Change-Id: Iccd4a052c7e2fc8eec0a6ae2b5a93c0c607604cb Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/cliinterface/tst_cliinterface.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/installer/cliinterface/tst_cliinterface.cpp b/tests/auto/installer/cliinterface/tst_cliinterface.cpp
index 527d8295e..c38e0c850 100644
--- a/tests/auto/installer/cliinterface/tst_cliinterface.cpp
+++ b/tests/auto/installer/cliinterface/tst_cliinterface.cpp
@@ -206,6 +206,30 @@ private slots:
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentE.txt");
}
+ void testRemoveAllSilently()
+ {
+ QInstaller::init(); //This will eat debug output
+ PackageManagerCore &core = initPackagemanager(":///data/installPackagesRepository");
+ core.installSelectedComponentsSilently(QStringList() << QLatin1String("componentA"));
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentE.txt"
+ << "installcontentA.txt" << "installcontent.txt" << "installcontentG.txt");
+
+ core.commitSessionOperations();
+ core.setUninstaller();
+ QVERIFY(core.removeInstallationSilently());
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentA");
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentE");
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentG");
+
+ // On Windows we have to settle for the resources check above as maintenance
+ // tool (if it would exists) and target directory are only removed later via
+ // started VBScript process. On Unix platforms the target directory should
+ // be removed in PackageManagerCorePrivate::runUninstaller().
+#if defined(Q_OS_UNIX)
+ QVERIFY(!QDir(m_installDir).exists());
+#endif
+ }
+
void testInstallWithDependencySilently()
{
QInstaller::init(); //This will eat debug output