diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 15:18:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 15:18:46 +0000 |
commit | 56294d30a82ec2da6f9ce399740c1ef65a9ddef4 (patch) | |
tree | bbe3823e41495d026ba8edc6eeaef166edb7e2a2 /tests/actions.py | |
parent | Initial commit. (diff) | |
download | gnome-software-56294d30a82ec2da6f9ce399740c1ef65a9ddef4.tar.xz gnome-software-56294d30a82ec2da6f9ce399740c1ef65a9ddef4.zip |
Adding upstream version 3.38.1.upstream/3.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/actions.py')
-rwxr-xr-x | tests/actions.py | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/actions.py b/tests/actions.py new file mode 100755 index 0000000..da0887e --- /dev/null +++ b/tests/actions.py @@ -0,0 +1,68 @@ +#! /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 +from gi.repository import Gio + +settings = Gio.Settings.new("org.gnome.desktop.interface") +settings.set_boolean ("toolkit-accessibility", True) + +from dogtail.tree import * +from dogtail.utils import * +from dogtail.procedural import * +from dogtail.rawinput import keyCombo + +try: + run('gnome-software') + + app = root.application('gnome-software') + + bus = Gio.bus_get_sync(Gio.BusType.SESSION, None) + proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, + None, + 'org.gnome.Software', + '/org/gnome/Software', + 'org.gtk.Application') + proxy.call_sync('Activate', GLib.Variant('(a{sv})', ({},)), 0, -1, None) + + doDelay(1) + try: + shopping_button = app.child(name=u'Let\u2019s Go Shopping', retry=False) + shopping_button.click() + except tree.SearchError: + print "not first-run, moving on" + + doDelay(1) + assert (len(app.children) == 1) + + dbus_actions = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, + None, + 'org.gnome.Software', + '/org/gnome/Software', + 'org.gtk.Actions') + + names = dbus_actions.call_sync('List', None, 0, -1, None).unpack()[0] + assert (u'quit' in names) + assert (u'about' in names) + + dbus_actions.call_sync('Activate', + GLib.Variant('(sava{sv})', (u'about', [], {})), + 0, -1, None) + + doDelay (1) + assert (len(app.children) == 2) + keyCombo("<Esc>") + doDelay (1) + assert (len(app.children) == 1) + + dbus_actions.call_sync('Activate', + GLib.Variant('(sava{sv})', (u'quit', [], {})), + 0, -1, None) + assert (len(app.children) == 0) +finally: + os.system("killall gnome-software") |