From a1ef182d759122a649257607e25d7bec82f41457 Mon Sep 17 00:00:00 2001 From: billh Date: Thu, 13 Jun 2002 17:54:37 +0000 Subject: [PATCH 1/1] Add missing test source file. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@315 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- test/stress-test.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 test/stress-test.c diff --git a/test/stress-test.c b/test/stress-test.c new file mode 100644 index 0000000..fdc0f8e --- /dev/null +++ b/test/stress-test.c @@ -0,0 +1,98 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "../cspi/spi-private.h" /* A hack for now */ +#include +#include +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + int i; + Accessibility_Event e; + Accessibility_Registry registry; + CORBA_Environment ev; + SpiAccessible *source; + GObject *object; + AtkObject *atko; + GTimer *timer; + gdouble elapsed_time; + + gtk_init (&argc, &argv); + SPI_init (); + object = g_object_new (GTK_TYPE_BUTTON, NULL); + atko = atk_no_op_object_new (object); + + sleep (1); + + g_print ("starting stress test...\n"); + + CORBA_exception_init (&ev); + + registry = bonobo_activation_activate_from_id ( + "OAFIID:Accessibility_Registry:1.0", 0, NULL, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + { + g_error ("Accessibility app error: exception during " + "registry activation from id: %s\n", + CORBA_exception_id (&ev)); + CORBA_exception_free (&ev); + } + + if (registry == CORBA_OBJECT_NIL) + { + g_error ("Could not locate registry"); + } + + bonobo_activate (); + + source = spi_accessible_new (atko); + + e.type = "focus:"; + e.source = BONOBO_OBJREF (source); + e.detail1 = 0; + e.detail2 = 0; + + timer = g_timer_new (); + g_timer_start (timer); + + for (i = 0; i < 10000; ++i) { + Accessibility_Accessible_ref (e.source, &ev); + Accessibility_Registry_notifyEvent (registry, &e, &ev); + } + g_timer_stop (timer); + g_print ("%d notifications sent in %f sec.\n", i, + g_timer_elapsed (timer, NULL)); + + SPI_event_main (); + + sleep (15); + + return SPI_exit (); +} + -- 2.7.4