static void _do_test(AtkObject *obj) { const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj)); const char *type_name_child; AtkObject *xobj; _printf("type_name: %s\n", type_name); g_assert_cmpstr(type_name, ==, "EailBubble"); // test children g_assert(2 == atk_object_get_n_accessible_children(obj)); for (int count = 0; 2 > count; count++) { xobj = atk_object_ref_accessible_child(obj, count); g_assert(xobj); type_name_child = g_type_name(G_TYPE_FROM_INSTANCE(xobj)); _printf(" child num: %d, type_name: %s\n", count, type_name_child); g_assert(!strcmp(type_name_child, "EailIcon") || !strcmp(type_name_child, "EailLabel")); } // test AtkAction g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj))); eailu_test_action_activate(ATK_ACTION(obj), "click"); g_assert(-1 == (eailu_get_action_number(ATK_ACTION(obj), "typo"))); eailu_test_action_description_all(ATK_ACTION(obj)); /* bubble object does not support focus */ eailu_test_atk_focus(obj, FALSE); }
static void _do_test(AtkObject *aobj) { int child_amount = 0; g_assert(ATK_IS_OBJECT(aobj)); g_assert(atk_object_get_role(aobj) == ATK_ROLE_LIST); child_amount = atk_object_get_n_accessible_children(aobj); g_assert(N_ITEMS == child_amount); eailu_test_atk_focus(aobj, TRUE); eailu_test_code_called = 1; }
static void _test_index_object(AtkObject *obj) { int n_children = 0, i = 0; printf("Testing index instance\n"); eailu_test_atk_focus(obj, FALSE); n_children = atk_object_get_n_accessible_children(obj); /* there should be 13 index entries */ g_assert(13 == n_children); for (i = 0; i < n_children; ++i) { _test_index_child_for_object(obj, i); } printf("DONE. All index test passed successfully \n"); }
static void _do_test(AtkObject *obj) { int child_count = 0; atk_object_set_description(obj, "test"); g_assert_cmpstr(atk_object_get_description(obj), ==, "test"); atk_object_set_name(obj, "test name"); g_assert_cmpstr(atk_object_get_name(obj), ==, "test name"); child_count = atk_object_get_n_accessible_children(obj); g_assert(child_count == 0); eailu_test_atk_focus(obj, TRUE); _printf("DONE. All WEB tests passed successfully \n"); eailu_test_code_called = 1; }
static void _do_test(AtkObject *obj) { int child_count = 0; child_count = atk_object_get_n_accessible_children(obj); g_assert(child_count == 2); _printf("n_accessible_children - done\n"); AtkStateSet *state_set = atk_object_ref_state_set(obj); gboolean v_contains = atk_state_set_contains_state(state_set, ATK_STATE_VERTICAL); gboolean h_contains = atk_state_set_contains_state(state_set, ATK_STATE_HORIZONTAL); g_object_unref(state_set); g_assert(v_contains || h_contains); _printf("ref_state_set - done\n"); /*AtkValue iface tests*/ g_assert(ATK_IS_VALUE(obj)); GValue value = G_VALUE_INIT; double d_value; atk_value_get_maximum_value(ATK_VALUE(obj), &value); d_value = g_value_get_double(&value); g_assert(d_value == 1.0); atk_value_get_minimum_value(ATK_VALUE(obj), &value); d_value = g_value_get_double(&value); g_assert(d_value == 0.0); g_value_set_double(&value, 0.3); gboolean success = atk_value_set_current_value(ATK_VALUE(obj), &value); g_assert(success); atk_value_get_current_value(ATK_VALUE(obj), &value); g_assert(G_VALUE_HOLDS_DOUBLE(&value)); d_value = g_value_get_double(&value); g_assert(d_value == 0.3); _printf("atk_value - done\n"); eailu_test_atk_focus(obj, TRUE); }
static void _test_slideshow_object(AtkObject *obj) { int child_count, selection_count, action_count; AtkObject *child, *selection; gboolean result; const gchar *action_name, *action_description; /*sometimes this is called several times*/ static int tested = 0; fprintf(stdout, "Testing slideshow\n"); if (tested > 0) return; tested++; g_object_ref(obj); g_assert(eailu_is_object_with_role(obj, ATK_ROLE_LIST)); child_count = atk_object_get_n_accessible_children(obj); g_assert(child_count == 9); for (int i = 0; i < child_count; i++) { child = atk_object_ref_accessible_child(obj, i); AtkRole role = atk_object_get_role(child); fprintf(stdout, "index %d child role: %s\n", i, atk_role_get_name(role)); g_assert(eailu_is_object_with_role(child, ATK_ROLE_IMAGE)); g_object_unref(child); } /*test AtkSelectionIface*/ g_assert(ATK_IS_SELECTION(obj)); selection = atk_selection_ref_selection(ATK_SELECTION(obj), 0); /*this may fail due to a problem with slideshow cache*/ g_assert(ATK_IS_OBJECT(selection)); g_assert(eailu_is_object_with_role(selection, ATK_ROLE_IMAGE)); g_object_unref(selection); selection_count = atk_selection_get_selection_count(ATK_SELECTION(obj)); g_assert(selection_count == 1); result = atk_selection_add_selection(ATK_SELECTION(obj), 5); g_assert(result); result = atk_selection_is_child_selected(ATK_SELECTION(obj), 5); g_assert(result); /*test AtkActionIface*/ g_assert(ATK_IS_ACTION(obj)); /* test set/get action description */ eailu_test_action_description_all(ATK_ACTION(obj)); action_count = atk_action_get_n_actions(ATK_ACTION(obj)); g_assert(4 == action_count); action_name = atk_action_get_name(ATK_ACTION(obj), 0); g_assert(!strcmp("next", action_name)); action_name = atk_action_get_name(ATK_ACTION(obj), 1); g_assert(!strcmp("previous", action_name)); result = atk_action_set_description(ATK_ACTION(obj), 2, "start the slideshow"); g_assert(result); action_description = atk_action_get_description(ATK_ACTION(obj), 2); g_assert(!strcmp("start the slideshow", action_description)); result = atk_action_do_action(ATK_ACTION(obj), 0); g_assert(result); result = atk_selection_is_child_selected(ATK_SELECTION(obj), 6); g_assert(result); eailu_test_atk_focus(obj, TRUE); g_object_unref(obj); eail_test_code_called = TRUE; }