ssu
Loading...
Searching...
No Matches
deviceinfotest.cpp
Go to the documentation of this file.
1
7
8#include "deviceinfotest.h"
9
10#include <QtTest/QtTest>
11
13
14void DeviceInfoTest::testAdaptationVariables()
15{
16 SsuDeviceInfo deviceInfo("N950");
17 QHash<QString, QString> variables;
18 QHash<QString, QString> variablesExpected;
19 variablesExpected["adaptation"] = "n950-n9";
20 variablesExpected["foo-n9"] = "foo-n9-val";
21 variablesExpected["foo-n950-n9"] = "foo-n950-n9-val";
22
23 QString repoName = deviceInfo.adaptationVariables("adaptation1", &variables);
24
25 QCOMPARE(variables, variablesExpected);
26 QCOMPARE(repoName, QString("adaptation"));
27}
28
29void DeviceInfoTest::testFeatureVariables()
30{
31 SsuDeviceInfo deviceInfo("N950");
32 QHash<QString, QString> featureVariables;
33 QString repoName = deviceInfo.adaptationVariables("feature1", &featureVariables);
34 QHash<QString, QString> featureVariablesExpected;
35 featureVariablesExpected["feature"] = "test";
36 QCOMPARE(featureVariables, featureVariablesExpected);
37 QCOMPARE(repoName, QString("feature1"));
38}
39
40void DeviceInfoTest::testDeviceUid()
41{
42 QVERIFY2(!SsuDeviceInfo().deviceUid().isEmpty(), "No method to get device UID on this platform");
43}
44
45void DeviceInfoTest::testVariableSection()
46{
47 SsuDeviceInfo deviceInfo;
48
49 QHash<QString, QString> fooVars;
50 QHash<QString, QString> fooVarsExpected;
51 fooVarsExpected["foo1"] = "foo1Val";
52 fooVarsExpected["foo2"] = "foo2Val";
53
54 deviceInfo.variableSection("foo", &fooVars);
55
56 QCOMPARE(fooVars, fooVarsExpected);
57
58 QHash<QString, QString> barVars;
59 QHash<QString, QString> barVarsExpected;
60 barVarsExpected["bar1"] = "bar1Val";
61 barVarsExpected["bar2"] = "bar2Val";
62
63 deviceInfo.variableSection("bar", &barVars);
64
65 QCOMPARE(barVars, barVarsExpected);
66
67 QHash<QString, QString> bazVars;
68 QHash<QString, QString> bazVarsExpected;
69 bazVarsExpected["foo1"] = "foo1Val";
70 bazVarsExpected["foo2"] = "foo2Val";
71 bazVarsExpected["bar1"] = "bar1Val";
72 bazVarsExpected["bar2"] = "bar2Val";
73
74 deviceInfo.variableSection("baz", &bazVars);
75
76 QCOMPARE(bazVars, bazVarsExpected);
77}
78
79void DeviceInfoTest::testValue()
80{
81 SsuDeviceInfo deviceInfo("N950");
82 QCOMPARE(deviceInfo.value("family").toString(), QString("n950-n9"));
83 QCOMPARE(deviceInfo.value("adaptation-repos").toStringList(),
84 QString("n9xx-common,n950-n9").split(','));
85 QCOMPARE(deviceInfo.value("foo").toString(), QString("n950-foo"));
86}
void variableSection(const QString &section, QHash< QString, QString > *storageHash)
QVariant value(const QString &key, const QVariant &value=QVariant())