[at-spi2-core: 9/11] registry.c: Fix name of the Version property in the Application interface




commit 18d35ab91b05d98721fe53d909ca6109a2e8dd95
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Jul 13 20:03:01 2022 -0500

    registry.c: Fix name of the Version property in the Application interface
    
    The code listed it as ToolkitVersion, but atspi, atk-adaptor, and gtk4
    all use Version.  Application.xml also uses Version.
    
    This commit also introduces a test for that Version property in the
    Application interface.

 registryd/registry.c                     |  2 +-
 tests/registryd/test_root_application.py | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/registryd/registry.c b/registryd/registry.c
index 5e08f6e4..7a8e62dc 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -1161,7 +1161,7 @@ handle_method_root (DBusConnection *bus, DBusMessage *message, void *user_data)
                 {
                   if (!strcmp (prop_member, "ToolkitName"))
                     impl_get_ToolkitName (&iter, registry);
-                  else if (!strcmp (prop_member, "ToolkitVersion"))
+                  else if (!strcmp (prop_member, "Version"))
                     impl_get_ToolkitVersion (&iter, registry);
                   else
                     {
diff --git a/tests/registryd/test_root_application.py b/tests/registryd/test_root_application.py
new file mode 100644
index 00000000..bf7adb89
--- /dev/null
+++ b/tests/registryd/test_root_application.py
@@ -0,0 +1,27 @@
+# Pytest will pick up this module automatically when running just "pytest".
+#
+# Each test_*() function gets passed test fixtures, which are defined
+# in conftest.py.  So, a function "def test_foo(bar)" will get a bar()
+# fixture created for it.
+
+import pytest
+import dbus
+
+PROPERTIES_IFACE = 'org.freedesktop.DBus.Properties'
+APPLICATION_IFACE = 'org.a11y.atspi.Application'
+
+def get_property(proxy, iface_name, prop_name):
+    return proxy.Get(iface_name, prop_name, dbus_interface=PROPERTIES_IFACE)
+
+def test_application_iface_properties(registry_root, session_manager):
+    values = [
+        ('ToolkitName',  'at-spi-registry'),
+        ('Version',      '2.0'),
+    ]
+
+    for prop_name, expected in values:
+        assert get_property(registry_root, APPLICATION_IFACE, prop_name) == expected
+
+def test_unknown_property_yields_error(registry_root, session_manager):
+    with pytest.raises(dbus.exceptions.DBusException):
+        get_property(registry_root, APPLICATION_IFACE, 'NonexistentProperty')


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