diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-11-19 07:25:01 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-12-07 07:36:36 +0200 |
commit | e82ab45ed71d9b807dc23eae559c759f4584b79d (patch) | |
tree | 1ff8a7379a7c0fbd1908783404babd9b83e4d414 /tests/auto/installer/linereplaceoperation/tst_linereplaceoperation.cpp | |
parent | b43ab89a64c6484a8af4be424ab695b956d7f7bc (diff) |
Add option to define operations in component.xml
Operations can from now on be declared also in component.xml. The
operations are performed, backuped and rollbacked the same way as they
would be when defined from scripting api.
Task-number: QTIFW-507
Change-Id: Ia509219b94737136c3de25db0cb0c72076b48380
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests/auto/installer/linereplaceoperation/tst_linereplaceoperation.cpp')
-rw-r--r-- | tests/auto/installer/linereplaceoperation/tst_linereplaceoperation.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/tests/auto/installer/linereplaceoperation/tst_linereplaceoperation.cpp b/tests/auto/installer/linereplaceoperation/tst_linereplaceoperation.cpp index 0492bd104..762ef0211 100644 --- a/tests/auto/installer/linereplaceoperation/tst_linereplaceoperation.cpp +++ b/tests/auto/installer/linereplaceoperation/tst_linereplaceoperation.cpp @@ -40,6 +40,25 @@ class tst_linereplaceoperation : 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(); + + QFile file(installDir + QDir::separator() + "A.txt"); + QVERIFY(file.open(QIODevice::ReadOnly) | QIODevice::Text); + QTextStream stream(&file); + QCOMPARE(stream.readLine(), QLatin1String("This line was replaced.")); + QCOMPARE(stream.readLine(), QLatin1String("Another line.")); + file.close(); + QDir dir(installDir); + QVERIFY(dir.removeRecursively()); + } + private slots: void initTestCase() { @@ -115,23 +134,14 @@ private slots: QVERIFY(file.remove()); } - void testPerformingFromCLI() + void testLineReplaceFromScript() { - QString installDir = QInstaller::generateTemporaryFileName(); - QVERIFY(QDir().mkpath(installDir)); - PackageManagerCore *core = PackageManager::getPackageManagerWithInit - (installDir, ":///data/repository"); - core->installDefaultComponentsSilently(); + installFromCLI(":///data/repository"); + } - QFile file(installDir + QDir::separator() + "A.txt"); - QVERIFY(file.open(QIODevice::ReadOnly) | QIODevice::Text); - QTextStream stream(&file); - QCOMPARE(stream.readLine(), QLatin1String("This line was replaced.")); - QCOMPARE(stream.readLine(), QLatin1String("Another line.")); - file.close(); - QDir dir(installDir); - QVERIFY(dir.removeRecursively()); - core->deleteLater(); + void testLineReplaceFromXML() + { + installFromCLI(":///data/xmloperationrepository"); } private: |