JNIEXPORT jint JNICALL Java_org_gnome_atk_AtkAction_atk_1action_1get_1n_1actions ( JNIEnv* env, jclass cls, jlong _self ) { gint result; jint _result; AtkAction* self; // convert parameter self self = (AtkAction*) _self; // call function result = atk_action_get_n_actions(self); // cleanup parameter self // translate return value to JNI type _result = (jint) result; // and finally return _result; }
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); }
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)); }
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; }
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)); }
// This is used to set ATK action descriptions. void glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description) { gint n_actions, i; n_actions = atk_action_get_n_actions (action); for (i = 0; i < n_actions; i++) if (!strcmp (atk_action_get_name (action, i), action_name)) atk_action_set_description (action, i, description); }
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(-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) { 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_photo(AtkObject *obj) { const char *name = atk_object_get_name(obj); const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj)); const char * const desc_test = "top secret"; const char *desc; int height = 0, width = 0; int x = -1, y = -1; _printf("_get_name: %s\n", name ? name : "NULL"); _printf("_get_type_name: %s\n", type_name ? type_name : "NULL"); g_assert(ATK_IS_IMAGE(obj)); AtkStateSet *state_set = atk_object_ref_state_set(obj); g_object_unref(state_set); // test AtkImage atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN); _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y); g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj))); g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test)); desc = atk_image_get_image_description(ATK_IMAGE(obj)); _printf("atk_image_get_image_description: %s\n", desc ? desc : "NULL"); g_assert(NULL != desc); g_assert_cmpstr(desc_test, ==, desc); atk_image_get_image_size(ATK_IMAGE(obj), &height, &width); _printf("atk_image_get_image_size: height %d width %d\n", height, width); // test AtkAction 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)); }
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; }