END_TEST /* Basic testing for address API */ START_TEST(elocation_test_api_address) { Eina_Bool ret; Elocation_Address *address = NULL; ret = ecore_init(); fail_if(ret != EINA_TRUE); ret = edbus_init(); fail_if(ret != EINA_TRUE); ret = elocation_init(); fail_if(ret != EINA_TRUE); address = elocation_address_new(); fail_if(address == NULL); ret = elocation_address_get(address); fail_if(ret != EINA_TRUE); elocation_address_free(address); elocation_shutdown(); edbus_shutdown(); ecore_shutdown(); }
EAPI_MAIN int elm_main(int argc, char *argv[]) { #ifdef ELM_ELOCATION Elocation_Address *address; Elocation_Position *position; #endif /* The program will proceed only if Ewebkit library is available. */ if (elm_need_elocation() == EINA_FALSE) return -1; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_util_standard_add("elocation", "Elocation example"); elm_win_autodel_set(win, EINA_TRUE); label = elm_label_add(win); elm_label_line_wrap_set(label, ELM_WRAP_CHAR); elm_object_text_set(label, "Getting location ..."); evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_ALWAYS); evas_object_resize(label, 600, 480); evas_object_show(label); #ifdef ELM_ELOCATION address = elocation_address_new(); position = elocation_position_new(); ecore_event_handler_add(ELOCATION_EVENT_POSITION, _position_changed, NULL); elocation_position_get(position); _print_position(position); #endif evas_object_resize(win, 600, 480); evas_object_show(win); elm_run(); #ifdef ELM_ELOCATION elocation_position_free(position); elocation_address_free(address); #endif elm_shutdown(); return 0; }
END_TEST /* Basic testing for the various functions of the GeoCode API */ START_TEST(elocation_test_api_geocode) { Eina_Bool ret; Elocation_Position *position = NULL; Elocation_Address *address = NULL; ret = ecore_init(); fail_if(ret != EINA_TRUE); ret = edbus_init(); fail_if(ret != EINA_TRUE); ret = elocation_init(); fail_if(ret != EINA_TRUE); position = elocation_position_new(); fail_if(position == NULL); address = elocation_address_new(); fail_if(address == NULL); ret = elocation_freeform_address_to_position("London", position); fail_if(ret != EINA_TRUE); position->latitude = 51.7522; position->longitude = -1.25596; position->accur->level = 3; ret = elocation_position_to_address(position, address); fail_if(ret != EINA_TRUE); address->locality = strdup("Cambridge"); address->countrycode = strdup("UK"); ret = elocation_address_to_position(address, position); fail_if(ret != EINA_TRUE); elocation_position_free(position); free(address->locality); free(address->countrycode); elocation_address_free(address); elocation_shutdown(); edbus_shutdown(); ecore_shutdown(); }
END_TEST /* Basic address object testing. Creating and freeing the object */ START_TEST(elocation_test_address_object) { Eina_Bool ret; Elocation_Address *address = NULL; ret = ecore_init(); fail_if(ret != EINA_TRUE); ret = edbus_init(); fail_if(ret != EINA_TRUE); ret = elocation_init(); fail_if(ret != EINA_TRUE); address = elocation_address_new(); fail_if(address == NULL); elocation_address_free(address); elocation_shutdown(); edbus_shutdown(); ecore_shutdown(); }