[gnome-software] Add a test for actions



commit 5921f147363863163d1454fe9021f9c6fc9ca041
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 20 19:26:10 2013 -0500

    Add a test for actions

 tests/actions.py |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/tests/actions.py b/tests/actions.py
new file mode 100644
index 0000000..002ad80
--- /dev/null
+++ b/tests/actions.py
@@ -0,0 +1,42 @@
+#! /usr/bin/python
+
+# This a simple test, using the dogtail framework:
+#
+# Activate the app via the org.gtk.Application bus interface.
+# Check that the expected actions are exported on the session bus.
+# Activate each action and verify the result.
+
+import os
+import dbus
+from dogtail.tree import *
+from dogtail.utils import *
+from dogtail.procedural import *
+
+#run('gnome-software')
+
+app = root.application('org.gnome.Software');
+
+bus = dbus.SessionBus()
+proxy = bus.get_object('org.gnome.Software', '/org/gnome/Software')
+dbus_app = dbus.Interface(proxy, 'org.gtk.Application')
+dbus_app.Activate([])
+
+doDelay(1)
+assert (len(app.children) == 1)
+
+dbus_actions = dbus.Interface(proxy, 'org.gtk.Actions')
+
+names = dbus_actions.List()
+assert (u'quit' in names)
+assert (u'about' in names)
+
+dbus_actions.Activate(u'about', [], [])
+
+doDelay (1)
+assert (len(app.children) == 2)
+app.dialog('About Software').child('Close').click()
+doDelay (1)
+assert (len(app.children) == 1)
+
+dbus_actions.Activate(u'quit', [], [])
+assert (len(app.children) == 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]