Added tests for Value interface, and upgraded i18n macro.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Sun, 9 Dec 2001 23:30:27 +0000 (23:30 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Sun, 9 Dec 2001 23:30:27 +0000 (23:30 +0000)
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@152 e2bd861d-eb25-0410-b326-f6ed22b6b98c

test/simple-at.c
test/test-simple.c
util/Makefile.am

index 1e66ef1..3fbf9fe 100644 (file)
@@ -30,6 +30,7 @@
 #include "../cspi/spi-private.h" /* A hack for now */
 
 static void report_focus_event    (AccessibleEvent *event, void *user_data);
+static void report_generic_event  (AccessibleEvent *event, void *user_data);
 static void report_button_press   (AccessibleEvent *event, void *user_data);
 static void check_property_change (AccessibleEvent *event, void *user_data);
 static SPIBoolean report_command_key_event  (AccessibleKeystroke *stroke, void *user_data);
@@ -46,6 +47,7 @@ static SPIBoolean festival_chatty = FALSE;
 
 static AccessibleEventListener *focus_listener;
 static AccessibleEventListener *property_listener;
+static AccessibleEventListener *generic_listener;
 static AccessibleEventListener *button_listener;
 static AccessibleKeystrokeListener *command_key_listener;
 static AccessibleKeystrokeListener *ordinary_key_listener;
@@ -71,9 +73,16 @@ main (int argc, char **argv)
 
   focus_listener = createAccessibleEventListener (report_focus_event, NULL);
   property_listener = createAccessibleEventListener (check_property_change, NULL); 
+  generic_listener = createAccessibleEventListener (report_generic_event, NULL); 
   button_listener = createAccessibleEventListener (report_button_press, NULL);
   registerGlobalEventListener (focus_listener, "focus:");
   registerGlobalEventListener (property_listener, "object:property-change:accessible-selection"); 
+  registerGlobalEventListener (generic_listener, "object:selection-changed"); 
+  registerGlobalEventListener (generic_listener, "object:children-changed"); 
+  registerGlobalEventListener (generic_listener, "object:visible-data-changed"); 
+  registerGlobalEventListener (generic_listener, "object:text-selection-changed"); 
+  registerGlobalEventListener (generic_listener, "object:text-caret-moved"); 
+  registerGlobalEventListener (generic_listener, "object:text-changed"); 
   registerGlobalEventListener (button_listener, "Gtk:GtkWidget:button-press-event");
   n_desktops = getDesktopCount ();
 
@@ -154,14 +163,12 @@ report_focussed_accessible (Accessible *obj, SPIBoolean shutup_previous_speech)
   char *s;
   int len;
 
-  g_warning ("Report focused !");
-
   if (use_festival)
     {
-    if (festival_chatty)           
-      {
-        _festival_say (Accessible_getRole (obj), "voice_don_diphone", shutup_previous_speech);
-      }
+      if (festival_chatty)         
+        {
+          _festival_say (Accessible_getRole (obj), "voice_don_diphone", shutup_previous_speech);
+        }
       fprintf (stderr, "getting Name\n");
       s = Accessible_getName (obj);
       _festival_say (s, "voice_kal_diphone",
@@ -181,6 +188,15 @@ report_focussed_accessible (Accessible *obj, SPIBoolean shutup_previous_speech)
              magnifier_set_roi ((short) 0, x, y, width, height);
       }
     }
+
+  if (Accessible_isValue (obj))
+    {
+      AccessibleValue *value = Accessible_getValue (obj);
+      fprintf (stderr, "Current value = %f, min = %f; max = %f\n",
+               AccessibleValue_getCurrentValue (value),
+               AccessibleValue_getMinimumValue (value),
+              AccessibleValue_getMaximumValue (value));
+    }
   /* if this is a text object, speak the first sentence. */
 
   if (Accessible_isText(obj))
@@ -208,12 +224,10 @@ report_focus_event (AccessibleEvent *event, void *user_data)
 {
   char *s;
 
-  g_warning ("report focus event");
-
   g_return_if_fail (event->source != NULL);
 
   s = Accessible_getName (event->source);
-  if (cspi_warn_ev (cspi_ev (), "Foobar"))
+  if (cspi_warn_ev (cspi_ev (), "Report focus event"))
     {
       fprintf (stderr, "%s event from %s\n", event->type, s);
       SPI_freeString (s);
@@ -223,6 +237,12 @@ report_focus_event (AccessibleEvent *event, void *user_data)
 }
 
 void
+report_generic_event (AccessibleEvent *event, void *user_data)
+{
+  fprintf (stderr, "%s event received\n", event->type);
+}
+
+void
 report_button_press (AccessibleEvent *event, void *user_data)
 {
   char *s;
@@ -274,13 +294,17 @@ simple_at_exit ()
   deregisterGlobalEventListenerAll (property_listener);
   AccessibleEventListener_unref    (property_listener);
 
+  deregisterGlobalEventListenerAll (generic_listener);
+  AccessibleEventListener_unref    (generic_listener);
+
   deregisterGlobalEventListenerAll (button_listener);
   AccessibleEventListener_unref    (button_listener);
 
   deregisterAccessibleKeystrokeListener (command_key_listener, SPI_KEYMASK_ALT);
+  AccessibleKeystrokeListener_unref (command_key_listener);
+
   deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_UNMODIFIED);
   deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_SHIFT);
-  AccessibleKeystrokeListener_unref (command_key_listener);
   AccessibleKeystrokeListener_unref (ordinary_key_listener);
   
   SPI_event_quit ();
index b74e37e..cb1414d 100644 (file)
@@ -210,6 +210,41 @@ test_text (AccessibleText *text)
 }
 
 static void
