diff options
author | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-11-23 10:22:04 -0300 |
---|---|---|
committer | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-11-23 10:22:04 -0300 |
commit | 5d755f40091afb5e1f2c4db1c7ba75c36e2d4a74 (patch) | |
tree | e1e11abb3c39c5fdaaa909ba718ee00a82fc6a70 /tests/client | |
parent | 41f6ce552a513644a90793a8bba15ef5761821cc (diff) | |
download | qmenumodel-5d755f40091afb5e1f2c4db1c7ba75c36e2d4a74.tar.gz qmenumodel-5d755f40091afb5e1f2c4db1c7ba75c36e2d4a74.tar.bz2 qmenumodel-5d755f40091afb5e1f2c4db1c7ba75c36e2d4a74.zip |
Create unit test for name property and activate function.
Diffstat (limited to 'tests/client')
-rw-r--r-- | tests/client/actiongrouptest.cpp | 9 | ||||
-rwxr-xr-x | tests/client/script_actiongrouptest.py | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index 3e0065f..d187ea7 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -141,11 +141,16 @@ private Q_SLOTS: QStateAction *act = m_actionGroup.action(action.toString()); QVERIFY(act); - act->activate(); + // test action name + QCOMPARE(act->property("name").toString(), QString("Menu1Act")); + + act->activate(QVariant("42")); // wait for dbus propagation QTest::qWait(500); - QCOMPARE(m_script.popActivatedAction(), QString("Menu1Act")); + QPair<QString, QVariant> result = m_script.popActivatedAction(); + QCOMPARE(result.first, QString("Menu1Act")); + QCOMPARE(result.second.toString(), QString("42")); } /* diff --git a/tests/client/script_actiongrouptest.py b/tests/client/script_actiongrouptest.py index 2af4841..bb54dae 100755 --- a/tests/client/script_actiongrouptest.py +++ b/tests/client/script_actiongrouptest.py @@ -3,10 +3,11 @@ import time from gi.repository import GLib from menuscript import Script, ActionList, MENU_OBJECT_PATH +from gi._gi import variant_type_from_string al = ActionList(MENU_OBJECT_PATH) -al.appendItem("Menu0", "Menu0Act") -al.appendItem("Menu1", "Menu1Act") +al.appendItem("Menu0", "Menu0Act", actionStateType=variant_type_from_string('s')) +al.appendItem("Menu1", "Menu1Act", actionStateType=variant_type_from_string('s')) al.removeItem("1", "Menu1Act") t = Script.create(al) |