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 "fakeindicator.h"
21#include "indicatorsmodel.h"
22#include "indicatorsfactory.h"
28FAKE_INDICATOR(1, "Fake Title 1", "fake-indicator-1")
29FAKE_INDICATOR(2, "Fake Title 2", "fake-indicator-2")
31class IndicatorsModelTest : public QObject
37 setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
39 IndicatorsFactory::instance().registerIndicator<FakeIndicatorClient1>("indicator-fake1");
40 IndicatorsFactory::instance().registerIndicator<FakeIndicatorClient2>("indicator-fake2");
44 * Test if all plugins is loaded correct
48 IndicatorsModel model;
50 QCOMPARE(model.property("count").toInt(), 0);
54 QCOMPARE(model.property("count").toInt(), 2);
58 QCOMPARE(model.property("count").toInt(), 0);
63 * Test if the plugin data was loaded correct
67 IndicatorsModel model;
70 QVariantMap data = model.get(0);
71 QCOMPARE(data["title"].toString(), QString("Fake Title 1"));
72 QCOMPARE(data["label"].toString(), QString());
73 QCOMPARE(data["iconSource"].value<QUrl>(), QUrl("image://gicon/fake-indicator-1"));
74 QCOMPARE(data["description"].toString(), QString());
75 // There is no QML context
76 QVERIFY(!data["component"].value<QObject*>());
77 QCOMPARE(data["isValid"].toBool(), true);
80 QCOMPARE(data["title"].toString(), QString("Fake Title 2"));
81 QCOMPARE(data["label"].toString(), QString());
82 QCOMPARE(data["iconSource"].value<QUrl>(), QUrl("image://gicon/fake-indicator-2"));
83 QCOMPARE(data["description"].toString(), QString());
84 // There is no QML context
85 QVERIFY(!data["component"].value<QObject*>());
86 QCOMPARE(data["isValid"].toBool(), true);
89 QVERIFY(data.isEmpty());
93QTEST_MAIN(IndicatorsModelTest)
95#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