+test_value (AccessibleValue *value)
+{
+       char *str;
+       float original_value;
+       
+        /* Note: test_value assertions are known not to work as of Dec 09 */
+       
+       fprintf (stderr, "Testing value ...\n");
+
+       original_value = AccessibleValue_getCurrentValue (value);
+       
+       g_assert (AccessibleValue_getCurrentValue (value) <=
+                 AccessibleValue_getMaximumValue (value));
+
+       g_assert (AccessibleValue_getCurrentValue (value) >=
+                 AccessibleValue_getMinimumValue (value));
+
+       AccessibleValue_setCurrentValue (value, 
+                 AccessibleValue_getMinimumValue (value));
+       
+       g_assert (AccessibleValue_getCurrentValue (value) ==
+                 AccessibleValue_getMinimumValue (value));
+
+       AccessibleValue_setCurrentValue (value, 
+                 AccessibleValue_getMaximumValue (value));
+       
+       g_assert (AccessibleValue_getCurrentValue (value) ==
+                 AccessibleValue_getMaximumValue (value));
+
+       AccessibleValue_setCurrentValue (value, original_value);
+       
+       g_assert (AccessibleValue_getCurrentValue (value) == original_value);
+}
+
+static void
 test_component (AccessibleComponent *component)
 {
        long x, y, width, height;
@@ -273,7 +308,7 @@ validate_tree (Accessible *accessible,
                g_assert (parent != NULL);
 
                index = Accessible_getIndexInParent (accessible);
-               g_assert (index >= 0);
+               g_assert (index >= 0); 
 
                child_at_index = Accessible_getChildAtIndex (parent, index);
 
@@ -410,6 +445,16 @@ validate_accessible (Accessible *accessible,
                AccessibleText_unref (tmp);
        }
 
+       if (Accessible_isValue (accessible)) {
+               tmp = Accessible_getValue (accessible);
+               g_assert (tmp != NULL);
+               if (print_tree)
+                       fprintf (stderr, "Va");
+               else
+                       ; /* test_value (tmp); */
+               AccessibleValue_unref (tmp);
+       }
+
        if (print_tree)
                fprintf (stderr, " ] '%s' (%s) - %s:\n", name, descr, role);
 
index 1fbb32d..6f85795 100644 (file)
@@ -58,7 +58,7 @@ LDADD = $(UTILS_LIBS) -L$(prefix)/lib -lgdk_pixbuf_xlib-1.3
 serverinfodir = $(libdir)/bonobo/servers
 serverinfo_DATA = Accessibility_Util.server
 
-@XML_I18N_MERGE_SERVER_RULE@
+@INTLTOOL_SERVER_RULE@
 
 EXTRA_DIST = Accessibility_Util.server.in $(serverinfo_DATA) $(idl_DATA)