49
53
manager.componentComplete();
51
55
QSet<QString> expectedCategories;
52
expectedCategories << "phone" << "network";
56
expectedCategories << "phone" << "network" << "misc";
53
57
QCOMPARE(manager.categories().toSet(), expectedCategories);
55
59
QMap<QString, Plugin *> plugins = manager.plugins("phone");
118
122
QCOMPARE(cellular->displayName(), QString("Bluetooth"));
125
void PluginsTest::testReset()
128
PluginManager manager;
129
manager.classBegin();
130
manager.componentComplete();
132
QAbstractItemModel *model(manager.itemModel("network"));
133
Plugin *wireless = (Plugin *) model->data(model->index(0, 0),
134
ItemModel::ItemRole).value<QObject *>();
137
QQmlContext *context = new QQmlContext(engine.rootContext());
138
QQmlEngine::setContextForObject(wireless, context);
140
/* This is how you check that a debug message was printed */
141
QTest::ignoreMessage(QtDebugMsg, "Hello");
145
void PluginsTest::testResetInPlugin()
147
PluginManager manager;
148
manager.classBegin();
149
manager.componentComplete();
151
QAbstractItemModel *model(manager.itemModel("misc"));
152
Plugin *phone = (Plugin *) model->data(model->index(0, 0),
153
ItemModel::ItemRole).value<QObject *>();
156
QQmlContext *context = new QQmlContext(engine.rootContext());
157
QQmlEngine::setContextForObject(phone, context);
159
/* This is how you check that a debug message was printed */
160
/* qDebug() inserts a space at the end */
161
QTest::ignoreMessage(QtDebugMsg, "reset function in plugin ");
121
166
QTEST_MAIN(PluginsTest);
122
167
#include "tst_plugins.moc"