diff options
author | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-11-29 12:39:49 +0000 |
---|---|---|
committer | Tarmac <> | 2012-11-29 12:39:49 +0000 |
commit | 49810b965479abab31c2789b238132f2c8352d80 (patch) | |
tree | 92cb0c7793a463a9187f6b53c7574303789d3b2f /tests | |
parent | da5a0437d57df35409fedb568b7ebf4e3d6af0da (diff) | |
parent | b3ac37876e6168cf91e3efedf7861709a5e1adef (diff) | |
download | qmenumodel-49810b965479abab31c2789b238132f2c8352d80.tar.gz qmenumodel-49810b965479abab31c2789b238132f2c8352d80.tar.bz2 qmenumodel-49810b965479abab31c2789b238132f2c8352d80.zip |
Created auxiliary functions. To allows access the model data from JavaScript;.
Approved by Olivier Tilloy, PS Jenkins bot.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client/modeltest.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp index 8be92a6..3366177 100644 --- a/tests/client/modeltest.cpp +++ b/tests/client/modeltest.cpp @@ -260,6 +260,44 @@ private Q_SLOTS: delete model; } + + /* + * Test get function + */ + void testGetData() + { + // Make menu available + m_script.publishMenu(); + m_script.run(); + + // create a new model + QDBusMenuModel *model = new QDBusMenuModel(); + model->setBusType(DBusEnums::SessionBus); + model->setBusName(MENU_SERVICE_NAME); + model->setObjectPath(MENU_OBJECT_PATH); + model->start(); + + // Wait for dbus sync + QTest::qWait(500); + + // count + QCOMPARE(model->property("count").toInt(), model->rowCount()); + + QVariantMap data = model->get(0); + + QVERIFY(data.contains("action")); + QVERIFY(data.contains("extra")); + QVERIFY(data.contains("label")); + QVERIFY(data.contains("linkSection")); + QVERIFY(data.contains("linkSubMenu")); + + QCOMPARE(data["action"].toString(), QString("Menu0Act")); + + QVariantMap extra = data["extra"].toMap(); + QCOMPARE(extra.size(), 13); + QCOMPARE(extra["boolean"].toBool(), true); + + } }; QTEST_MAIN(ModelTest) |