2 #include "testtextlib.h"
4 #define NUM_ROWS_TO_LOOP 30
9 GtkWidget *tb_ref_selection;
11 GtkWidget *tb_ref_accessible_child;
12 GtkWidget *child_entry;
15 GtkWidget *index_entry;
18 static void _check_table (AtkObject *in_obj);
19 void table_runtest(AtkObject *);
20 static void other_runtest(AtkObject *obj);
21 static void ref_at_runtest(AtkObject *obj, gint row, gint col);
22 static void ref_accessible_child_runtest(AtkObject *obj, gint childno);
23 static void ref_selection_runtest (AtkObject *obj, gint index);
24 static void _selection_tests(AtkObject *obj);
25 static void _display_header_info(gchar *type,
26 AtkObject *header_obj, gint header_num);
27 static void _process_child(AtkObject *child_obj);
29 static void _notify_table_row_inserted (GObject *obj,
30 gint start_offset, gint length);
31 static void _notify_table_column_inserted (GObject *obj,
32 gint start_offset, gint length);
33 static void _notify_table_row_deleted (GObject *obj,
34 gint start_offset, gint length);
35 static void _notify_table_column_deleted (GObject *obj,
36 gint start_offset, gint length);
37 static void _notify_table_row_reordered (GObject *obj);
38 static void _notify_table_column_reordered (GObject *obj);
39 static void _notify_table_child_added (GObject *obj,
40 gint index, AtkObject *child);
41 static void _notify_table_child_removed (GObject *obj,
42 gint index, AtkObject *child);
43 static void _property_signal_connect (AtkObject *obj);
44 static void _property_change_handler (AtkObject *obj,
45 AtkPropertyValues *values);
47 static gboolean tested_set_headers = FALSE;
48 static void test_choice_gui (AtkObject **obj);
49 static void nogui_runtest (AtkObject *obj);
50 static void nogui_ref_at_runtest (AtkObject *obj);
51 static void nogui_process_child (AtkObject *obj);
53 static TestChoice *tc;
54 static gint g_visibleGUI = 0;
55 static AtkTable *g_table = NULL;
56 static AtkObject *current_obj = NULL;
57 gboolean g_done = FALSE;
58 gboolean g_properties = TRUE;
66 static void destroy (GtkWidget *widget, gpointer data)
71 static void choicecb (GtkWidget *widget, gpointer data)
73 AtkObject **ptr_to_obj = (AtkObject **)data;
74 AtkObject *obj = *ptr_to_obj;
76 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tc->tb_others)))
80 else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tc->tb_ref_selection)))
82 const gchar *indexstr;
85 indexstr = gtk_entry_get_text(GTK_ENTRY(tc->index_entry));
86 index = string_to_int((gchar *)indexstr);
88 ref_selection_runtest(obj, index);
90 else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tc->tb_ref_at)))
92 const gchar *rowstr, *colstr;
95 rowstr = gtk_entry_get_text(GTK_ENTRY(tc->row_entry));
96 colstr = gtk_entry_get_text(GTK_ENTRY(tc->col_entry));
97 row = string_to_int((gchar *)rowstr);
98 col = string_to_int((gchar *)colstr);
100 ref_at_runtest(obj, row, col);
102 else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tc->tb_ref_accessible_child)))
104 const gchar *childstr;
106 childstr = gtk_entry_get_text(GTK_ENTRY(tc->child_entry));
107 childno = string_to_int((gchar *)childstr);
109 ref_accessible_child_runtest(obj, childno);
113 static void _check_table (AtkObject *in_obj)
115 AtkObject *obj = NULL;
116 G_CONST_RETURN char *no_properties;
117 G_CONST_RETURN char *no_gui;
119 no_properties = g_getenv ("TEST_ACCESSIBLE_NO_PROPERTIES");
120 no_gui = g_getenv ("TEST_ACCESSIBLE_NO_GUI");
122 if (no_properties != NULL)
123 g_properties = FALSE;
127 obj = find_object_by_type(in_obj, "GailTreeView");
129 g_print("Found GailTreeView table in child!\n");
132 obj = find_object_by_type(in_obj, "GailCList");
134 g_print("Found GailCList in child!\n");
137 g_print("No object found %s\n", g_type_name (G_OBJECT_TYPE (in_obj)));
142 g_print ("In _check_table\n");
144 if (!already_accessed_atk_object(obj))
146 /* Set up signal handlers */
148 g_print ("Adding signal handler\n");
149 g_signal_connect_closure_by_id (obj,
150 g_signal_lookup ("column_inserted", G_OBJECT_TYPE (obj)),
152 g_cclosure_new (G_CALLBACK (_notify_table_column_inserted),
155 g_signal_connect_closure_by_id (obj,
156 g_signal_lookup ("row_inserted", G_OBJECT_TYPE (obj)),
158 g_cclosure_new (G_CALLBACK (_notify_table_row_inserted),
161 g_signal_connect_closure_by_id (obj,
162 g_signal_lookup ("column_deleted", G_OBJECT_TYPE (obj)),
164 g_cclosure_new (G_CALLBACK (_notify_table_column_deleted),
167 g_signal_connect_closure_by_id (obj,
168 g_signal_lookup ("row_deleted", G_OBJECT_TYPE (obj)),
170 g_cclosure_new (G_CALLBACK (_notify_table_row_deleted),
173 g_signal_connect_closure_by_id (obj,
174 g_signal_lookup ("column_reordered", G_OBJECT_TYPE (obj)),
176 g_cclosure_new (G_CALLBACK (_notify_table_column_reordered),
179 g_signal_connect_closure_by_id (obj,
180 g_signal_lookup ("row_reordered", G_OBJECT_TYPE (obj)),
182 g_cclosure_new (G_CALLBACK (_notify_table_row_reordered),
185 g_signal_connect_closure (obj, "children_changed::add",
186 g_cclosure_new (G_CALLBACK (_notify_table_child_added),
190 g_signal_connect_closure (obj, "children_changed::remove",
191 g_cclosure_new (G_CALLBACK (_notify_table_child_removed),
196 g_table = ATK_TABLE(obj);
198 atk_object_connect_property_change_handler (obj,
199 (AtkPropertyChangeHandler*) _property_change_handler);
203 * The use of ¤t_obj allows us to change the object being processed
206 if (g_visibleGUI != 1)
207 test_choice_gui(¤t_obj);
208 else if (no_gui != NULL)
213 void other_runtest(AtkObject *obj)
215 AtkObject *header_obj;
217 G_CONST_RETURN gchar *out_string;
220 gint rows_to_loop = NUM_ROWS_TO_LOOP;
222 out_desc = g_string_sized_new(256);
224 n_cols = atk_table_get_n_columns(ATK_TABLE(obj));
225 n_rows = atk_table_get_n_rows(ATK_TABLE(obj));
227 g_print ("Number of columns is %d\n", n_cols);
228 g_print ("Number of rows is %d\n", n_rows);
230 /* Loop NUM_ROWS_TO_LOOP rows if possible */
231 if (n_rows < NUM_ROWS_TO_LOOP)
232 rows_to_loop = n_rows;
238 out_obj = atk_table_get_caption(ATK_TABLE(obj));
241 out_string = atk_object_get_name (out_obj);
243 g_print("Caption Name is <%s>\n", out_string);
245 g_print("Caption has no name\n");
248 g_print("No caption\n");
250 /* Column descriptions and headers */
253 for (i=0; i < n_cols; i++)
256 out_string = atk_table_get_column_description(ATK_TABLE(obj), i);
257 if (out_string != NULL)
258 g_print("%d: Column description is <%s>\n", i, out_string);
260 g_print("%d: Column description is <NULL>\n", i);
262 /* check setting a new value */
264 g_string_printf(out_desc, "new column description %d", i);
266 if (out_string == NULL || strcmp (out_string, out_desc->str) != 0)
268 g_print("%d, Setting the column description to <%s>\n",
270 atk_table_set_column_description(ATK_TABLE(obj), i, out_desc->str);
271 out_string = atk_table_get_column_description(ATK_TABLE(obj), i);
272 if (out_string != NULL)
273 g_print("%d: Column description is <%s>\n", i, out_string);
275 g_print("%d: Column description is <NULL>\n", i);
279 header_obj = atk_table_get_column_header(ATK_TABLE(obj), i);
280 _display_header_info("Column", header_obj, i);
283 /* Row description */
287 for (i=0; i < rows_to_loop; i++)
289 out_string = atk_table_get_row_description(ATK_TABLE(obj), i);
290 if (out_string != NULL)
291 g_print("%d: Row description is <%s>\n", i, out_string);
293 g_print("%d: Row description is <NULL>\n", i);
295 g_string_printf(out_desc, "new row description %d", i);
297 if (out_string == NULL || strcmp (out_string, out_desc->str) != 0)
299 g_print("%d: Setting the row description to <%s>\n",
301 atk_table_set_row_description(ATK_TABLE(obj), i, out_desc->str);
303 out_string = atk_table_get_row_description(ATK_TABLE(obj), i);
304 if (out_string != NULL)
305 g_print("%d: Row description is <%s>\n", i, out_string);
307 g_print("%d: Row description is <NULL>\n", i);
310 header_obj = atk_table_get_row_header(ATK_TABLE(obj), i);
311 _display_header_info("Row", header_obj, i);
313 for (j=0; j <n_cols; j++)
315 gint index = atk_table_get_index_at(ATK_TABLE(obj), i, j);
318 column = atk_table_get_column_at_index (ATK_TABLE (obj), index);
319 g_return_if_fail (column == j);
321 row = atk_table_get_row_at_index (ATK_TABLE (obj), index);
322 g_return_if_fail (row == i);
324 if(atk_selection_is_child_selected(ATK_SELECTION(obj), index))
325 g_print("atk_selection_is_child_selected,index = %d returns TRUE\n", index);
326 /* Generic cell tests */
327 /* Just test setting column headers once. */
329 if (!tested_set_headers)
331 tested_set_headers = TRUE;
333 /* Hardcode to 1,1 for now */
335 "Testing set_column_header for column %d, to table\n",
337 atk_table_set_column_header(ATK_TABLE(obj), (n_cols - 1), obj);
339 g_print("Testing set_row_header for row %d, to table\n", n_rows);
340 atk_table_set_row_header(ATK_TABLE(obj), n_rows, obj);
345 /* row/column extents */
348 g_print("Row extents at 1,1 is %d\n",
349 atk_table_get_row_extent_at(ATK_TABLE(obj), 1, 1));
350 g_print("Column extents at 1,1 is %d\n",
351 atk_table_get_column_extent_at(ATK_TABLE(obj), 1, 1));
355 void ref_accessible_child_runtest(AtkObject *obj, gint child)
357 AtkObject *child_obj;
359 g_print ("Accessing child %d\n", child);
360 child_obj = atk_object_ref_accessible_child (obj, child);
361 _property_signal_connect(child_obj);
362 if (child_obj != NULL)
363 _process_child(child_obj);
367 void ref_selection_runtest (AtkObject *obj, gint index)
369 AtkObject *child_obj;
371 /* use atk_selection_ref_selection just once to check it works */
372 child_obj = atk_selection_ref_selection(ATK_SELECTION(obj), index);
375 g_print("child_obj gotten from atk_selection_ref_selection\n");
376 g_object_unref (child_obj);
379 g_print("NULL returned by atk_selection_ref_selection\n");
381 _selection_tests(obj);
385 void ref_at_runtest(AtkObject *obj, gint row, gint col)
387 AtkObject *child_obj;
390 g_print("Testing ref_at row %d column %d\n", row, col);
392 child_obj = atk_table_ref_at(ATK_TABLE(obj), row, col);
393 _property_signal_connect(child_obj);
395 g_print("Row is %d, col is %d\n", row, col);
397 _process_child(child_obj);
399 g_object_unref (child_obj);
406 _process_child(AtkObject *child_obj)
408 if (child_obj != NULL)
410 if (ATK_IS_TEXT(child_obj))
412 add_handlers(child_obj);
413 setup_gui(child_obj, runtest);
417 g_print("Interface is not text!\n");
420 if (ATK_IS_ACTION(child_obj))
424 gchar *action_description;
425 gchar *action_keybinding;
426 AtkAction *action = ATK_ACTION(child_obj);
428 i = atk_action_get_n_actions (action);
429 g_print ("Supports AtkAction with %d actions.\n", i);
430 for (j = 0; j < i; j++)
432 g_print ("Action %d:\n", j);
433 action_name = atk_action_get_name (action, j);
435 g_print (" Name = %s\n", action_name);
436 action_description = atk_action_get_description (action, j);
437 if (action_description)
438 g_print (" Description = %s\n", action_description);
439 action_keybinding = atk_action_get_keybinding (action, j);
440 if (action_keybinding)
441 g_print (" Keybinding = %s\n", action_keybinding);
442 action_description = "new description";
443 g_print (" Setting description to %s\n", action_description);
444 atk_action_set_description (action, j, action_description);
445 action_description = atk_action_get_description (action, j);
446 if (action_description)
447 g_print (" New description is now %s\n", action_description);
454 g_print("Child is NULL!\n");
459 * Combined tests on AtkTable and AtkSelection on individual rows rather than
463 _selection_tests(AtkObject *obj)
467 gint selection_count = 0;
469 gint *selected = NULL;
472 table = ATK_TABLE (obj);
474 n_rows = atk_table_get_selected_rows(table, &selected);
475 for (i = 0; i < n_rows; i++)
477 g_print("atk_table_get_selected_row returns : %d\n",
479 if (!atk_table_is_row_selected (table, selected[i]))
480 g_print("atk_table_is_row_selected returns false for selected row %d\n",
486 n_cols = atk_table_get_selected_columns(table, &selected);
487 for (i = 0; i < n_cols; i++)
488 g_print("atk_table_get_selected_columns returns : %d\n", selected[i]);
491 selection_count = atk_selection_get_selection_count(ATK_SELECTION(obj));
492 g_print("atk_selection_get_selection_count returns %d\n", selection_count);
494 if (atk_table_is_row_selected(table, 2))
496 g_print("atk_table_is_row_selected (table, 2) returns TRUE\n");
497 atk_selection_clear_selection (ATK_SELECTION (obj));
498 if (atk_table_add_row_selection(table, 4))
499 g_print("atk_table_add_row_selection: selected row 4\n");
500 if (!atk_table_is_row_selected (table, 4))
501 g_print("atk_table_is_row_selected returns false for row 2\n");
502 if (atk_table_is_row_selected (table, 2))
503 g_print("atk_table_is_row_selected gives false positive for row 2\n");
506 if (atk_table_is_row_selected(table, 3))
508 if (atk_table_remove_row_selection(table, 3))
509 g_print("atk_table_remove_row_selection unselected row 3\n");
512 if (atk_table_is_selected(table, 5, 4))
514 atk_selection_clear_selection(ATK_SELECTION(obj));
515 g_print("atk_selection_clear_selection: just cleared all selected\n");
518 if (atk_table_is_column_selected(table, 2))
520 g_print("atk_table_is_column_selected(obj, 2) returns TRUE\n");
521 if (atk_table_add_column_selection(table, 4))
522 g_print("atk_table_add_column_selection: selected column 4\n");
523 g_print("atk_table_is_column_selected(obj, 2) returns TRUE\n");
526 if (atk_table_is_column_selected(table, 3))
528 if (atk_table_remove_column_selection(table, 3))
529 g_print("atk_table_remove_column_selection: unselected column 3\n");
534 _create_event_watcher (void)
536 atk_add_focus_tracker (_check_table);
540 gtk_module_init(gint argc, char* argv[])
542 g_print("TestTable Module loaded\n");
544 _create_event_watcher();
550 _notify_table_row_inserted (GObject *obj, gint start_offset, gint length)
552 g_print ("SIGNAL - Row inserted at position %d, num of rows inserted %d!\n",
553 start_offset, length);
557 _notify_table_column_inserted (GObject *obj, gint start_offset, gint length)
559 g_print ("SIGNAL - Column inserted at position %d, num of columns inserted %d!\n",
560 start_offset, length);
564 _notify_table_row_deleted (GObject *obj, gint start_offset, gint length)
566 g_print ("SIGNAL - Row deleted at position %d, num of rows deleted %d!\n",
567 start_offset, length);
571 _notify_table_column_deleted (GObject *obj, gint start_offset, gint length)
573 g_print ("SIGNAL - Column deleted at position %d, num of columns deleted %d!\n",
574 start_offset, length);
578 _notify_table_row_reordered (GObject *obj)
580 g_print ("SIGNAL - Row reordered!\n");
584 _notify_table_column_reordered (GObject *obj)
586 g_print ("SIGNAL - Column reordered!\n");
589 static void _notify_table_child_added (GObject *obj,
590 gint index, AtkObject *child)
592 g_print ("SIGNAL - Child added - index %d\n", index);
595 static void _notify_table_child_removed (GObject *obj,
596 gint index, AtkObject *child)
598 g_print ("SIGNAL - Child removed - index %d\n", index);
602 _display_header_info(gchar *type, AtkObject *header_obj, gint header_num)
604 if (header_obj != NULL)
607 role = atk_object_get_role(header_obj);
609 if (role == ATK_ROLE_PUSH_BUTTON)
611 g_print ("%d: %s header is a push button!\n", header_num, type);
613 else if (role == ATK_ROLE_LABEL)
615 g_print ("%d: %s header is a label!\n", header_num, type);
617 else if (ATK_IS_TEXT(header_obj))
621 header_text = atk_text_get_text (ATK_TEXT (header_obj), 0, 3);
622 if (header_text != NULL)
624 g_print("%d: %s header is a text value <%s>\n", header_num,
629 g_print("%d: %s header is a text value <NULL>\n", header_num,
635 g_print ("%d: %s header is of type %s!\n", header_num,
636 type, atk_role_get_name (role));
641 g_print ("%d: %s header object is NULL!\n", header_num, type);
645 static void _property_signal_connect (AtkObject *obj)
647 if (g_properties && obj != NULL)
649 g_signal_connect_closure_by_id (obj,
650 g_signal_lookup ("property_change", G_OBJECT_TYPE (obj)),
652 g_cclosure_new (G_CALLBACK (_property_change_handler),
659 _property_change_handler (AtkObject *obj,
660 AtkPropertyValues *values)
667 gint index = atk_object_get_index_in_parent(obj);
670 g_print("Index is %d, row is %d, col is %d\n", index,
671 atk_table_get_row_at_index(g_table, index),
672 atk_table_get_column_at_index(g_table, index));
674 g_print ("index: %d for %s\n", index, g_type_name (G_OBJECT_TYPE (obj)));
677 if (ATK_IS_TEXT(obj))
679 obj_text = atk_text_get_text (ATK_TEXT (obj), 0, 15);
680 if (obj_text == NULL)
681 g_print(" Cell text is <NULL>\n");
683 g_print(" Cell text is <%s>\n", obj_text);
686 g_print(" PropertyName <%s>\n",
687 values->property_name ? values->property_name: "NULL");
690 if (&values->old_value != NULL && G_IS_VALUE (&values->old_value))
692 GType old_type = G_VALUE_TYPE (&values->old_value);
697 g_print("value was <%d>\n", g_value_get_int (&values->old_value));
700 name = g_value_get_string (&values->old_value);
702 g_print ("value was <%s>\n", name);
704 g_print ("value was <NULL>\n");
707 g_print("value was <unknown type>\n");
713 g_print("value was <not a value>\n");
716 if (&values->new_value != NULL && G_IS_VALUE (&values->new_value))
718 GType new_type = G_VALUE_TYPE (&values->new_value);
723 g_print("value is <%d>\n", g_value_get_int (&values->new_value));
726 name = g_value_get_string (&values->new_value);
728 g_print ("value is <%s>\n", name);
730 g_print ("value is <NULL>\n");
733 g_print("value is <unknown type>\n");
739 g_print("value is <not a value>\n");
744 void test_choice_gui(AtkObject **obj)
749 GtkWidget *child_label;
750 GtkWidget *row_label;
751 GtkWidget *col_label;
752 GtkWidget *index_label;
753 GtkWidget *hseparator;
754 GtkWidget *hbuttonbox;
758 tc = (TestChoice *) g_malloc (sizeof(TestChoice));
760 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
761 gtk_window_set_title(GTK_WINDOW(window), "Test to run");
763 g_signal_connect(window, "destroy",
764 G_CALLBACK (destroy), &window);
766 vbox = gtk_vbox_new(TRUE, 0);
767 gtk_box_set_spacing(GTK_BOX(vbox), 10);
770 hbox = gtk_hbox_new(FALSE, 0);
771 gtk_box_set_spacing(GTK_BOX(hbox), 10);
772 tc->tb_ref_selection = gtk_toggle_button_new_with_label("ref_selection");
773 gtk_box_pack_start (GTK_BOX (hbox), tc->tb_ref_selection, TRUE, TRUE, 0);
774 index_label = gtk_label_new("index: ");
775 gtk_box_pack_start (GTK_BOX (hbox), index_label, TRUE, TRUE, 0);
776 tc->index_entry = gtk_entry_new();
777 gtk_entry_set_text(GTK_ENTRY(tc->index_entry), "1");
778 gtk_box_pack_start (GTK_BOX (hbox), tc->index_entry, TRUE, TRUE, 0);
779 gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
781 hbox = gtk_hbox_new(FALSE, 0);
782 gtk_box_set_spacing(GTK_BOX(hbox), 10);
783 tc->tb_ref_at = gtk_toggle_button_new_with_label("ref_at");
784 gtk_box_pack_start (GTK_BOX (hbox), tc->tb_ref_at, TRUE, TRUE, 0);
785 row_label = gtk_label_new("row:");
786 gtk_box_pack_start (GTK_BOX (hbox), row_label, TRUE, TRUE, 0);
787 tc->row_entry = gtk_entry_new();
788 gtk_entry_set_text(GTK_ENTRY(tc->row_entry), "1");
789 gtk_box_pack_start (GTK_BOX (hbox), tc->row_entry, TRUE, TRUE, 0);
790 col_label = gtk_label_new("column:");
791 gtk_box_pack_start (GTK_BOX (hbox), col_label, TRUE, TRUE, 0);
792 tc->col_entry = gtk_entry_new();
793 gtk_entry_set_text(GTK_ENTRY(tc->col_entry), "1");
794 gtk_box_pack_start (GTK_BOX (hbox), tc->col_entry, TRUE, TRUE, 0);
795 gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
797 hbox = gtk_hbox_new(FALSE, 0);
798 gtk_box_set_spacing(GTK_BOX(hbox), 10);
799 tc->tb_ref_accessible_child = gtk_toggle_button_new_with_label("ref_accessible_child");
800 gtk_box_pack_start (GTK_BOX (hbox), tc->tb_ref_accessible_child, TRUE, TRUE, 0);
801 child_label = gtk_label_new("Child no:");
802 gtk_box_pack_start (GTK_BOX (hbox), child_label, TRUE, TRUE, 0);
803 tc->child_entry = gtk_entry_new();
804 gtk_entry_set_text(GTK_ENTRY(tc->child_entry), "1");
805 gtk_box_pack_start (GTK_BOX (hbox), tc->child_entry, TRUE, TRUE, 0);
806 gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
808 tc->tb_others = gtk_toggle_button_new_with_label("others");
809 gtk_box_pack_start (GTK_BOX (vbox), tc->tb_others, TRUE, TRUE, 0);
811 hseparator = gtk_hseparator_new();
812 gtk_box_pack_start (GTK_BOX (vbox), hseparator, TRUE, TRUE, 0);
814 button = gtk_button_new_with_mnemonic("_Run Test");
816 hbuttonbox = gtk_hbutton_box_new();
817 gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox),
818 GTK_BUTTONBOX_SPREAD);
819 gtk_box_pack_end (GTK_BOX (hbuttonbox), GTK_WIDGET (button), TRUE, TRUE, 0);
820 gtk_box_pack_end (GTK_BOX (vbox), hbuttonbox, TRUE, TRUE, 0);
821 g_signal_connect(button, "clicked", G_CALLBACK (choicecb), obj);
823 gtk_container_add(GTK_CONTAINER(window), vbox);
824 gtk_widget_show(vbox);
825 gtk_widget_show(window);
826 gtk_widget_show_all(GTK_WIDGET(window));
832 nogui_runtest (AtkObject *obj)
834 g_print ("Running non-GUI tests...\n");
836 nogui_ref_at_runtest (obj);
840 nogui_ref_at_runtest (AtkObject *obj)
842 AtkObject *child_obj;
845 gint rows_to_loop = 5;
847 n_cols = atk_table_get_n_columns (ATK_TABLE(obj));
849 if (atk_table_get_n_rows(ATK_TABLE(obj)) < rows_to_loop)
850 rows_to_loop = atk_table_get_n_rows (ATK_TABLE(obj));
852 for (i=0; i < rows_to_loop; i++)
854 /* Just the first rows_to_loop rows */
855 for (j=0; j < n_cols; j++)
857 gint index = atk_table_get_index_at(ATK_TABLE(obj), i, j);
858 if(atk_selection_is_child_selected(ATK_SELECTION(obj), index))
859 g_print("atk_selection_is_child_selected,index = %d returns TRUE\n", index);
861 g_print("Testing ref_at row %d column %d\n", i, j);
863 if (i == 3 && j == 0)
865 g_print("child_obj gotten from atk_selection_ref_selection\n");
867 /* use atk_selection_ref_selection just once to check it works */
868 child_obj = atk_selection_ref_selection(ATK_SELECTION(obj), index );
872 child_obj = atk_table_ref_at(ATK_TABLE(obj), i, j);
875 _property_signal_connect(child_obj);
877 g_print("Index is %d, row is %d, col is %d\n", index,
878 atk_table_get_row_at_index(ATK_TABLE(obj), index),
879 atk_table_get_column_at_index(ATK_TABLE(obj), index));
881 nogui_process_child (child_obj);
883 /* Generic cell tests */
884 /* Just test setting column headers once. */
886 if (!tested_set_headers)
888 tested_set_headers = TRUE;
890 g_print("Testing set_column_header for column %d, to cell value %d,%d\n",
892 atk_table_set_column_header(ATK_TABLE(obj), j, child_obj);
894 g_print("Testing set_row_header for row %d, to cell value %d,%d\n",
896 atk_table_set_row_header(ATK_TABLE(obj), i, child_obj);
899 g_object_unref (child_obj);
905 nogui_process_child (AtkObject *obj)
907 gchar default_val[5] = "NULL";
909 if (ATK_IS_TEXT(obj))
912 current_text = atk_text_get_text (ATK_TEXT(obj), 0, -1);
913 g_print ("Child supports text interface.\nCurrent text is %s\n", current_text);
916 if (ATK_IS_ACTION(obj))
918 AtkAction *action = ATK_ACTION(obj);
920 G_CONST_RETURN gchar *name, *description;
922 n_actions = atk_action_get_n_actions (action);
923 g_print ("Child supports %d actions.\n", n_actions);
924 for (i = 0; i < n_actions; i++)
926 name = atk_action_get_name (action, i);
927 description = atk_action_get_description (action, i);
931 if (description == NULL)
932 description = default_val;
934 g_print (" %d: name = <%s>\n", i, name);
935 g_print (" description = <%s>\n", description);