summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2021-08-30 11:38:56 +0300
committerKatja Marttila <katja.marttila@qt.io>2021-09-02 11:43:40 +0300
commit2767b0c96a0dbe713bc2d1e346d10f6787556d5b (patch)
treeca5342d36215e74db756af83b1367c0ce722ded8 /tests
parent08a123c86b9aae85da1be1542578de060df4868b (diff)
Fix qbsp adding from GUI
Qbsp package adding failed using gui if the package with the same name existed in the component tree. Also increased priority to qbsp package so that if the same name and version exists in the component tree then qbsp package is used. Task-number: QTIFW-2312 Change-Id: I732fef1a7ba503d2332f411e15b6873c63dcf630 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/repository/data/compressedRepository/compressedRepository.7zbin0 -> 542 bytes
-rw-r--r--tests/auto/installer/repository/data/repository/A/1.0.2content.7zbin0 -> 165 bytes
-rw-r--r--tests/auto/installer/repository/data/repository/Updates.xml13
-rw-r--r--tests/auto/installer/repository/repository.pro4
-rw-r--r--tests/auto/installer/repository/settings.qrc7
-rw-r--r--tests/auto/installer/repository/tst_repository.cpp49
6 files changed, 73 insertions, 0 deletions
diff --git a/tests/auto/installer/repository/data/compressedRepository/compressedRepository.7z b/tests/auto/installer/repository/data/compressedRepository/compressedRepository.7z
new file mode 100644
index 000000000..fa75f2979
--- /dev/null
+++ b/tests/auto/installer/repository/data/compressedRepository/compressedRepository.7z
Binary files differ
diff --git a/tests/auto/installer/repository/data/repository/A/1.0.2content.7z b/tests/auto/installer/repository/data/repository/A/1.0.2content.7z
new file mode 100644
index 000000000..5531e9072
--- /dev/null
+++ b/tests/auto/installer/repository/data/repository/A/1.0.2content.7z
Binary files differ
diff --git a/tests/auto/installer/repository/data/repository/Updates.xml b/tests/auto/installer/repository/data/repository/Updates.xml
new file mode 100644
index 000000000..6fdfec9e5
--- /dev/null
+++ b/tests/auto/installer/repository/data/repository/Updates.xml
@@ -0,0 +1,13 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <PackageUpdate>
+ <Name>A</Name>
+ <DisplayName>A</DisplayName>
+ <Description>Example component A</Description>
+ <Version>1.0.2</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/repository/repository.pro b/tests/auto/installer/repository/repository.pro
index 2d192eeaa..39d8df034 100644
--- a/tests/auto/installer/repository/repository.pro
+++ b/tests/auto/installer/repository/repository.pro
@@ -4,3 +4,7 @@ QT += network
QT -= gui
SOURCES += tst_repository.cpp
+
+RESOURCES += \
+ settings.qrc \
+ ..\shared\config.qrc
diff --git a/tests/auto/installer/repository/settings.qrc b/tests/auto/installer/repository/settings.qrc
new file mode 100644
index 000000000..ff628b482
--- /dev/null
+++ b/tests/auto/installer/repository/settings.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/repository/Updates.xml</file>
+ <file>data/repository/A/1.0.2content.7z</file>
+ <file>data/compressedRepository/compressedRepository.7z</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/installer/repository/tst_repository.cpp b/tests/auto/installer/repository/tst_repository.cpp
index 7b8405baf..db538ba5d 100644
--- a/tests/auto/installer/repository/tst_repository.cpp
+++ b/tests/auto/installer/repository/tst_repository.cpp
@@ -1,3 +1,34 @@
+/**************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+#include "../shared/packagemanager.h"
+#include "../shared/verifyinstaller.h"
+
#include "repository.h"
#include "repositorycategory.h"
#include "settings.h"
@@ -161,6 +192,24 @@ private slots:
update.insert(QLatin1String("replace"), qMakePair(nonMatching, replacement));
QVERIFY(settings.updateRepositoryCategories(update) == Settings::NoUpdatesApplied);
}
+
+ void testCompressedRepositoryWithPriority()
+ {
+ // Compressed repository has higher priority than normal repository.
+ // If the versions match, compressed repository is used instead of normal repository.
+ QString installDir = QInstaller::generateTemporaryFileName();
+ QVERIFY(QDir().mkpath(installDir));
+
+ PackageManagerCore *core = PackageManager::getPackageManagerWithInit(installDir, ":///data/repository");
+ core->setTemporaryRepositories(QStringList()
+ << ":///data/compressedRepository/compressedRepository.7z", false, true);
+ core->installSelectedComponentsSilently(QStringList() << "A");
+ VerifyInstaller::verifyFileExistence(installDir, QStringList() << "components.xml" << "A_from_compressed.txt");
+
+ QDir dir(installDir);
+ QVERIFY(dir.removeRecursively());
+ core->deleteLater();
+ }
};
QTEST_MAIN(tst_Repository)