/** * @brief Implementation of get_image_position from AtkImage interface * * @param image EailButton instance * @param [out] x horizontal coordinate * @param [out] y vertical coordinate * @param coord_type coord type */ static void eail_button_get_image_position(AtkImage *image, gint *x, gint *y, AtkCoordType coord_type) { Evas_Object *button_image; Evas_Object *widget; AtkObject *obj; widget = eail_widget_get_widget(EAIL_WIDGET(image)); if (!widget) { *x = G_MININT; *y = G_MININT; return; } button_image = elm_object_part_content_get(widget, "icon"); if (button_image) { obj = eail_factory_get_accessible(button_image); atk_image_get_image_position(ATK_IMAGE(obj), x, y, coord_type); } else { *x = G_MININT; *y = G_MININT; } }
JNIEXPORT void JNICALL Java_org_gnome_atk_AtkImage_atk_1image_1get_1image_1position ( JNIEnv* env, jclass cls, jlong _self, jintArray _x, jintArray _y, jint _coordType ) { AtkImage* self; gint* x; gint* y; AtkCoordType coordType; // convert parameter self self = (AtkImage*) _self; // convert parameter x x = (gint*) (*env)->GetIntArrayElements(env, _x, NULL); if (x == NULL) { return; // Java Exception already thrown } // convert parameter y y = (gint*) (*env)->GetIntArrayElements(env, _y, NULL); if (y == NULL) { return; // Java Exception already thrown } // convert parameter coordType coordType = (AtkCoordType) _coordType; // call function atk_image_get_image_position(self, x, y, coordType); // cleanup parameter self // cleanup parameter x (*env)->ReleaseIntArrayElements(env, _x, (jint*)x, 0); // cleanup parameter y (*env)->ReleaseIntArrayElements(env, _y, (jint*)y, 0); // cleanup parameter coordType }
static void _do_test(AtkObject *obj) { const char *desc; const char *desc_test = "top secret"; int height = 0, width = 0; int x = -1, y = -1; 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)); g_assert_cmpstr(desc_test, ==, desc); atk_image_get_image_size(ATK_IMAGE(obj), &height, &width); g_assert(ICON_SIZE == height && ICON_SIZE == width); 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)); }