diff options
author | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-09-13 18:09:26 -0300 |
---|---|---|
committer | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-09-13 18:09:26 -0300 |
commit | 7dec723ad070fea717a8c235eeada0889615ab6a (patch) | |
tree | d15dcfaf383a22a5578ed6ecd5fea8b4b27abe66 /tests/client | |
parent | a03360ce3fa4b2de50917188a8a816992e864ba1 (diff) | |
download | qmenumodel-7dec723ad070fea717a8c235eeada0889615ab6a.tar.gz qmenumodel-7dec723ad070fea717a8c235eeada0889615ab6a.tar.bz2 qmenumodel-7dec723ad070fea717a8c235eeada0889615ab6a.zip |
Appended comments on unit test.
Added 'valid' property in QStateAction.
Diffstat (limited to 'tests/client')
-rw-r--r-- | tests/client/actiongrouptest.cpp | 52 | ||||
-rw-r--r-- | tests/client/menuchangestest.cpp | 3 | ||||
-rw-r--r-- | tests/client/modeltest.cpp | 15 |
3 files changed, 69 insertions, 1 deletions
diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index 6fc2f82..fa2dca5 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -64,6 +64,9 @@ private Q_SLOTS: m_script.unpublishMenu(); } + /* + * Test if the propety busType handle correct integer values + */ void testBusTypeProperty() { m_actionGroup.setProperty("busType", 1); @@ -79,6 +82,10 @@ private Q_SLOTS: QCOMPARE(m_actionGroup.busType(), QDBusObject::SystemBus); } + /* + * Test if QDBusActionGroup change to correct state after DBus + * ervice appear + */ void testServiceAppear() { m_model.start(); @@ -93,6 +100,10 @@ private Q_SLOTS: QCOMPARE(m_actionGroup.count(), 0); } + /* + * Test if QDBusActionGroup change to correct state after DBus + * service disappear + */ void testServiceDisappear() { m_model.start(); @@ -116,6 +127,9 @@ private Q_SLOTS: QCOMPARE(m_actionGroup.status(), QDBusObject::Disconnected); } + /* + * Test if Action::trigger active the action over DBus + */ void testActiveAction() { // start model @@ -139,6 +153,9 @@ private Q_SLOTS: QCOMPARE(m_script.popActivatedAction(), QString("Menu1Act")); } + /* + * Test if Action became invalid after desappear from DBus + */ void testRemoveAction() { // start model @@ -150,9 +167,42 @@ private Q_SLOTS: m_script.walk(2); QCOMPARE(m_actionGroup.count(), 2); + // Get Action + QStateAction *act = m_actionGroup.action(QString("Menu1Act")); + QVERIFY(act); + QVERIFY(act->isValid()); + // Remove 1 menu m_script.walk(1); - QCOMPARE(m_actionGroup.count(), 1); + QCOMPARE(m_actionGroup.count(), 2); + + //Check if action is invalid + QVERIFY(!act->isValid()); + } + + /* + * Test if Action became valid after service appears + */ + void testActionIsValid() + { + // start model + m_model.start(); + m_actionGroup.start(); + + // Make menu available and append 2 menus + m_script.publishMenu(); + + // Get invalid Action + QStateAction *act = m_actionGroup.action(QString("Menu1Act")); + QVERIFY(act); + QVERIFY(!act->isValid()); + QVERIFY(!act->state().isValid()); + + // Append menus + m_script.walk(2); + + // Action appear + QVERIFY(act->isValid()); } }; diff --git a/tests/client/menuchangestest.cpp b/tests/client/menuchangestest.cpp index c2dc66a..64c1729 100644 --- a/tests/client/menuchangestest.cpp +++ b/tests/client/menuchangestest.cpp @@ -56,6 +56,9 @@ private Q_SLOTS: m_script.unpublishMenu(); } + /* + * Test it the model updates correct after remove or add a new menu + */ void testMenuItemAppend() { m_script.publishMenu(); diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp index 347676e..ee3e0f4 100644 --- a/tests/client/modeltest.cpp +++ b/tests/client/modeltest.cpp @@ -56,16 +56,25 @@ private Q_SLOTS: m_script.unpublishMenu(); } + /* + * Test if columnCount is always 1 + */ void testColumnCount() { QCOMPARE(m_model.columnCount(), 1); } + /* + * Test if parent function always return a empty QModelIndex + */ void testParent() { QCOMPARE(m_model.parent(QModelIndex()), QModelIndex()); } + /* + * Test if the propety busType handle correct integer values + */ void testBusTypeProperty() { m_model.setProperty("busType", 1); @@ -82,6 +91,9 @@ private Q_SLOTS: } + /* + * Test if model return the correct values for standard properties + */ void testData() { // Make menu available @@ -127,6 +139,9 @@ private Q_SLOTS: QCOMPARE(submenu->rowCount(), 2); } + /* + * Test if the model parse correct GVariant values types + */ void testExtraData() { // Make menu available |