Re: [g-a-devel]test-simple in at-spi



Revised patch attached.
Padraig


> On Wed, 2003-01-15 at 15:57, Padraig O'Briain wrote:
> > When running this program I came across a problem because GailButton now 
> > implements AtkText interface.
> > 
> > The attached patch gets around that problem. OK to commmit?
> 
> I think the root of the problem is that test-simple assumes, due to
> historical accident, that it knows which widget implements AtkText and
> assumes some things about that widget's state.
> 
> A better fix (especially in light of test-simple's "poke" option) would
> be to only run those state-assuming parts of test_text if the AtkObject
> in question 'matches' the one we expect.  So perhaps calling
> atk_object_set_name () on the entry widget in the main() routine that
> creates the UI, and comparing the AtkText-implementing object's name to
> that... etc.
> 
> -Bill
> 
> > Padraig
> > 
> > ______________________________________________________________________
> > 
> > Index: test-simple.c
> > ===================================================================
> > RCS file: /cvs/gnome/at-spi/test/test-simple.c,v
> > retrieving revision 1.31
> > diff -u -p -r1.31 test-simple.c
> > --- test-simple.c	17 Nov 2002 13:54:00 -0000	1.31
> > +++ test-simple.c	15 Jan 2003 15:59:26 -0000
> > @@ -295,7 +295,16 @@ static void
> >  test_text (AccessibleText *text)
> >  {
> >  	char *str;
> > +	static gboolean done = FALSE;
> >  
> > +	if (done)
> > +		return;
> > +	done = TRUE;
> > +	/*
> > +	 * A GtkButton now supports the Text interface so only want
> > +	 * to call this function once.
> > +	 */
> > +	
> >  	fprintf (stderr, "Testing text ...\n");
> >  
> >  	g_assert (AccessibleText_getCharacterCount (text) ==
> -- 
> Bill Haneman <bill haneman sun com>
> 
> _______________________________________________
> Gnome-accessibility-devel mailing list
> Gnome-accessibility-devel gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel
Index: test-simple.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/test-simple.c,v
retrieving revision 1.31
diff -u -p -r1.31 test-simple.c
--- test-simple.c	17 Nov 2002 13:54:00 -0000	1.31
+++ test-simple.c	15 Jan 2003 16:52:24 -0000
@@ -41,6 +41,7 @@ static void validate_accessible (Accessi
 
 #define WINDOW_MAGIC 0x123456a
 #define TEST_STRING_A "A test string"
+#define TEST_STRING_A_OBJECT "A_test_string_object"
 #define TEST_STRING_B "Another test string"
 
 static int      print_tree_depth = 0;
@@ -105,6 +106,7 @@ create_test_window (void)
 {
 	TestWindow *win = g_new0 (TestWindow, 1);
 	GtkWidget  *widget, *vbox;
+	AtkObject *obj;
 
 	win->magic  = WINDOW_MAGIC;
 	win->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -117,6 +119,9 @@ create_test_window (void)
 
 	widget = gtk_entry_new ();
 	gtk_entry_set_text (GTK_ENTRY (widget), TEST_STRING_A);
+	obj = gtk_widget_get_accessible (widget);
+	atk_object_set_name (obj, TEST_STRING_A_OBJECT);
+
 	test_window_add_and_show (GTK_CONTAINER (vbox), widget);
 
 	widget = gtk_button_new_with_label ("_Foobar");
@@ -600,8 +605,10 @@ validate_accessible (Accessible *accessi
 		g_assert (tmp != NULL);
 		if (print_tree)
 			fprintf (stderr, "Te");
-		else
-			test_text (tmp);
+		else {
+			if (strcmp (name, TEST_STRING_A_OBJECT) == 0)	
+				test_text (tmp);
+		}
 		AccessibleText_unref (tmp);
 	}
 


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