diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index a468541..bc9af87 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -54,8 +54,6 @@ exactness_raw_SOURCES = \ test_fileselector.c \ test_list.c \ test_fileselector_entry.c \ - test_map.c \ - test_weather.c \ test_menu.c \ test_naviframe.c \ test_notify.c \ diff --git a/src/bin/test_map.c b/src/bin/test_map.c deleted file mode 100644 index e8fa6b8..0000000 --- a/src/bin/test_map.c +++ /dev/null @@ -1,798 +0,0 @@ -#include -#include "tsuite.h" -#define SOURCE_MAX 10 -#define MARKER_MAX 1000 -#define NAME_ENTRY_TEXT "Enter freeform address" - -typedef struct Map_Source -{ - Evas_Object *map; - char *source_name; -} Map_Source; - -static Elm_Map_Marker_Class *itc1, *itc2, *itc_parking; -static Elm_Map_Group_Class *itc_group1, *itc_group2, *itc_group_parking; - -static Evas_Object *rect, *menu, *fs_win; -static int nb_elts; -/*static Elm_Map_Marker *markers[MARKER_MAX];*/ -static Elm_Map_Marker *route_from, *route_to; -static Elm_Map_Route *route; -static Elm_Map_Name *name; -static Evas_Object *track; -static const char **source_names = NULL; -static Evas_Coord old_x, old_y; -static Evas_Coord old_d; -static Map_Source ms[SOURCE_MAX]; - -struct _Test_Data -{ - char *data1; - char *data2; - char *data3; - char *data4; - char *data5; - char *data6; - char *data7; - char *data8; - char *data9; - char *data10; - char *data11; -}; -typedef struct _Test_Data Test_Data; - -static char *data3; /* used in _marker_get */ - -static Evas_Object * _marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data); -static Evas_Object * _group_icon_get(Evas_Object *obj, void *data); - -static void -#ifdef ELM_EMAP -my_map_gpx_fileselector_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) -#else -my_map_gpx_fileselector_done(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -#endif -{ - const char *selected = event_info; - - if (selected) - { - printf("Selected file: %s\n", selected); -#ifdef ELM_EMAP - EMap_Route *emap = emap_route_gpx_new(selected); - track = elm_map_track_add(data, emap); -#else - printf("libEMap is required !\n"); -#endif - } - evas_object_del(fs_win); -} - -static char * -_get_str(char *dest, const char *str) -{ /* dest should be not null and big enough */ - sprintf(dest, "%s/%s", elm_app_data_dir_get(), str); - return dest; -} - -static void -my_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("clicked\n"); -} - -static void -my_map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("press\n"); -} - -static void -my_map_longpressed(void *data, Evas_Object *obj __UNUSED__, void *event_info) -{ - double lon, lat; - Evas_Coord ox, oy, x, y, w, h; - int zoom; - Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info; - if (!down) return; - - evas_object_geometry_get(data, &ox, &oy, &w, &h); - zoom = elm_map_zoom_get(data); - elm_map_geo_region_get(obj, &lon, &lat); - elm_map_utils_convert_geo_into_coord(obj, lon, lat, pow(2.0, zoom) * 256, &x, &y); - x += down->canvas.x - (w / 2) - ox; - y += down->canvas.y - (h / 2) - oy; - elm_map_utils_convert_coord_into_geo(obj, x, y, pow(2.0, zoom) * 256, &lon, &lat); - - name = elm_map_utils_convert_coord_into_name(data, lon, lat); -} - -static void -my_map_clicked_double(void *data, Evas_Object *obj, void *event_info) -{ - double lon, lat; - double flon, flat, tlon, tlat; - Evas_Coord ox, oy, x, y, w, h, rx, ry, tx, ty; - double d; - int zoom; - char buf[1024]; - Evas_Coord size; - Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info; - if (!down) return; - - evas_object_geometry_get(data, &ox, &oy, &w, &h); - zoom = elm_map_zoom_get(data); - if (zoom < 5) return; - size = pow(2.0, zoom) * 256; - elm_map_geo_region_get(obj, &lon, &lat); - elm_map_utils_convert_geo_into_coord(obj, lon, lat, size, &x, &y); - - rx = x; - ry = y; - x += down->canvas.x - ((float)w * 0.5) - ox; - y += down->canvas.y - ((float)h * 0.5) - oy; - elm_map_rotate_get(data, &d, NULL, NULL); - elm_map_utils_rotate_coord(data, x, y, rx, ry, -d, &tx, &ty); - elm_map_utils_convert_coord_into_geo(obj, tx, ty, size, &lon, &lat); - - itc1 = elm_map_marker_class_new(data); - - elm_map_marker_class_del_cb_set(itc1, NULL); - - itc_group1 = elm_map_group_class_new(data); - elm_map_group_class_icon_cb_set(itc_group1, _group_icon_get); - elm_map_group_class_data_set(itc_group1, _get_str(buf,"images/bubble.png")); - elm_map_group_class_style_set(itc_group1, "empty"); - elm_map_group_class_zoom_displayed_set(itc_group1, 5); - - if (route_from && route_to) - { - elm_map_marker_remove(route_from); - route_from = NULL; - elm_map_marker_remove(route_to); - route_to = NULL; - elm_map_route_remove(route); - } - - if (!route_from) route_from = elm_map_marker_add(data, lon, lat, itc1, itc_group1, NULL); - else route_to = elm_map_marker_add(data, lon, lat, itc1, itc_group1, NULL); - - if (route_from && route_to) - { - elm_map_marker_region_get(route_from, &flon, &flat); - elm_map_marker_region_get(route_to, &tlon, &tlat); - route = elm_map_route_add(data, ELM_MAP_ROUTE_TYPE_MOTOCAR, ELM_MAP_ROUTE_METHOD_FASTEST, flon, flat, tlon, tlat); - elm_map_route_color_set(route, 255, 0, 0, 255); - } -} - -static void -my_map_load_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("load,detail\n"); -} - -static void -my_map_loaded_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("loaded,detail\n"); -} - -static void -my_map_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("zoom,start\n"); -} - -static void -my_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("zoom,stop\n"); -} - -static void -my_map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("zoom,change\n"); -} - -static void -my_map_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("anim,start\n"); -} - -static void -my_map_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("anim,stop\n"); -} - -static void -my_map_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - evas_object_smart_callback_del(data, "longpressed", my_map_longpressed); -} - -static void -my_map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - evas_object_smart_callback_add(data, "longpressed", my_map_longpressed, data); -} - -static void -my_map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) -{ - double lon, lat; - elm_map_geo_region_get(obj, &lon, &lat); - printf("scroll longitude : %f latitude : %f\n", lon, lat); -} - -static void -my_map_downloaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - int try_num, finish_num; - elm_map_utils_downloading_status_get(data, &try_num, &finish_num); - printf("downloaded : %d / %d\n", finish_num, try_num); -} - -static void -my_map_route_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("route_load\n"); -} - -static void -my_map_route_loaded(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - double d; - const char *w, *n; - d = elm_map_route_distance_get(route); - printf("route distance = %lf km\n", d); - - w = elm_map_route_waypoint_get(route); - if (w) printf("[waypoints]\n%s\n", w); - - n = elm_map_route_node_get(route); - if (n) printf("[nodes]\n%s\n", n); -} - -static void -my_map_name_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("name_load\n"); -} - -static void -my_map_name_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - if (!name) return; - double lon, lat; - const char *addr = elm_map_name_address_get(name); - elm_map_name_region_get(name, &lon, &lat); - if (addr) - { - printf("name of [lon = %lf, lat = %lf] is %s\n", lon, lat, addr); - if ((lon != 0.0) && (lat !=0.0)) - { - Eina_Bool b = elm_map_paused_get(data); - elm_map_paused_set(data, EINA_TRUE); - elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); - elm_map_geo_region_show(data, lon, lat); - elm_map_zoom_set(data, 18); - elm_map_paused_set(data, b); - } - } - elm_map_name_remove(name); -} - -static void -map_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Eina_Bool b = elm_map_paused_get(data); - elm_map_paused_set(data, EINA_TRUE); - elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); - elm_map_geo_region_show(data,7.325201, 48.526813); - elm_map_zoom_set(data, 12); - elm_map_paused_set(data, b); -} - -static void -map_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_geo_region_bring_in(data, 126.977969, 37.566535); -} - -static void -map_paused_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_paused_set(data, EINA_TRUE); -} - -static void -map_paused_unset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_paused_set(data, EINA_FALSE); -} - -static void -map_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - int zoom; - - zoom = elm_map_zoom_get(data) + 1; - elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); - elm_map_zoom_set(data, zoom); -} - -static void -map_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - int zoom; - - zoom = elm_map_zoom_get(data) - 1; - elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); - elm_map_zoom_set(data, zoom); -} - -static void -map_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT); -} - -static void -map_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); -} - -static void -map_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Evas_Object *fs, *bg, *vbox, *hbox, *sep; - - fs_win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC); - elm_win_title_set(fs_win, "File Selector"); - elm_win_autodel_set(fs_win, 1); - - bg = elm_bg_add(fs_win); - elm_win_resize_object_add(fs_win, bg); - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(bg); - - vbox = elm_box_add(fs_win); - elm_win_resize_object_add(fs_win, vbox); - evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(vbox); - - fs = elm_fileselector_add(fs_win); - elm_fileselector_is_save_set(fs, EINA_TRUE); - elm_fileselector_expandable_set(fs, EINA_FALSE); - elm_fileselector_path_set(fs, getenv("HOME")); - evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_pack_end(vbox, fs); - evas_object_show(fs); - - evas_object_smart_callback_add(fs, "done", my_map_gpx_fileselector_done, data); - - sep = elm_separator_add(fs_win); - elm_separator_horizontal_set(sep, EINA_TRUE); - elm_box_pack_end(vbox, sep); - evas_object_show(sep); - - hbox = elm_box_add(fs_win); - elm_box_horizontal_set(hbox, EINA_TRUE); - elm_box_pack_end(vbox, hbox); - evas_object_show(hbox); - - evas_object_resize(fs_win, 240, 350); - evas_object_show(fs_win); -} - - -static void -map_track_remove(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_track_remove(data, track); -} - -static void -map_rotate_cw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - double d; - Evas_Coord x, y, w, h; - float half_w, half_h; - evas_object_geometry_get(data, &x, &y, &w, &h); - half_w = (float)w * 0.5; - half_h = (float)h * 0.5; - - elm_map_rotate_get(data, &d, NULL, NULL); - d += 15.0; - elm_map_rotate_set(data, d, x + half_w, y + half_h); -} - -static void -map_rotate_ccw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - double d; - Evas_Coord x, y, w, h; - float half_w, half_h; - evas_object_geometry_get(data, &x, &y, &w, &h); - half_w = (float)w * 0.5; - half_h = (float)h * 0.5; - - elm_map_rotate_get(data, &d, NULL, NULL); - d -= 15.0; - elm_map_rotate_set(data, d, x + half_w, y + half_h); -} - -static void -map_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Evas_Coord x, y, w, h; - float half_w, half_h; - evas_object_geometry_get(data, &x, &y, &w, &h); - half_w = (float)w * 0.5; - half_h = (float)h * 0.5; - - elm_map_rotate_set(data, 0.0, x + half_w, y + half_h); -} - -static void -map_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_source_zoom_min_set(data, 1); -} - -static void -map_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - elm_map_source_zoom_max_set(data, 10); -} - -static void -map_source(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Map_Source *s = data; - - if (!s) return; - elm_map_source_name_set(s->map, s->source_name); -} - -static Evas_Object * -_marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data) -{ - char *d = data; - - Evas_Object *bx = elm_box_add(obj); - evas_object_show(bx); - - if (d == data3) - { - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, d, NULL); - evas_object_show(icon); - - Evas_Object *o = elm_button_add(obj); - elm_object_part_content_set(o, "icon", icon); - evas_object_show(o); - elm_box_pack_end(bx, o); - } - else - { - Evas_Object *o = evas_object_image_add(evas_object_evas_get(obj)); - evas_object_image_file_set(o, d, NULL); - evas_object_image_filled_set(o, EINA_TRUE); - evas_object_size_hint_min_set(o, 64, 64); - evas_object_show(o); - elm_box_pack_end(bx, o); - - Evas_Object *lbl = elm_label_add(obj); - elm_object_text_set(lbl, "Wolves Go !"); - evas_object_show(lbl); - elm_box_pack_end(bx, lbl); - } - - return bx; -} - -static Evas_Object * -_icon_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data) -{ - char *d = data; - - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, d, NULL); - evas_object_show(icon); - - return icon; -} - -static Evas_Object * -_group_icon_get(Evas_Object *obj, void *data) -{ - char *file = data; - - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, file, NULL); - evas_object_show(icon); - - return icon; -} - -static void -_map_move_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - int x,y,w,h; - - evas_object_geometry_get(data,&x,&y,&w,&h); - evas_object_resize(rect,w,h); - evas_object_move(rect,x,y); -} - -static void -_populate(void *data, Elm_Object_Item *menu_it) -{ - int idx; - - if ((!data) || (!menu_it) || (!source_names)) return; - for (idx = 0; source_names[idx]; idx++) - { - if (idx >= SOURCE_MAX) break; - ms[idx].map = data; - ms[idx].source_name = strdup(source_names[idx]); - elm_menu_item_add(menu, menu_it, "", source_names[idx], map_source, - &ms[idx]); - } -} - -static void -_map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Down *down = event_info; - Elm_Object_Item *menu_it; - if (!down) return; - - if (down->button == 2) - { - old_x = down->canvas.x; - old_y = down->canvas.y; - old_d = 0.0; - } - else if (down->button == 3) - { - menu = elm_menu_add(obj); - menu_it = elm_menu_item_add(menu, NULL, NULL, "Source", NULL, NULL); - _populate(data, menu_it); - elm_menu_item_add(menu, NULL, NULL, "Show Urmatt", map_show_urmatt, data); - elm_menu_item_add(menu, NULL, NULL, "Bring Seoul", map_bring_seoul, data); - elm_menu_item_add(menu, NULL, NULL, "Paused Set", map_paused_set, data); - elm_menu_item_add(menu, NULL, NULL, "Paused Unset", map_paused_unset, data); - elm_menu_item_add(menu, NULL, NULL, "Zoom +", map_zoom_in, data); - elm_menu_item_add(menu, NULL, NULL, "Zoom -", map_zoom_out, data); - elm_menu_item_add(menu, NULL, NULL, "Zoom Fit", map_zoom_fit, data); - elm_menu_item_add(menu, NULL, NULL, "Zoom Fill", map_zoom_fill, data); - elm_menu_item_add(menu, NULL, NULL, "Add Track", map_track_add, data); - elm_menu_item_add(menu, NULL, NULL, "Remove Track", map_track_remove, data); - elm_menu_item_add(menu, NULL, NULL, "Add Marker", NULL, NULL); - elm_menu_item_add(menu, NULL, NULL, "Rotate CW", map_rotate_cw, data); - elm_menu_item_add(menu, NULL, NULL, "Rotate CCW", map_rotate_ccw, data); - elm_menu_item_add(menu, NULL, NULL, "Reset Rotate", map_rotate_reset, data); - elm_menu_item_add(menu, NULL, NULL, "Set Zoom Min to 1", map_zoom_min_set, data); - elm_menu_item_add(menu, NULL, NULL, "Set Zoom Max to 10", map_zoom_max_set, data); - - elm_menu_move(menu, down->canvas.x, down->canvas.y); - evas_object_show(menu); - } -} - -static void -_map_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Evas_Event_Mouse_Move *move = event_info; - Evas_Coord x, y, w, h; - float half_w, half_h; - int d, d_diff; - double cur_d; - if (!move) return; - - if (move->buttons == 2) - { - evas_object_geometry_get(data, &x, &y, &w, &h); - half_w = (float)w * 0.5; - half_h = (float)h * 0.5; - elm_map_rotate_get(data, &cur_d, NULL, NULL); - - d = move->cur.canvas.x - old_x; - if (!old_d) old_d = d; - else - { - d_diff = old_d - d; - if (d_diff > 0) - { - old_d --; - cur_d += 1.0; - } - else if (d_diff < 0) - { - old_d ++; - cur_d -= 1.0; - } - old_d = d; - elm_map_rotate_set(data, cur_d, x + half_w, y + half_h); - } - } -} - -static void -_map_mouse_up(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Evas_Event_Mouse_Up *up = event_info; - if (!up) return; - - if (up->button == 2) - { - old_x = 0; - old_y = 0; - } -} - -static void -_win_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Test_Data *tdata = data; - if (!data) return; - - free(tdata->data1); - free(tdata->data2); - free(tdata->data3); - free(tdata->data4); - free(tdata->data5); - free(tdata->data6); - free(tdata->data7); - free(tdata->data8); - free(tdata->data9); - free(tdata->data10); - free(tdata->data11); - - free(tdata); -} - -TEST_START(test_map) -{ - Evas_Object *bg, *map; - int idx = 0; - char buf[1024]; - - Test_Data *tdata = malloc(sizeof(Test_Data)); - tdata->data1 = strdup(_get_str(buf, "images/logo.png")); - tdata->data2 = strdup(_get_str(buf, "images/logo_small.png")); - data3 = tdata->data3 = strdup(_get_str(buf, "images/panel_01.jpg")); - tdata->data4 = strdup(_get_str(buf, "images/plant_01.jpg")); - tdata->data5 = strdup(_get_str(buf, "images/rock_01.jpg")); - tdata->data6 = strdup(_get_str(buf, "images/rock_02.jpg")); - tdata->data7 = strdup(_get_str(buf, "images/sky_01.jpg")); - tdata->data8 = strdup(_get_str(buf, "images/sky_02.jpg")); - tdata->data9 = strdup(_get_str(buf, "images/sky_03.jpg")); - tdata->data10 = strdup(_get_str(buf, "images/sky_03.jpg")); - tdata->data11= strdup(_get_str(buf, "images/wood_01.jpg")); - - evas_object_smart_callback_add(win, "delete,request", _win_del, tdata); - bg = elm_bg_add(win); - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, bg); - evas_object_show(bg); - - map = elm_map_add(win); - if (map) - { - srand(time(NULL)); - - source_names = elm_map_source_names_get(map); - - if (!source_names) return; - printf("map sources [ "); - for (idx = 0; source_names[idx] ; idx++) printf("%s ", source_names[idx]); - printf("]\n"); - - evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, map); - evas_object_data_set(map, "window", win); - - // - itc1 = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(itc1, _marker_get); - elm_map_marker_class_del_cb_set(itc1, NULL); - - itc2 = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(itc2, _marker_get); - elm_map_marker_class_del_cb_set(itc2, NULL); - elm_map_marker_class_style_set(itc2, "radio2"); - - itc_parking = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(itc_parking, _marker_get); - elm_map_marker_class_del_cb_set(itc_parking, NULL); - elm_map_marker_class_icon_cb_set(itc_parking, _icon_get); - elm_map_marker_class_style_set(itc_parking, "empty"); - // - - // - itc_group1 = elm_map_group_class_new(map); - elm_map_group_class_data_set(itc_group1, - _get_str(buf, "images/plant_01.jpg")); - - itc_group2 = elm_map_group_class_new(map); - elm_map_group_class_style_set(itc_group2, "radio2"); - elm_map_group_class_zoom_displayed_set(itc_group1, 3); - - itc_group_parking = elm_map_group_class_new(map); - elm_map_group_class_icon_cb_set(itc_group_parking, _group_icon_get); - elm_map_group_class_data_set(itc_group_parking, - _get_str(buf, "images/parking.png")); - elm_map_group_class_style_set(itc_group_parking, "empty"); - elm_map_group_class_zoom_displayed_set(itc_group_parking, 5); - // - - rect = evas_object_rectangle_add(evas_object_evas_get(win)); - evas_object_color_set(rect, 0, 0, 0, 0); - evas_object_repeat_events_set(rect,1); - evas_object_show(rect); - evas_object_raise(rect); - - evas_object_event_callback_add(map, EVAS_CALLBACK_RESIZE, - _map_move_resize_cb, map); - evas_object_event_callback_add(map, EVAS_CALLBACK_MOVE, - _map_move_resize_cb, map); - evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_DOWN, - _map_mouse_down, map); - evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_MOVE, - _map_mouse_move, map); - evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_UP, - _map_mouse_up, map); - - elm_map_marker_add(map, 2.352, 48.857, itc1, itc_group1, tdata->data1); - elm_map_marker_add(map, 2.355, 48.857, itc1, itc_group1, tdata->data3); - elm_map_marker_add(map, 3, 48.857, itc2, itc_group1, tdata->data2); - elm_map_marker_add(map, 2.352, 49, itc2, itc_group1, tdata->data1); - - elm_map_marker_add(map, 7.31451, 48.857127, itc1, itc_group1, tdata->data10); - elm_map_marker_add(map, 7.314704, 48.857119, itc1, itc_group1, tdata->data4); - elm_map_marker_add(map, 7.314704, 48.857119, itc2, itc_group1, tdata->data5); - elm_map_marker_add(map, 7.31432, 48.856785, itc2, itc_group1, tdata->data6); - elm_map_marker_add(map, 7.3148, 48.85725, itc1, itc_group2, tdata->data7); - elm_map_marker_add(map, 7.316445, 48.8572210000694, itc1, itc_group1, tdata->data8); - elm_map_marker_add(map, 7.316527000125, 48.85609, itc2, itc_group2, tdata->data9); - elm_map_marker_add(map, 7.3165409990833, 48.856078, itc2, itc_group1, tdata->data11); - elm_map_marker_add(map, 7.319812, 48.856561, itc2, itc_group2, tdata->data10); - - nb_elts = 13; - - evas_object_smart_callback_add(map, "clicked", my_map_clicked, win); - evas_object_smart_callback_add(map, "press", my_map_press, win); - evas_object_smart_callback_add(map, "longpressed", my_map_longpressed, map); - evas_object_smart_callback_add(map, "clicked,double", my_map_clicked_double, map); - evas_object_smart_callback_add(map, "load,detail", my_map_load_detail, win); - evas_object_smart_callback_add(map, "loaded,detail", my_map_loaded_detail, win); - evas_object_smart_callback_add(map, "zoom,start", my_map_zoom_start, win); - evas_object_smart_callback_add(map, "zoom,stop", my_map_zoom_stop, win); - evas_object_smart_callback_add(map, "zoom,change", my_map_zoom_change, win); - evas_object_smart_callback_add(map, "scroll,anim,start", my_map_anim_start, win); - evas_object_smart_callback_add(map, "scroll,anim,stop", my_map_anim_stop, win); - evas_object_smart_callback_add(map, "scroll,drag,start", my_map_drag_start, map); - evas_object_smart_callback_add(map, "scroll,drag,stop", my_map_drag_stop, map); - evas_object_smart_callback_add(map, "scroll", my_map_scroll, win); - evas_object_smart_callback_add(map, "downloaded", my_map_downloaded, map); - evas_object_smart_callback_add(map, "route,load", my_map_route_load, map); - evas_object_smart_callback_add(map, "route,loaded", my_map_route_loaded, map); - evas_object_smart_callback_add(map, "name,load", my_map_name_load, map); - evas_object_smart_callback_add(map, "name,loaded", my_map_name_loaded, map); - - evas_object_show(map); - } - - evas_object_resize(win, 800, 800); - evas_object_show(win); -} -TEST_END diff --git a/src/bin/test_weather.c b/src/bin/test_weather.c deleted file mode 100644 index 44b0b64..0000000 --- a/src/bin/test_weather.c +++ /dev/null @@ -1,167 +0,0 @@ -#include -#include "tsuite.h" -#ifdef HAVE_ELEMENTARY_EWEATHER -# include "EWeather_Smart.h" -#endif - -#ifdef HAVE_ELEMENTARY_EWEATHER -static Evas_Object *en, *hv, *fl; -static Evas_Object *weather[2]; -static int current = 0; -static Eina_Module *module[2]; - -static void -_first_city_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) -{ - if (!current) return; - current = 0; - elm_flip_go(fl, ELM_FLIP_ROTATE_YZ_CENTER_AXIS); -} - -static void -_second_city_cb(void *dat __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) -{ - if (current) return; - current = 1; - elm_flip_go(fl, ELM_FLIP_ROTATE_XZ_CENTER_AXIS); -} - -static void _apply_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) -{ - EWeather *eweather = eweather_object_eweather_get(weather[current]); - - if (module[current]) - eweather_plugin_set(eweather, module[current]); - eweather_code_set(eweather, elm_entry_entry_get(en)); - printf("CURRENT %d %p %p\n", current, module[current], eweather); -} - -static void -_hover_select_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - EWeather *eweather = eweather_object_eweather_get(weather[0]); - module[0] = eweather_plugin_search(eweather, elm_hoversel_item_label_get(event_info)); - - eweather = eweather_object_eweather_get(weather[1]); - module[1] = eweather_plugin_search(eweather, elm_hoversel_item_label_get(event_info)); - printf("%p %p\n", module[0], module[1]); -} -#endif - -TEST_START(test_weather) -{ - Evas_Object *bg; -#ifdef HAVE_ELEMENTARY_EWEATHER - Evas_Object *bx, *bx0, *bt; - EWeather *eweather; - Eina_Array_Iterator it; - Eina_Array *array; - Eina_Module *m; - unsigned int i; -#endif - - bg = elm_bg_add(win); - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, bg); - evas_object_show(bg); - -#ifdef HAVE_ELEMENTARY_EWEATHER - bx = elm_box_add(win); - elm_win_resize_object_add(win, bx); - evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(bx); - - fl = elm_flip_add(win); - evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_box_pack_end(bx, fl); - - current = 0; - - module[0] = NULL; - weather[0] = eweather_object_add(evas_object_evas_get(win)); - evas_object_size_hint_weight_set(weather[0], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(weather[0], -1.0, -1.0); - elm_flip_content_front_set(fl, weather[0]); - evas_object_show(weather[0]); - - module[1] = NULL; - weather[1] = eweather_object_add(evas_object_evas_get(win)); - eweather = eweather_object_eweather_get(weather[1]); - evas_object_size_hint_weight_set(weather[1], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(weather[1], -1.0, -1.0); - elm_flip_content_back_set(fl, weather[1]); - evas_object_show(weather[1]); - - evas_object_show(fl); - - // - bx0 = elm_box_add(win); - elm_box_horizontal_set(bx0, EINA_TRUE); - evas_object_size_hint_weight_set(bx0, 1.0, 0.0); - elm_box_pack_end(bx, bx0); - evas_object_show(bx0); - - bt = elm_button_add(win); - elm_object_text_set(bt, "First city"); - evas_object_show(bt); - elm_box_pack_end(bx0, bt); - evas_object_smart_callback_add(bt, "clicked", _first_city_cb, NULL); - - bt = elm_button_add(win); - elm_object_text_set(bt, "Second city"); - evas_object_show(bt); - elm_box_pack_end(bx0, bt); - evas_object_smart_callback_add(bt, "clicked", _second_city_cb, NULL); - // - - // - bx0 = elm_box_add(win); - elm_box_horizontal_set(bx0, EINA_TRUE); - evas_object_size_hint_weight_set(bx0, 1.0, 0.0); - elm_box_pack_end(bx, bx0); - evas_object_show(bx0); - - hv = elm_hoversel_add(win); - elm_hoversel_hover_parent_set(hv, win); - elm_object_text_set(hv, "data source"); - evas_object_size_hint_weight_set(hv, 0.0, 0.0); - evas_object_size_hint_align_set(hv, 0.5, 0.5); - elm_box_pack_end(bx0, hv); - evas_object_show(hv); - - array = eweather_plugins_list_get(eweather); - - EINA_ARRAY_ITER_NEXT(array, i, m, it) - elm_hoversel_item_add(hv, eweather_plugin_name_get(eweather, i), NULL, ELM_ICON_NONE, _hover_select_cb, NULL); - - en = elm_entry_add(win); - elm_entry_line_wrap_set(en, ELM_WRAP_NONE); - elm_entry_single_line_set(en, EINA_TRUE); - elm_entry_entry_set(en, "Paris"); - evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_pack_end(bx0, en); - evas_object_show(en); - - bt = elm_button_add(win); - elm_object_text_set(bt, "Apply"); - evas_object_show(bt); - elm_box_pack_end(bx0, bt); - evas_object_smart_callback_add(bt, "clicked", _apply_cb, NULL); - // - - -#else - Evas_Object *lbl; - - lbl = elm_label_add(win); - elm_win_resize_object_add(win, lbl); - elm_object_text_set(lbl, "libeweather is required to display the forecast."); - evas_object_show(lbl); -#endif - - evas_object_resize(win, 244, 388); - evas_object_show(win); -} -TEST_END diff --git a/src/bin/tsuite.c b/src/bin/tsuite.c index 4d5ac65..240f146 100644 --- a/src/bin/tsuite.c +++ b/src/bin/tsuite.c @@ -69,7 +69,6 @@ void test_list2(void); void test_list3(void); void test_list4(void); void test_list5(void); -void test_map(void); void test_menu(void); void test_naviframe(void); void test_notify(void); @@ -101,7 +100,6 @@ void test_toolbar4(void); void test_toolbar5(void); void test_tooltip(void); void test_tooltip2(void); -void test_weather(void); /* START - Some globals - may want to move these to Timer_Data struct later */ static Lists_st *vr_list = NULL; @@ -809,7 +807,6 @@ elm_main(int argc, char **argv) tests = _add_test(tests, "test_list3", test_list3, test_all); tests = _add_test(tests, "test_list4", test_list4, test_all); tests = _add_test(tests, "test_list5", test_list5, test_all); - tests = _add_test(tests, "test_map", test_map, test_all); tests = _add_test(tests, "test_menu", test_menu, test_all); tests = _add_test(tests, "test_naviframe", test_naviframe, test_all); tests = _add_test(tests, "test_notify", test_notify, test_all); @@ -843,7 +840,6 @@ elm_main(int argc, char **argv) tests = _add_test(tests, "test_toolbar5", test_toolbar5, test_all); tests = _add_test(tests, "test_tooltip", test_tooltip, test_all); tests = _add_test(tests, "test_tooltip2", test_tooltip2, test_all); - tests = _add_test(tests, "test_weather", test_weather, test_all); Eina_List *l;