aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2012-11-28 20:19:42 -0300
committerRenato Araujo Oliveira Filho <renato.filho@canonical.com>2012-11-28 20:19:42 -0300
commit08b143ccdf437ce2e52cdc22b66487d5ba3e22c5 (patch)
treec061b8fad9a14ffce586f52146a75eb3c909c08a
parent236259bc2ae2efc5ad2bac4a0eca76ebdb8293e8 (diff)
downloadqmenumodel-08b143ccdf437ce2e52cdc22b66487d5ba3e22c5.tar.gz
qmenumodel-08b143ccdf437ce2e52cdc22b66487d5ba3e22c5.tar.bz2
qmenumodel-08b143ccdf437ce2e52cdc22b66487d5ba3e22c5.zip
Created unit test for get data function.
-rw-r--r--tests/client/modeltest.cpp38
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)