2 * Copyright 2012 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
20#include "indicatorsmodel.h"
26class IndicatorsModelTest : public QObject
33 setenv("UNITY_TEST_ENV", "1", 1);
34 setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
37 void cleanupTestCase()
39 unsetenv("UNITY_TEST_ENV");
43 * Testa that all the plugins are loaded / unloaded correctly
47 IndicatorsModel model;
49 QCOMPARE(model.property("count").toInt(), 0);
53 QCOMPARE(model.property("count").toInt(), 4);
57 QCOMPARE(model.property("count").toInt(), 0);
62 * Testa that the plugin data was loaded correctly
64 void testDataAndOrder()
66 // Priority order. (2, 1, 4, 3)
68 QVariantMap map1; map1["priority"] = 1; map1["title"] = "fake1";
69 QVariantMap map2; map2["priority"] = 0; map2["title"] = "fake2";
70 QVariantMap map3; map3["priority"] = 3; map3["title"] = "fake3";
71 QVariantMap map4; map4["priority"] = 2; map4["title"] = "fake4";
72 map["indicator-fake1"] = map1;
73 map["indicator-fake2"] = map2;
74 map["indicator-fake3"] = map3;
75 map["indicator-fake4"] = map4;
77 IndicatorsModel model;
78 model.setIndicatorData(map);
81 QCOMPARE(model.get(0)["identifier"].toString(), QString("indicator-fake2"));
82 QCOMPARE(model.get(0)["title"].toString(), QString("fake2"));
83 QCOMPARE(model.get(0)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake2"));
85 QCOMPARE(model.get(1)["identifier"].toString(), QString("indicator-fake1"));
86 QCOMPARE(model.get(1)["title"].toString(), QString("fake1"));
87 QCOMPARE(model.get(1)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake1"));
89 QCOMPARE(model.get(2)["identifier"].toString(), QString("indicator-fake4"));
90 QCOMPARE(model.get(2)["title"].toString(), QString("fake4"));
91 QCOMPARE(model.get(2)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake4"));
93 QCOMPARE(model.get(3)["identifier"].toString(), QString("indicator-fake3"));
94 QCOMPARE(model.get(3)["title"].toString(), QString("fake3"));
95 QCOMPARE(model.get(3)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake3"));
99QTEST_MAIN(IndicatorsModelTest)
101#include "indicatorsmodeltest.moc"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list