diff options
author | Katja Marttila <katja.marttila@qt.io> | 2017-03-14 14:30:09 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2017-03-23 08:04:42 +0000 |
commit | 7ee08852f38b1ff2ff3638af46fcfca64cd12df7 (patch) | |
tree | 120439f321f3a9480fcfc5185904989ccbd630fc /tests | |
parent | 9772474dd97e5543035b5fd0dde4b731745e5057 (diff) |
Make installer to check the dependency version
Installer was able to install dependency correctly. However, it ignored
the version dependency might have.
Dependencies>componentA->=4.0</Dependencies>
If there was already a dependency installed with lower version number,
the newer version, which was required by the selected component, was not
installed. Fixed so that maintenancetool will not only check if the
dependency is installed but also the installed version.
Change-Id: Ia26b5233cf8847bce73095d19a13c481318d27f2
Task-number: QTIFW-914
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/installer/solver/tst_solver.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/auto/installer/solver/tst_solver.cpp b/tests/auto/installer/solver/tst_solver.cpp index 5ccf0b2c8..5829621f2 100644 --- a/tests/auto/installer/solver/tst_solver.cpp +++ b/tests/auto/installer/solver/tst_solver.cpp @@ -155,15 +155,19 @@ private slots: componentA->appendComponent(componentAA); componentA->appendComponent(componentAB); NamedComponent *componentB = new NamedComponent(core, QLatin1String("B")); + NamedComponent *componentB_NewVersion = new NamedComponent(core, QLatin1String("B_version"), QLatin1String("2.0.0")); componentB->addDependency(QLatin1String("A.B")); + componentAB->addDependency(QLatin1String("B_version->=2.0.0")); core->appendRootComponent(componentA); core->appendRootComponent(componentB); + core->appendRootComponent(componentB_NewVersion); QTest::newRow("Installer resolved") << core << (QList<Component *>() << componentB) - << (QList<Component *>() << componentAB << componentB) + << (QList<Component *>() << componentB_NewVersion << componentAB << componentB) << (QList<int>() << InstallerCalculator::Dependent + << InstallerCalculator::Dependent << InstallerCalculator::Resolved); } @@ -186,6 +190,40 @@ private slots: delete core; } + void unresolvedDependencyVersion_data() + { + QTest::addColumn<PackageManagerCore *>("core"); + QTest::addColumn<QList<Component *> >("selectedComponents"); + QTest::addColumn<QList<Component *> >("expectedResult"); + + PackageManagerCore *core = new PackageManagerCore(); + core->setPackageManager(); + NamedComponent *componentA = new NamedComponent(core, QLatin1String("A")); + NamedComponent *componentB = new NamedComponent(core, QLatin1String("B"), QLatin1String("1.0.0")); + componentA->addDependency(QLatin1String("B->=2.0.0")); + core->appendRootComponent(componentA); + core->appendRootComponent(componentB); + + QTest::newRow("Installer resolved") << core + << (QList<Component *>() << componentA) + << (QList<Component *>()); + } + + void unresolvedDependencyVersion() + { + QFETCH(PackageManagerCore *, core); + QFETCH(QList<Component *> , selectedComponents); + QFETCH(QList<Component *> , expectedResult); + + InstallerCalculator calc(core->components(PackageManagerCore::ComponentType::AllNoReplacements)); + QTest::ignoreMessage(QtWarningMsg, "Cannot find missing dependency \"B->=2.0.0\" for \"A\"."); + calc.appendComponentsToInstall(selectedComponents); + + QList<Component *> result = calc.orderedComponentsToInstall(); + QCOMPARE(result.count(), expectedResult.count()); + delete core; + } + void resolveUninstaller_data() { QTest::addColumn<PackageManagerCore *>("core"); |