summaryrefslogtreecommitdiffstats
path: root/tests/auto/installer/solver/tst_solver.cpp
diff options
context:
space:
mode:
authorjkobus <jaroslaw.kobus@theqtcompany.com>2014-11-17 14:40:57 +0100
committerJarek Kobus <jaroslaw.kobus@theqtcompany.com>2014-12-01 13:18:12 +0100
commit12399b1b97e05626087cd2ebf673725d363a0a54 (patch)
tree364c2690ebe6e6e3f8b84adcd69bf8ecdc664767 /tests/auto/installer/solver/tst_solver.cpp
parentb3a473cc7d050c8392749e41f4afd56b898ee2db (diff)
Add ComponentChecker class for verifying the internal state.
Change-Id: I3361ad6c51d5a0f3beee049237e6b370d57a8f0d Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Diffstat (limited to 'tests/auto/installer/solver/tst_solver.cpp')
-rw-r--r--tests/auto/installer/solver/tst_solver.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/installer/solver/tst_solver.cpp b/tests/auto/installer/solver/tst_solver.cpp
index 83f577bdf..fb22e8077 100644
--- a/tests/auto/installer/solver/tst_solver.cpp
+++ b/tests/auto/installer/solver/tst_solver.cpp
@@ -36,12 +36,15 @@
#include <graph.h>
#include <installercalculator.h>
#include <uninstallercalculator.h>
+#include <componentchecker.h>
#include <packagemanagercore.h>
#include <QTest>
using namespace QInstaller;
+typedef QMap<Component *, QStringList> ComponentToStringList;
+
class Data {
public:
Data() {}
@@ -251,6 +254,42 @@ private slots:
QCOMPARE(result, expectedResult);
delete core;
}
+
+
+ void checkComponent_data()
+ {
+ QTest::addColumn<QList<Component *> >("componentsToCheck");
+ QTest::addColumn<ComponentToStringList>("expectedResult");
+
+ PackageManagerCore *core = new PackageManagerCore();
+ core->setPackageManager();
+
+ NamedComponent *componentA = new NamedComponent(core, QLatin1String("A"));
+ NamedComponent *componentB = new NamedComponent(core, QLatin1String("B"));
+
+ componentB->setValue(QLatin1String("AutoDependOn"), QLatin1String("A"));
+ componentB->setValue(QLatin1String("Default"), QLatin1String("true"));
+
+ ComponentToStringList result;
+ result[componentB].append(QLatin1String("Component B specifies \"Default\" property "
+ "together with \"AutoDependOn\" list. This combination of states "
+ "may not work properly."));
+
+ QTest::newRow("AutoDepend and default")
+ << (QList<Component *>() << componentA << componentB)
+ << result;
+ }
+
+ void checkComponent()
+ {
+ QFETCH(QList<Component *>, componentsToCheck);
+ QFETCH(ComponentToStringList, expectedResult);
+
+ foreach (Component *component, componentsToCheck) {
+ const QStringList result = ComponentChecker::checkComponent(component);
+ QCOMPARE(result, expectedResult.value(component));
+ }
+ }
};
QTEST_MAIN(tst_Solver)