Exemplo n.º 1
0
int main(int argc, gchar **argv)
{
  gint i;
  AtspiAccessible *desktop = NULL;
  AtspiAccessible *app = NULL;
  gchar *app_name = NULL;
  gboolean found = FALSE;

  app_name = parse_args (&argc, &argv);
  if (!app_name) {
    g_print ("ERROR: We only dump the content of a specific app, specify the name\n");
    return 0;
  }

  atspi_init ();

  desktop = atspi_get_desktop (0);
  for (i = 0; i < atspi_accessible_get_child_count (desktop, NULL); i++) {
    app = atspi_accessible_get_child_at_index (desktop, i, NULL);
    if (!g_strcmp0 (atspi_accessible_get_name (app, NULL), app_name)) {
      found = TRUE;
      dump_node_content (app, "  ");
    }
    g_object_unref (app);
  }

  if (!found) {
    g_print ("ERROR: Application \"%s\" not found\n", app_name);
    return 0;
  }

  return 1;
}
Exemplo n.º 2
0
AtspiAccessible * get_root_obj (const char *file_name)
{
  int i;
  AtspiAccessible *obj = NULL;

  run_app (file_name);

  /* sleep is needed to wait for fored test application*/
  sleep (1);

  obj = atspi_get_desktop (0);
  gint child_count = atspi_accessible_get_child_count (obj, NULL);
  if (child_count < 1) {
    g_test_message ("Fail, test application not found\n");
    g_test_fail ();
    kill (child_pid, SIGTERM);
    return NULL;
  }

  for (i=0; i<child_count; i++) {
    AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,i, NULL);
    if (!strcmp (atspi_accessible_get_name (child, NULL), "root_object"))
      return child;
  }
  g_test_message ("test object not found\n");
  g_test_fail ();

  kill (child_pid, SIGTERM);
  return NULL;
}
static GRefPtr<AtspiAccessible> findTestServerApplication()
{
    // Only one desktop is supported by ATSPI at the moment.
    GRefPtr<AtspiAccessible> desktop = adoptGRef(atspi_get_desktop(0));

    // Look for the server application in the list of apps.
    GRefPtr<AtspiAccessible> current;
    int childCount = atspi_accessible_get_child_count(desktop.get(), 0);
    for (int i = 0; i < childCount; i++) {
        current = adoptGRef(atspi_accessible_get_child_at_index(desktop.get(), i, 0));
        if (!g_strcmp0(atspi_accessible_get_name(current.get(), 0), kTestServerAppName))
            return current;
    }

    return 0;
}
Exemplo n.º 4
0
void
on_event (AtspiEvent *event, void *data)
{
  if (atspi_accessible_get_role (event->source, NULL) == ATSPI_ROLE_DESKTOP_FRAME)
  {
    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);
}