static void _do_test(AtkObject *obj) { AtkStateSet *state_set; g_assert(ATK_IS_ACTION(obj)); /* atk_action_get_n_actions test */ g_assert(atk_action_get_n_actions(ATK_ACTION(obj)) == 2); eailu_test_action_activate(ATK_ACTION(obj), "shrink"); state_set = atk_object_ref_state_set(obj); g_assert(atk_state_set_contains_state(state_set, ATK_STATE_DEFAULT)); g_object_unref(state_set); eailu_test_action_activate(ATK_ACTION(obj), "expand"); state_set = atk_object_ref_state_set(obj); g_assert(atk_state_set_contains_state(state_set, ATK_STATE_EXPANDED)); g_object_unref(state_set); eailu_test_action_description_all(ATK_ACTION(obj)); g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1); _printf("DONE. All multibutton_entry tests passed successfully \n"); eailu_test_code_called = 1; }
SpiHyperlink * spi_hyperlink_new (AtkHyperlink *object) { SpiHyperlink *new_hyperlink = g_object_new ( SPI_HYPERLINK_TYPE, NULL); spi_base_construct (SPI_BASE (new_hyperlink), G_OBJECT(object)); /* * some hyperlinks are actionable... this is an ATK convention * that seems convenient though possibly poorly documented or unintended. */ if (ATK_IS_ACTION (object)) { /* * NOTE: we don't cast 'object' to ATK_OBJECT in the call to * spi_action_interface_new(), because of the above convention, * even though it means we may be violating the func prototype. * See discussion in bugzilla bug #120659. * !!! * IMPORTANT! The 'AtkObject' typecast, instead of the cast macro, * is used below, because 'object' may NOT really be an AtkObject; * it will be cast back to a G_OBJECT inside spi_action_interface_new * before use, so this is OK though very ropey coding style. */ /* Don't aggregate action twice... if this is from AtkHyperlinkImpl */ if (!bonobo_object_query_interface (bonobo_object (new_hyperlink), "IDL:Accessibility/Action:1.0", NULL)) bonobo_object_add_interface (bonobo_object (new_hyperlink), BONOBO_OBJECT (spi_action_interface_new ((AtkObject *) object))); } return new_hyperlink; }
static DBusMessage * impl_DoAction (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkAction *action = (AtkAction *) user_data; dbus_int32_t index; dbus_bool_t rv = TRUE; DBusMessage *reply; g_return_val_if_fail (ATK_IS_ACTION (user_data), droute_not_yet_handled_error (message)); if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, DBUS_TYPE_INVALID); } dbus_connection_send (bus, reply, NULL); dbus_message_unref (reply); atk_action_do_action (action, index); return NULL; }
static DBusMessage * impl_get_localized_name (DBusConnection * bus, DBusMessage * message, void *user_data) { DBusMessage *reply; dbus_int32_t index; const char *name; AtkAction *action = (AtkAction *) user_data; g_return_val_if_fail (ATK_IS_ACTION (user_data), droute_not_yet_handled_error (message)); if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } name = atk_action_get_localized_name (action, index); if (!name) name = ""; reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID); } return reply; }
void _do_test(AtkObject *obj) { const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj)); g_assert(ATK_IS_OBJECT(obj)); g_assert_cmpstr(type_name, ==, "EailFlipselector"); g_assert(atk_object_get_n_accessible_children(obj) == ITEMS_COUNT); /* * AtkSelection tests */ g_assert(ATK_IS_SELECTION(obj)); /* atk_selection_add_selection test */ g_assert(atk_selection_add_selection(ATK_SELECTION(obj), ITEM_SEL_EINA)); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA)); /* atk_selection_clear_selection test */ g_assert(atk_selection_clear_selection(ATK_SELECTION(obj)) == FALSE); /* eail_flipselector_ref_selection test */ g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA)); /* atk_selection_get_selection_count test */ g_assert(atk_selection_get_selection_count(ATK_SELECTION(obj)) == MAX_SELECTIONS); /* atk_selection_is_child_selected test */ g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA)); /* atk_selection_remove_selection test */ g_assert(atk_selection_remove_selection(ATK_SELECTION(obj), ITEM_SEL_EINA)); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_ELM)); /* atk_selection_select_all_selection test */ g_assert(atk_selection_select_all_selection(ATK_SELECTION(obj)) == FALSE); /* * AtkAction tests */ g_assert(ATK_IS_ACTION(obj)); /* atk_action_get_n_actions test */ g_assert(atk_action_get_n_actions(ATK_ACTION(obj)) == ACTIONS_COUNT); /* test existing actions */ g_assert(atk_selection_add_selection(ATK_SELECTION(obj), ITEM_SEL_EINA)); eailu_test_action_activate(ATK_ACTION(obj), "next"); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EDJE)); eailu_test_action_activate(ATK_ACTION(obj), "prev"); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA)); /* test for non-existing action */ g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1); /* test set/get action description */ eailu_test_action_description_all(ATK_ACTION(obj)); }
bool AccessibilityUIElement::isPressActionSupported() { if (!ATK_IS_ACTION(m_element.get())) return false; const gchar* actionName = atk_action_get_name(ATK_ACTION(m_element.get()), 0); return equalIgnoringCase(actionName, String("press")) || equalIgnoringCase(actionName, String("jump")); }
static dbus_bool_t impl_get_NActions (DBusMessageIter * iter, void *user_data) { AtkAction *action = (AtkAction *) user_data; g_return_val_if_fail (ATK_IS_ACTION (user_data), FALSE); return droute_return_v_int32 (iter, atk_action_get_n_actions (action)); }
void AccessibilityUIElement::press() { if (!ATK_IS_ACTION(m_element.get())) return; // Only one action per object is supported so far. atk_action_do_action(ATK_ACTION(m_element.get()), 0); }
void AccessibilityUIElement::press() { if (!m_element) return; ASSERT(ATK_IS_OBJECT(m_element)); if (!ATK_IS_ACTION(m_element)) return; // Only one action per object is supported so far. atk_action_do_action(ATK_ACTION(m_element), 0); }
static void _test_window(AtkObject *obj) { _printf("Testing win instance....\n"); g_assert(ATK_IS_ACTION(obj)); g_assert(2 == atk_action_get_n_actions(ATK_ACTION(obj))); eailu_test_action_activate(ATK_ACTION(obj), EAIL_ACTION_FOR_MAXIMIZE); eailu_test_action_activate(ATK_ACTION(obj), EAIL_ACTION_FOR_MINIMIZE); eail_test_code_called = TRUE; _printf("DONE. All WIN test passed successfully \n"); }
static DBusMessage * impl_GetActions (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkAction *action = (AtkAction *) user_data; DBusMessage *reply; gint count; gint i; DBusMessageIter iter, iter_array, iter_struct; g_return_val_if_fail (ATK_IS_ACTION (user_data), droute_not_yet_handled_error (message)); count = atk_action_get_n_actions (action); reply = dbus_message_new_method_return (message); if (!reply) goto oom; dbus_message_iter_init_append (reply, &iter); if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "(sss)", &iter_array)) goto oom; for (i = 0; i < count; i++) { const char *name = atk_action_get_name (action, i); const char *lname = atk_action_get_localized_name (action, i); const char *desc = atk_action_get_description (action, i); const char *kb = atk_action_get_keybinding (action, i); if (!name) name = ""; if (!lname) lname = ""; if (!desc) desc = ""; if (!kb) kb = ""; if (!dbus_message_iter_open_container (&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct)) goto oom; dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &lname); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &kb); if (!dbus_message_iter_close_container (&iter_array, &iter_struct)) goto oom; } if (!dbus_message_iter_close_container (&iter, &iter_array)) goto oom; return reply; oom: // TODO: handle out-of-memory return reply; }
static void _do_test(AtkObject *obj) { g_assert(ATK_IS_ACTION(obj)); g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj))); eailu_test_action_activate(ATK_ACTION(obj), "click"); g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1); eailu_test_action_description_all(ATK_ACTION(obj)); atk_object_set_name(obj, "test name"); g_assert_cmpstr(atk_object_get_name(obj), ==, "test name"); g_assert(action_test_passed); eailu_test_code_called = 1; }
static void _do_test(AtkObject *obj) { g_assert(ATK_IS_ACTION(obj)); 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)); eailu_test_code_called = 1; }
static void _do_test(AtkObject *obj) { const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj)); const char *name = atk_object_get_name(ATK_OBJECT(obj)); const char *type_name_child; AtkStateSet *state_set; AtkObject *xobj; _printf("type_name: %s\n", type_name ? type_name : "NULL"); g_assert(name); _printf("name: %s\n", name); g_assert_cmpstr(type_name, ==, "EailCheck"); g_assert(ATK_IS_OBJECT(obj)); g_assert(ATK_IS_ACTION(obj)); g_assert(ATK_IS_TEXT(obj)); state_set = atk_object_ref_state_set(obj); if (!strcmp(name, CHECK_TEXT1)) { _printf("check test: %s\n", CHECK_TEXT1); g_assert(atk_state_set_contains_state(state_set, ATK_STATE_CHECKED)); // test children g_assert(0 == atk_object_get_n_accessible_children(obj)); } else if (!strcmp(name, CHECK_TEXT2)) { _printf("check test: %s\n", CHECK_TEXT2); g_assert(!atk_state_set_contains_state(state_set, ATK_STATE_CHECKED)); // test children g_assert(1 == atk_object_get_n_accessible_children(obj)); xobj = atk_object_ref_accessible_child(obj, 0); g_assert(NULL != xobj); type_name_child = g_type_name(G_TYPE_FROM_INSTANCE(xobj)); _printf("type_name_child: %s\n", type_name_child); g_assert_cmpstr(type_name_child, ==, "EailIcon"); }
static void _do_test(AtkObject *obj) { g_assert(ATK_IS_ACTION(obj)); eailu_test_action_activate(ATK_ACTION(obj), "scroll_left"); eailu_test_action_activate(ATK_ACTION(obj), "scroll_right"); eailu_test_action_activate(ATK_ACTION(obj), "scroll_up"); eailu_test_action_activate(ATK_ACTION(obj), "scroll_down"); eailu_test_action_activate(ATK_ACTION(obj), "next"); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 1)); eailu_test_action_activate(ATK_ACTION(obj), "next"); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 2)); eailu_test_action_activate(ATK_ACTION(obj), "next"); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 3)); eailu_test_action_activate(ATK_ACTION(obj), "previous"); g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 2)); eailu_test_action_description_all(ATK_ACTION(obj)); eailu_test_code_called = 1; }
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; }
SpiAccessible * spi_accessible_construct (GType type, AtkObject *o) { SpiAccessible *retval; CORBA_Environment ev; CORBA_exception_init (&ev); g_assert (o); g_assert (g_type_is_a (type, SPI_ACCESSIBLE_TYPE)); if ((retval = g_hash_table_lookup (get_public_refs (), o))) { bonobo_object_ref (BONOBO_OBJECT (retval)); return retval; } else { retval = g_object_new (type, NULL); spi_base_construct (SPI_BASE (retval), G_OBJECT(o)); } g_hash_table_insert (get_public_refs (), o, retval); g_signal_connect (G_OBJECT (retval), "destroy", G_CALLBACK (de_register_public_ref), NULL); /* aggregate appropriate SPI interfaces based on ATK interfaces */ if (ATK_IS_ACTION (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_action_interface_new (o))); } if (ATK_IS_COMPONENT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_component_interface_new (o))); } if (ATK_IS_EDITABLE_TEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT(spi_editable_text_interface_new (o))); } else if (ATK_IS_TEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_text_interface_new (o))); } if (ATK_IS_HYPERTEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_hypertext_interface_new (o))); } if (ATK_IS_IMAGE (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_image_interface_new (o))); } if (ATK_IS_SELECTION (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_selection_interface_new (o))); } if (ATK_IS_TABLE (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_table_interface_new (o))); } if (ATK_IS_VALUE (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_value_interface_new (o))); } if (ATK_IS_STREAMABLE_CONTENT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_streamable_interface_new (o))); } if (ATK_IS_DOCUMENT (o)) /* We add collection interface to document */ { SpiDocument *doc = spi_document_interface_new (o); bonobo_object_add_interface (BONOBO_OBJECT (doc), BONOBO_OBJECT (spi_collection_interface_new (o))); bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (doc)); } if (ATK_IS_HYPERLINK_IMPL (o)) { /* !!! the cast below is used instead of the ATK_HYPERLINK macro, since the object 'o' is not really a hyperlink, but is in fact an AtkHyperlinkImpl. Ouch. This works since it gets cast back to GObject, but it's nasty and needs to be cleaned up. */ bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_hyperlink_new ((AtkHyperlink*)o))); } return retval; }