summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-05-19 10:09:58 -0500
committerFederico Mena Quintero <federico@gnome.org>2022-05-19 10:50:48 -0500
commit711ee915e04815cfea6529120587e8e447038de4 (patch)
treed24c199daeaced5e88af5d9a05f23d911152776f /test
parent9dbffc38e5c13aa6e0e0b234d8f6b3c431d62c3c (diff)
downloadat-spi2-core-711ee915e04815cfea6529120587e8e447038de4.tar.gz
Rename test directory to tests
at-spi2-core had a "test" directory, while atk has "tests". This is so that both directory names will be the same during the merge.
Diffstat (limited to 'test')
-rw-r--r--test/memory.c99
-rw-r--r--test/meson.build13
-rw-r--r--test/test-application.c105
3 files changed, 0 insertions, 217 deletions
diff --git a/test/memory.c b/test/memory.c
deleted file mode 100644
index 54f06524..00000000
--- a/test/memory.c
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "atspi/atspi.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-pid_t child_pid;
-AtspiEventListener *listener;
-
-void
-basic (AtspiAccessible *obj)
-{
- gchar *str;
- gint count;
- gint i;
- AtspiAccessible *accessible;
- GError *error = NULL;
-
- printf ("getting name\n");
- str = atspi_accessible_get_name (obj, &error);
- if (str)
- g_free (str);
- printf ("ok, getting parent\n");
- accessible = atspi_accessible_get_parent (obj, NULL);
- if (accessible)
- g_object_unref (accessible);
- printf ("ok, getting children\n");
- count = atspi_accessible_get_child_count (obj, &error);
- for (i = 0; i < count; i++)
- {
- accessible = atspi_accessible_get_child_at_index (obj, i, &error);
- printf ("ok %d\n", i);
- if (accessible)
- g_object_unref (accessible);
- }
- printf ("ok\n");
-}
-
-static gboolean
-end (void *data)
-{
- atspi_event_quit ();
- atspi_exit ();
- exit (0);
-}
-
-static gboolean
-kill_child (void *data)
-{
- g_assert_no_errno (kill (child_pid, SIGTERM));
- return FALSE;
-}
-
-void
-on_event (AtspiEvent *event, void *data)
-{
- if (atspi_accessible_get_role (event->source, NULL) == ATSPI_ROLE_DESKTOP_FRAME)
- {
- printf ("memory: event: %s\n", event->type);
- if (strstr (event->type, "add"))
- {
- AtspiAccessible *desktop = atspi_get_desktop (0);
- guint id;
- basic (desktop);
- g_object_unref (desktop);
- id = g_timeout_add (3000, kill_child, NULL);
- g_source_set_name_by_id (id, "[at-spi2-core] kill_child");
- }
- else
- {
- guint id;
- id = g_idle_add (end, NULL);
- g_source_set_name_by_id (id, "[at-spi2-core] end");
- }
- }
- g_boxed_free (ATSPI_TYPE_EVENT, event);
-}
-
-int
-main()
-{
- atspi_init ();
-
- listener = atspi_event_listener_new (on_event, NULL, NULL);
- atspi_event_listener_register (listener, "object:children-changed", NULL);
- child_pid = fork ();
- if (child_pid == 0)
- {
- g_assert_no_errno (execlp ("test/test-application", "test/test-application", NULL));
- }
- else if (child_pid == -1)
- {
- const char *error = g_strerror (errno);
- g_error ("could not fork test-application child: %s", error);
- }
- printf ("memory: child pid: %d\n", (int) child_pid);
- atspi_event_main ();
- return 0;
-}
diff --git a/test/meson.build b/test/meson.build
deleted file mode 100644
index cd3db669..00000000
--- a/test/meson.build
+++ /dev/null
@@ -1,13 +0,0 @@
-testapp = executable('test-application',
- 'test-application.c',
- include_directories: root_inc,
- dependencies: [ atspi_dep ],
- )
-
-memory = executable('memory',
- 'memory.c',
- include_directories: root_inc,
- dependencies: [ atspi_dep ],
- )
-
-test('memory', memory, depends: testapp)
diff --git a/test/test-application.c b/test/test-application.c
deleted file mode 100644
index 621d1de4..00000000
--- a/test/test-application.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Simple test application for AT-SPI.
- *
- * The only thing this application does, is registering itself to the AT-SPI
- * registry and then waiting to get killed by some external force.
- */
-
-#include <stdio.h>
-#include <glib.h>
-#include <dbus/dbus.h>
-#include <atspi/atspi.h>
-
-static GMainLoop *mainloop;
-
-int
-register_app ()
-{
- DBusConnection *connection = NULL;
- DBusMessage *message;
- DBusMessageIter iter;
- DBusMessageIter subiter;
- DBusError error;
- DBusMessage *reply;
- const gchar *name;
- gchar *path;
-
-
- /* Set up D-Bus connection and register bus name */
- dbus_error_init (&error);
- connection = atspi_get_a11y_bus ();
- if (!connection)
- {
- printf("Couldn't get a11y bus!\n");
- return -1;
- }
-
- /* Register this app by sending a signal out to AT-SPI registry daemon */
- message = dbus_message_new_method_call (ATSPI_DBUS_NAME_REGISTRY,
- ATSPI_DBUS_PATH_ROOT,
- ATSPI_DBUS_INTERFACE_SOCKET,
- "Embed");
-
- dbus_message_iter_init_append (message, &iter);
-
- name = dbus_bus_get_unique_name (connection);
- path = g_strdup (ATSPI_DBUS_PATH_NULL);
-
- dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL,
- &subiter);
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &name);
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_OBJECT_PATH, &path);
- dbus_message_iter_close_container (&iter, &subiter);
-
- g_free (path);
-
- reply = dbus_connection_send_with_reply_and_block(connection, message, -1, &error);
- if (!reply)
- {
- printf("Did not get a reply from the registry.\n");
- dbus_message_unref (message);
- dbus_error_free (&error);
- return -1;
- }
-
- dbus_message_unref (message);
- dbus_message_unref (reply);
- dbus_error_free (&error);
- return 0;
-}
-
-int main (int argc, char *argv[])
-{
- int ret = register_app ();
- if (ret) {
- printf("Failed to send dbus signals. Aborting.\n");
- return ret;
- }
-
- // This keeps the test-application runnig indefinitely, i.e.
- // until killed by an external signal.
- mainloop = g_main_loop_new (NULL, FALSE);
- g_main_loop_run (mainloop);
-
- return 0;
-}