diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-10-07 14:00:16 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-10-15 12:30:33 +0300 |
commit | b93105c9daf45bce31338e54d14e0869f3c5b669 (patch) | |
tree | d1ec0294bbe489b2ffac6bb4682b21f06b075f25 /tests/auto/installer/shared/verifyinstaller.h | |
parent | 0a9427d03b174cf4a4f0fa41151688d0c227ba61 (diff) |
Repogen: Fix options to work with unite metadata
Fixed regogen 'update' and 'repository' options to work with unite
metadata.
--update-new-components with unify metadata is prevented.
Moved --update-new-components functionality from repogen.cpp to
QInstallerTools so it can be accessed from tests.
Created tests for repogen.
Task-number: QTIFW-1943
Change-Id: I12389f4747154a0f6f51b4f34f630103c2cfef04
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests/auto/installer/shared/verifyinstaller.h')
-rw-r--r-- | tests/auto/installer/shared/verifyinstaller.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/installer/shared/verifyinstaller.h b/tests/auto/installer/shared/verifyinstaller.h index 91ab2f3cd..4445743af 100644 --- a/tests/auto/installer/shared/verifyinstaller.h +++ b/tests/auto/installer/shared/verifyinstaller.h @@ -33,6 +33,8 @@ #include <QStringList> #include <QCryptographicHash> #include <QFile> +#include <QDir> +#include <QtTest/QTest> struct VerifyInstaller { @@ -68,6 +70,26 @@ struct VerifyInstaller QCOMPARE(dir.entryList(QStringList() << "*.*", QDir::Files).count(), fileList.count()); } + static QString fileContent(const QString &fileName) + { + QFile file(fileName); + QTextStream stream(&file); + file.open(QIODevice::ReadOnly); + QString str = stream.readAll(); + file.close(); + return str; + } + + static void verifyFileContent(const QString &fileName, const QString &content) + { + QVERIFY(fileContent(fileName).contains(content)); + } + + static void verifyFileHasNoContent(const QString &fileName, const QString &content) + { + QVERIFY(!fileContent(fileName).contains(content)); + } + static void addToFileMap(const QDir &baseDir, const QFileInfo &fileInfo, QMap<QString, QByteArray> &map) { QDir directory(fileInfo.absoluteFilePath()); |