1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
Description: Skip test for now, broken.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Forwarded: not needed, Debian-specific
Abstract:
This test needs love and someone with more time than I have
to fix it. All-in-all onboard upstream has been inactive for
a while, so let's ignore this test silently for now until
some new upstream maintainer comes up.
--- a/Onboard/test/test_dbus_service.py
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright © 2012-2013, 2016 marmuta <marmvta@gmail.com>
-#
-# This file is part of Onboard.
-#
-# Onboard is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Onboard is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-import subprocess
-from contextlib import contextmanager
-
-import dbus
-import time
-from dbus.mainloop.glib import DBusGMainLoop
-
-from gi.repository import GLib
-
-
-class TestDBusService(unittest.TestCase):
-
- def test_service(self):
- DBUS_NAME = "org.onboard.Onboard"
- DBUS_PATH = "/org/onboard/Onboard/Keyboard"
- DBUS_IFACE = "org.onboard.Onboard.Keyboard"
-
- bus = dbus.SessionBus(mainloop=DBusGMainLoop())
-
- try:
- process = subprocess.Popen(["./onboard"])
- self.wait_name_owner_changed(bus, DBUS_NAME)
- self.assertTrue(bus.name_has_owner(DBUS_NAME))
-
- proxy = bus.get_object(DBUS_NAME, DBUS_PATH)
- keyboard = dbus.Interface(proxy, DBUS_IFACE)
- keyboard_props = dbus.Interface(proxy, dbus.PROPERTIES_IFACE)
-
- keyboard.Show()
- time.sleep(0.5)
- self.assertEqual(keyboard_props.Get(DBUS_IFACE, "Visible"), True)
-
- with self.wait_property_changed(keyboard_props, "Visible"):
- keyboard.Hide()
- self.assertEqual(keyboard_props.Get(DBUS_IFACE, "Visible"), False)
-
- with self.wait_property_changed(keyboard_props, "Visible"):
- keyboard.Show()
- self.assertEqual(keyboard_props.Get(DBUS_IFACE, "Visible"), True)
-
- with self.wait_property_changed(keyboard_props, "Visible"):
- keyboard.ToggleVisible()
- self.assertEqual(keyboard_props.Get(DBUS_IFACE, "Visible"), False)
-
- with self.wait_property_changed(keyboard_props, "Visible"):
- keyboard.ToggleVisible()
- self.assertEqual(keyboard_props.Get(DBUS_IFACE, "Visible"), True)
- finally:
- process.terminate()
-
- @staticmethod
- def wait_name_owner_changed(bus, name):
-
- def on_name_owner_changed(name, old, new):
- if not old:
- loop.quit()
-
- bus.add_signal_receiver(on_name_owner_changed,
- "NameOwnerChanged",
- dbus.BUS_DAEMON_IFACE,
- arg0 = name)
- loop = GLib.MainLoop()
- loop.run()
-
- @staticmethod
- @contextmanager
- def wait_property_changed(iface, property):
-
- def on_signal(iface, changed, invalidated):
- if property in changed:
- loop.quit()
-
- iface.connect_to_signal("PropertiesChanged", on_signal)
-
- yield None
-
- loop = GLib.MainLoop()
- loop.run()
-
-
-if __name__ == "__main__":
- unittest.main()
|