summaryrefslogtreecommitdiffstats
path: root/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/installer/replaceoperation/tst_replaceoperation.cpp')
-rw-r--r--tests/auto/installer/replaceoperation/tst_replaceoperation.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp b/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp
index 9afd91875..88a3350a7 100644
--- a/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp
+++ b/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -29,6 +29,10 @@
#include <fileutils.h>
#include <replaceoperation.h>
#include <qinstallerglobal.h>
+#include <packagemanagercore.h>
+#include <binarycontent.h>
+#include <settings.h>
+#include <init.h>
#include <QObject>
#include <QDir>
@@ -174,6 +178,31 @@ private slots:
QVERIFY(QDir().rmdir(m_testDirectory));
}
+ void testPerformingFromCLI()
+ {
+ QInstaller::init(); //This will eat debug output
+ PackageManagerCore *core = new PackageManagerCore(BinaryContent::MagicInstallerMarker,
+ QList<OperationBlob> ());
+ QSet<Repository> repoList;
+ Repository repo = Repository::fromUserInput(":///data/repository");
+ repoList.insert(repo);
+ core->settings().setDefaultRepositories(repoList);
+
+ QVERIFY(QDir().mkpath(m_testDirectory));
+ core->setValue(scTargetDir, m_testDirectory);
+ core->installDefaultComponentsSilently();
+
+ QFile file(m_testDirectory + QDir::separator() + "A.txt");
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
+ QTextStream stream(&file);
+ QCOMPARE(stream.readLine(), QLatin1String("text to replace."));
+ QCOMPARE(stream.readLine(), QLatin1String("Another text."));
+ file.close();
+ QDir dir(m_testDirectory);
+ QVERIFY(dir.removeRecursively());
+ core->deleteLater();
+ }
+
private:
QString m_testDirectory;
QString m_testFilePath;