summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/componentmodel/data/updates.xml10
-rw-r--r--tests/auto/installer/componentmodel/tst_componentmodel.cpp30
-rw-r--r--tests/auto/installer/installer.pro3
-rw-r--r--tests/auto/installer/treename/data/invalid_repository/Updates.xml40
-rw-r--r--tests/auto/installer/treename/data/repository/Updates.xml119
-rw-r--r--tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7zbin0 -> 243 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0meta.7zbin0 -> 138 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7zbin0 -> 243 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0meta.7zbin0 -> 138 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentA/1.0.0content.7zbin0 -> 235 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentA/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentA/1.0.0meta.7zbin0 -> 130 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7zbin0 -> 251 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0meta.7zbin0 -> 146 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7zbin0 -> 251 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0meta.7zbin0 -> 146 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7zbin0 -> 243 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0meta.7zbin0 -> 138 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7zbin0 -> 243 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0meta.7zbin0 -> 138 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB/1.0.0content.7zbin0 -> 235 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentB/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentB/1.0.0meta.7zbin0 -> 130 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentC/1.0.0content.7zbin0 -> 235 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentC/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentC/1.0.0meta.7zbin0 -> 130 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentD/1.0.0content.7zbin0 -> 235 bytes
-rw-r--r--tests/auto/installer/treename/data/repository/componentD/1.0.0content.7z.sha11
-rw-r--r--tests/auto/installer/treename/data/repository/componentD/1.0.0meta.7zbin0 -> 130 bytes
-rw-r--r--tests/auto/installer/treename/settings.qrc26
-rw-r--r--tests/auto/installer/treename/treename.pro10
-rw-r--r--tests/auto/installer/treename/tst_treename.cpp136
38 files changed, 369 insertions, 15 deletions
diff --git a/tests/auto/installer/componentmodel/data/updates.xml b/tests/auto/installer/componentmodel/data/updates.xml
index 2341866ee..3a6139446 100644
--- a/tests/auto/installer/componentmodel/data/updates.xml
+++ b/tests/auto/installer/componentmodel/data/updates.xml
@@ -177,4 +177,14 @@
file="license.txt"/>
</Licenses>
</PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.fifth.product.noncheckable.sub2</Name>
+ <DisplayName>A sub component, moved to top level</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <SortingPriority>0</SortingPriority>
+ <UpdateFile UncompressedSize="61" CompressedSize="61"/>
+ <TreeName>moved_with_treename</TreeName>
+ </PackageUpdate>
</Updates>
diff --git a/tests/auto/installer/componentmodel/tst_componentmodel.cpp b/tests/auto/installer/componentmodel/tst_componentmodel.cpp
index 220aa73e3..0672a03ec 100644
--- a/tests/auto/installer/componentmodel/tst_componentmodel.cpp
+++ b/tests/auto/installer/componentmodel/tst_componentmodel.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -37,8 +37,8 @@
using namespace KDUpdater;
using namespace QInstaller;
-#define EXPECTED_COUNT_VIRTUALS_VISIBLE 11
-#define EXPECTED_COUNT_VIRTUALS_INVISIBLE 10
+#define EXPECTED_COUNT_VIRTUALS_VISIBLE 12
+#define EXPECTED_COUNT_VIRTUALS_INVISIBLE 11
static const char vendorProduct[] = "com.vendor.product";
static const char vendorSecondProduct[] = "com.vendor.second.product";
@@ -51,6 +51,7 @@ static const char vendorThirdProductVirtual[] = "com.vendor.third.product.virtua
static const char vendorFourthProductCheckable[] = "com.vendor.fourth.product.checkable";
static const char vendorFifthProductNonCheckable[] = "com.vendor.fifth.product.noncheckable";
static const char vendorFifthProductSub[] = "com.vendor.fifth.product.noncheckable.sub";
+static const char vendorFifthProductSubWithTreeName[] = "moved_with_treename";
static const QMap<QString, QString> rootComponentDisplayNames = {
{"", QLatin1String("The root component")},
@@ -78,7 +79,7 @@ private slots:
m_defaultPartially << vendorSecondProduct;
m_defaultUnchecked << vendorSecondProductSub1 << vendorSecondProductSubnode
<< vendorSecondProductSubnodeSub << vendorFourthProductCheckable
- << vendorFifthProductSub;
+ << vendorFifthProductSub << vendorFifthProductSubWithTreeName;
m_uncheckable << vendorFifthProductNonCheckable;
}
@@ -99,7 +100,7 @@ private slots:
foreach (const QString &name, all) {
QVERIFY(model.indexFromComponentName(name).isValid());
QVERIFY(model.componentFromIndex(model.indexFromComponentName(name)) != 0);
- QCOMPARE(model.componentFromIndex(model.indexFromComponentName(name))->name(), name);
+ QCOMPARE(model.componentFromIndex(model.indexFromComponentName(name))->treeName(), name);
}
foreach (Component *const component, rootComponents)
@@ -124,7 +125,7 @@ private slots:
foreach (const QString &name, all) {
QVERIFY(model.indexFromComponentName(name).isValid());
QVERIFY(model.componentFromIndex(model.indexFromComponentName(name)) != 0);
- QCOMPARE(model.componentFromIndex(model.indexFromComponentName(name))->name(), name);
+ QCOMPARE(model.componentFromIndex(model.indexFromComponentName(name))->treeName(), name);
}
foreach (Component *const component, rootComponents)
@@ -415,8 +416,8 @@ private:
void testComponentsLoaded(const QList<Component *> &rootComponents) const
{
- // we need to have five root components
- QCOMPARE(rootComponents.count(), 5);
+ // we need to have six root components
+ QCOMPARE(rootComponents.count(), 6);
QList<Component*> components = rootComponents;
foreach (Component *const component, rootComponents)
@@ -431,9 +432,9 @@ private:
{
// row count with invalid model index should return:
if (m_core.virtualComponentsVisible())
- QCOMPARE(model->rowCount(), 5); // 5 (4 non virtual and 1 virtual root component)
+ QCOMPARE(model->rowCount(), 6); // 6 (5 non virtual and 1 virtual root component)
else
- QCOMPARE(model->rowCount(), 4); // 4 (the 4 non virtual root components)
+ QCOMPARE(model->rowCount(), 5); // 5 (the 5 non virtual root components)
QCOMPARE(model->columnCount(), columnCount);
const QModelIndex firstParent = model->indexFromComponentName(vendorProduct);
@@ -497,15 +498,15 @@ private:
// these components should have checked state
foreach (Component *const component, model->checked())
- QVERIFY(checked.contains(component->name()));
+ QVERIFY(checked.contains(component->treeName()));
// these components should not have partially checked state
foreach (Component *const component, model->partially())
- QVERIFY(partially.contains(component->name()));
+ QVERIFY(partially.contains(component->treeName()));
// these components should not have checked state
foreach (Component *const component, model->unchecked())
- QVERIFY(unchecked.contains(component->name()));
+ QVERIFY(unchecked.contains(component->treeName()));
}
QList<Component*> loadComponents() const
@@ -520,6 +521,7 @@ private:
// we need at least these to be able to test the model
component->setValue("Name", info.data.value("Name").toString());
+ component->setValue("TreeName", info.data.value("TreeName").toString());
QString isDefault = info.data.value("Default").toString();
if (m_core.noDefaultInstallation())
isDefault = scFalse;
@@ -537,7 +539,7 @@ private:
component->setCheckable(false);
component->setCheckState(Qt::Checked);
}
- components.insert(component->name(), component);
+ components.insert(component->treeName(), component);
}
QList <Component*> rootComponents;
diff --git a/tests/auto/installer/installer.pro b/tests/auto/installer/installer.pro
index 4421643b8..2f65d607e 100644
--- a/tests/auto/installer/installer.pro
+++ b/tests/auto/installer/installer.pro
@@ -37,7 +37,8 @@ SUBDIRS += \
environmentvariableoperation \
licenseagreement \
globalsettingsoperation \
- elevatedexecuteoperation
+ elevatedexecuteoperation \
+ treename
win32 {
SUBDIRS += registerfiletypeoperation \
diff --git a/tests/auto/installer/treename/data/invalid_repository/Updates.xml b/tests/auto/installer/treename/data/invalid_repository/Updates.xml
new file mode 100644
index 000000000..a9542eb0d
--- /dev/null
+++ b/tests/auto/installer/treename/data/invalid_repository/Updates.xml
@@ -0,0 +1,40 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>false</Checksum>
+ <PackageUpdate>
+ <Name>componentA</Name>
+ <DisplayName>Component A</DisplayName>
+ <Description>This component depends on componentB.sub2.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <Dependencies>componentB.sub2</Dependencies>
+ <UpdateFile CompressedSize="275" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>570dec768b1f266c66656f015e772f0e6e41b73d</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentA.sub1</Name>
+ <DisplayName>Component A subcomponent 1</DisplayName>
+ <Description>component</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <UpdateFile CompressedSize="283" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>da5819910a7f7c95eb61a49543e273fd6e2e9aae</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB</Name>
+ <DisplayName>Component B</DisplayName>
+ <Description>Component B</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>40</SortingPriority>
+ <UpdateFile CompressedSize="275" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>72eee5304ff866e024b477d7b2432df8f2428483</SHA1>
+ <TreeName>componentA.sub1</TreeName>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/treename/data/repository/Updates.xml b/tests/auto/installer/treename/data/repository/Updates.xml
new file mode 100644
index 000000000..1ab3caa23
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/Updates.xml
@@ -0,0 +1,119 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>false</Checksum>
+ <PackageUpdate>
+ <Name>componentA</Name>
+ <DisplayName>Component A</DisplayName>
+ <Description>This component depends on componentB.sub2.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <Dependencies>componentB.sub2</Dependencies>
+ <UpdateFile CompressedSize="275" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>570dec768b1f266c66656f015e772f0e6e41b73d</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentA.sub1</Name>
+ <DisplayName>Component A subcomponent 1</DisplayName>
+ <Description>component</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <UpdateFile CompressedSize="283" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>da5819910a7f7c95eb61a49543e273fd6e2e9aae</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentA.sub2</Name>
+ <DisplayName>Component A subcomponent 2</DisplayName>
+ <Description>component</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <TreeName>ASub2ToRoot</TreeName>
+ <UpdateFile CompressedSize="283" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>73ac2c332ce01fadf0f1c7e16a27faaf0f853e18</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB</Name>
+ <DisplayName>Component B</DisplayName>
+ <Description>Component B</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>40</SortingPriority>
+ <UpdateFile CompressedSize="275" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>72eee5304ff866e024b477d7b2432df8f2428483</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB.sub1</Name>
+ <DisplayName>Component B subcomponent 2 1</DisplayName>
+ <Description>Subcomponent for B</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <UpdateFile CompressedSize="283" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>e19f1a26698afe0b72c9048b403253421b8fed4b</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB.sub1.sub1</Name>
+ <DisplayName>Component B sub component for sub1</DisplayName>
+ <Description>Subsubcomponent for B. Moved to root with treename.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <TreeName>BSub1Sub1ToRoot</TreeName>
+ <UpdateFile CompressedSize="291" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>6a348979273336862c7a5e16305779e81fee1081</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB.sub1.sub2</Name>
+ <DisplayName>Component B second sub component for sub1</DisplayName>
+ <Description>Subsubcomponent for B. Moved under componentC with treename.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <TreeName>componentC.sub1</TreeName>
+ <UpdateFile CompressedSize="291" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>c1bca8944147ec64343c146f461288990268b4a9</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB.sub2</Name>
+ <DisplayName>Component B subcomponent 2</DisplayName>
+ <Description>Subcomponent for B. Moved to root with treename.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>8000</SortingPriority>
+ <TreeName>BSub2ToRoot</TreeName>
+ <UpdateFile CompressedSize="283" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>bde9feba3a8134e9c1412b674ee21642938fafec</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentC</Name>
+ <DisplayName>Component C</DisplayName>
+ <Description>Component C</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <UpdateFile CompressedSize="275" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>cc33e730d9127e1636566ea35bbe4f186ba4bcb7</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentD</Name>
+ <DisplayName>Component D</DisplayName>
+ <Description>Component D. Autodepends on moved item componentA.sub2 </Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <AutoDependOn>componentA.sub2</AutoDependOn>
+ <UpdateFile CompressedSize="275" UncompressedSize="101" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>3ca69d6bb062c4442fdb20fe0e62bb0f04e8a419</SHA1>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7z
new file mode 100644
index 000000000..f7e22c055
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7z.sha1
new file mode 100644
index 000000000..3378d2da5
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+d46bf0f128c64749fb03050045afc816774185e2 \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0meta.7z
new file mode 100644
index 000000000..81ff563fc
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA.sub1/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7z
new file mode 100644
index 000000000..d7f4c781c
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7z.sha1
new file mode 100644
index 000000000..0eb4045af
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+6561aae70d055e1c4d72b30b12aef7a85cf2139e \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0meta.7z
new file mode 100644
index 000000000..38d7c557d
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA.sub2/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentA/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentA/1.0.0content.7z
new file mode 100644
index 000000000..e50fc1e92
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentA/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentA/1.0.0content.7z.sha1
new file mode 100644
index 000000000..082bcbf64
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+d8486606a02b9c492e4c17d1e42cfea835a1da51 \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentA/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentA/1.0.0meta.7z
new file mode 100644
index 000000000..c062c3cee
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentA/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7z
new file mode 100644
index 000000000..2c254e3aa
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7z.sha1
new file mode 100644
index 000000000..019ab5051
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+3fd04b8e55846f9622ffb8f9ae5f4e6c8b57f90e \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0meta.7z
new file mode 100644
index 000000000..31630e810
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1.sub1/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7z
new file mode 100644
index 000000000..261ea6ab9
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7z.sha1
new file mode 100644
index 000000000..c3753ca62
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+2e89c27c3590e12cd900cb55fa2c91428babfd45 \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0meta.7z
new file mode 100644
index 000000000..c449e57f6
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1.sub2/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7z
new file mode 100644
index 000000000..d938d0fb2
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7z.sha1
new file mode 100644
index 000000000..3db5bca08
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+2407a2adb3d82211921b509e6dd792d67862de0e \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0meta.7z
new file mode 100644
index 000000000..6996a4d01
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub1/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7z
new file mode 100644
index 000000000..7319cf08f
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7z.sha1
new file mode 100644
index 000000000..855e2edab
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+a8b85ffe4f91b4dc68a6402b314402949ef17a7a \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0meta.7z
new file mode 100644
index 000000000..b91e41207
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB.sub2/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentB/1.0.0content.7z
new file mode 100644
index 000000000..b3a0e683c
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentB/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentB/1.0.0content.7z.sha1
new file mode 100644
index 000000000..377526fb6
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+274b3dbe9cceeca1b577eb2a8302d7690ad93eb3 \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentB/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentB/1.0.0meta.7z
new file mode 100644
index 000000000..e9ab3969d
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentB/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentC/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentC/1.0.0content.7z
new file mode 100644
index 000000000..7eca1e977
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentC/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentC/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentC/1.0.0content.7z.sha1
new file mode 100644
index 000000000..d3b44feee
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentC/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+d3015ef5340508ad426c43daa2517c7b62581bab \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentC/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentC/1.0.0meta.7z
new file mode 100644
index 000000000..47ea321ec
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentC/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentD/1.0.0content.7z b/tests/auto/installer/treename/data/repository/componentD/1.0.0content.7z
new file mode 100644
index 000000000..2299f9812
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentD/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/treename/data/repository/componentD/1.0.0content.7z.sha1 b/tests/auto/installer/treename/data/repository/componentD/1.0.0content.7z.sha1
new file mode 100644
index 000000000..51dcdd0ed
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentD/1.0.0content.7z.sha1
@@ -0,0 +1 @@
+5ce5b91fb7ce209d83ba616ac01bf30e2942f70c \ No newline at end of file
diff --git a/tests/auto/installer/treename/data/repository/componentD/1.0.0meta.7z b/tests/auto/installer/treename/data/repository/componentD/1.0.0meta.7z
new file mode 100644
index 000000000..3443e843b
--- /dev/null
+++ b/tests/auto/installer/treename/data/repository/componentD/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/treename/settings.qrc b/tests/auto/installer/treename/settings.qrc
new file mode 100644
index 000000000..3837d4440
--- /dev/null
+++ b/tests/auto/installer/treename/settings.qrc
@@ -0,0 +1,26 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/repository/Updates.xml</file>
+ <file>data/repository/componentA/1.0.0meta.7z</file>
+ <file>data/repository/componentA/1.0.0content.7z</file>
+ <file>data/repository/componentA.sub1/1.0.0meta.7z</file>
+ <file>data/repository/componentA.sub1/1.0.0content.7z</file>
+ <file>data/repository/componentA.sub2/1.0.0meta.7z</file>
+ <file>data/repository/componentA.sub2/1.0.0content.7z</file>
+ <file>data/repository/componentB/1.0.0meta.7z</file>
+ <file>data/repository/componentB/1.0.0content.7z</file>
+ <file>data/repository/componentB.sub1/1.0.0meta.7z</file>
+ <file>data/repository/componentB.sub1/1.0.0content.7z</file>
+ <file>data/repository/componentB.sub1.sub1/1.0.0meta.7z</file>
+ <file>data/repository/componentB.sub1.sub1/1.0.0content.7z</file>
+ <file>data/repository/componentB.sub1.sub2/1.0.0meta.7z</file>
+ <file>data/repository/componentB.sub1.sub2/1.0.0content.7z</file>
+ <file>data/repository/componentB.sub2/1.0.0meta.7z</file>
+ <file>data/repository/componentB.sub2/1.0.0content.7z</file>
+ <file>data/repository/componentC/1.0.0meta.7z</file>
+ <file>data/repository/componentC/1.0.0content.7z</file>
+ <file>data/repository/componentD/1.0.0meta.7z</file>
+ <file>data/repository/componentD/1.0.0content.7z</file>
+ <file>data/invalid_repository/Updates.xml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/installer/treename/treename.pro b/tests/auto/installer/treename/treename.pro
new file mode 100644
index 000000000..f983b39cf
--- /dev/null
+++ b/tests/auto/installer/treename/treename.pro
@@ -0,0 +1,10 @@
+include(../../qttest.pri)
+
+QT -= gui
+QT += testlib
+
+SOURCES += tst_treename.cpp
+
+RESOURCES += \
+ settings.qrc \
+ ..\shared\config.qrc
diff --git a/tests/auto/installer/treename/tst_treename.cpp b/tests/auto/installer/treename/tst_treename.cpp
new file mode 100644
index 000000000..0dc7bfa33
--- /dev/null
+++ b/tests/auto/installer/treename/tst_treename.cpp
@@ -0,0 +1,136 @@
+/**************************************************************************
+**
+** 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 <packagemanagercore.h>
+#include <component.h>
+#include <componentmodel.h>
+
+#include <QTest>
+#include <QRegularExpression>
+
+class tst_TreeName : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void moveToRoot();
+ void moveToSubItem();
+ void dependencyToMovedItem();
+ void autodependOnMovedItem();
+ void moveToExistingItem();
+
+ void init();
+ void cleanup();
+
+private:
+ QString m_installDir;
+
+};
+
+void tst_TreeName::moveToRoot()
+{
+ // componentB.sub1.sub1 moved from sub item to root (BSub1Sub1ToRoot)
+ PackageManagerCore *core = PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/repository");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList() << "componentB.sub1.sub1"));
+ QList<Component*> installedComponents = core->orderedComponentsToInstall();
+
+ QCOMPARE(installedComponents.count(), 1);
+ QCOMPARE(installedComponents.at(0)->name(), "componentB.sub1.sub1");
+ QCOMPARE(installedComponents.at(0)->treeName(), "BSub1Sub1ToRoot");
+ QVERIFY(core->componentByName("componentB.sub1.sub1") != 0);
+ QVERIFY(core->componentByName("BSub1Sub1ToRoot") == 0);
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentB.sub1.sub1", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "componentBSub1Sub1.txt");
+}
+
+void tst_TreeName::moveToSubItem()
+{
+ // componentB.sub1.sub2 moved under componentC (componentC.sub1)
+ PackageManagerCore *core = PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/repository");
+
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList() << "componentC"));
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentB.sub1.sub2", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentC", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "componentBSub1Sub2.txt" << "componentC.txt");
+}
+
+void tst_TreeName::dependencyToMovedItem()
+{
+ // componentA depends on componentB.sub2 which is moved to root
+ PackageManagerCore *core = PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/repository");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList() << "componentA"));
+
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA.sub1", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentB.sub2", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "componentA.txt" << "componentASub1.txt" << "componentBSub2.txt");
+}
+
+void tst_TreeName::autodependOnMovedItem()
+{
+ // componentD autodepends on componentA.sub2 which is moved to root
+ PackageManagerCore *core = PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/repository");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList() << "componentA.sub2"));
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA.sub2", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "componentASub2.txt" << "componentD.txt");
+}
+
+void tst_TreeName::moveToExistingItem()
+{
+ PackageManagerCore *core = PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/invalid_repository");
+ QCOMPARE(PackageManagerCore::Failure, core->installSelectedComponentsSilently(QStringList() << "componentA"));
+ QCOMPARE(core->error(), "Cannot register component! Component with identifier componentA.sub1 already exists.");
+}
+
+void tst_TreeName::init()
+{
+ m_installDir = QInstaller::generateTemporaryFileName();
+ QVERIFY(QDir().mkpath(m_installDir));
+}
+
+void tst_TreeName::cleanup()
+{
+ QDir dir(m_installDir);
+ QVERIFY(dir.removeRecursively());
+}
+
+QTEST_MAIN(tst_TreeName)
+
+#include "tst_treename.moc"