aboutsummaryrefslogtreecommitdiff
path: root/tests/client/modeltest.cpp
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2013-01-14 15:57:10 +0000
committerTarmac <>2013-01-14 15:57:10 +0000
commitc53b046b63eae52ab73bb2a63f3fddb36ecc3178 (patch)
tree5678eb9b299cd80606552ae339315c8416309119 /tests/client/modeltest.cpp
parent84b4e669800748dbb1b270fbf2e73c299871ac73 (diff)
parent00bd7d43ec3b7af1e5d4534fa74e1cf6e004bd56 (diff)
downloadqmenumodel-c53b046b63eae52ab73bb2a63f3fddb36ecc3178.tar.gz
qmenumodel-c53b046b63eae52ab73bb2a63f3fddb36ecc3178.tar.bz2
qmenumodel-c53b046b63eae52ab73bb2a63f3fddb36ecc3178.zip
Implemented QMenuModel as tree model.
Sections and SubMenus are exported as tree. Fixes: https://bugs.launchpad.net/bugs/1090305. Approved by Gustavo Pichorim Boiko, PS Jenkins bot.
Diffstat (limited to 'tests/client/modeltest.cpp')
-rw-r--r--tests/client/modeltest.cpp52
1 files changed, 1 insertions, 51 deletions
diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp
index 017f859..7bc9706 100644
--- a/tests/client/modeltest.cpp
+++ b/tests/client/modeltest.cpp
@@ -117,22 +117,9 @@ private Q_SLOTS:
QCOMPARE(action.type(), QVariant::String);
QCOMPARE(action.toString(), QString("Menu1Act"));
- // Section (QObject)
- QVariant vSection = m_model.data(m_model.index(2, 0), QMenuModel::LinkSection);
- QVERIFY(vSection.isValid());
- QMenuModel *section = qobject_cast<QMenuModel*>(vSection.value<QObject*>());
- QVERIFY(section);
- QCOMPARE(section->rowCount(), 2);
-
- // SubMenu (QObject)
- QVariant vSubMenu = m_model.data(m_model.index(3, 0), QMenuModel::LinkSubMenu);
- QVERIFY(vSubMenu.isValid());
- QMenuModel *submenu = qobject_cast<QMenuModel*>(vSubMenu.value<QObject*>());
- QVERIFY(submenu);
-
// Wait for menu load (submenus are loaded async)
QTest::qWait(500);
- QCOMPARE(submenu->rowCount(), 2);
+ QCOMPARE(m_model.rowCount(m_model.index(2, 0)), 2);
}
/*
@@ -251,43 +238,6 @@ 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)