4 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7 * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
26 static void startup(), cleanup();
27 void (*tet_startup) () = startup;
28 void (*tet_cleanup) () = cleanup;
30 static void utc_location_get_position_from_freeformed_address_01();
31 static void utc_location_get_position_from_freeformed_address_02();
32 static void utc_location_get_position_from_freeformed_address_03();
33 static void utc_location_get_position_from_freeformed_address_04();
35 struct tet_testlist tet_testlist[] = {
36 {utc_location_get_position_from_freeformed_address_01,1},
37 {utc_location_get_position_from_freeformed_address_02,2},
38 {utc_location_get_position_from_freeformed_address_03,3},
39 {utc_location_get_position_from_freeformed_address_04,4},
43 static GMainLoop *loop = NULL;
47 gboolean is_found = FALSE;
50 exit_loop (gpointer data)
52 g_main_loop_quit (loop);
59 loc = location_new(LOCATION_METHOD_GPS);
61 loop = g_main_loop_new(NULL,FALSE);
62 tet_printf("\n TC startup");
68 tet_printf("\n TC End");
71 static void comp_position (gpointer data, gpointer user_data)
74 LocationPosition *pos = (LocationPosition *)data;
76 if (37.325276 <= pos->latitude && pos->latitude <= 37.345276 &&
77 -121.900059 <= pos->longitude && pos->longitude<= -121.880059) {
80 location_position_free (pos);
84 static void free_accuracy (gpointer data, gpointer user_data)
88 LocationAccuracy *acc = (LocationAccuracy *)data;
89 if (acc) location_accuracy_free(acc);
93 utc_location_get_position_from_freeformed_address_01()
95 GList *pos_list = NULL;
96 GList *acc_list = NULL;
97 char* addr_str = g_strdup("4 N 2nd Street 95113");
98 ret = location_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list);
100 tet_printf("Returned value: %d", ret);
101 if (ret == LOCATION_ERROR_NONE ) {
102 g_list_foreach (pos_list, comp_position, NULL);
103 g_list_foreach (acc_list, free_accuracy, NULL);
104 if (is_found == TRUE)
105 tet_result(TET_PASS);
107 tet_result(TET_FAIL);
110 tet_result(TET_FAIL);
114 utc_location_get_position_from_freeformed_address_02()
116 GList *pos_list = NULL;
117 GList *acc_list = NULL;
118 char* addr_str = g_strdup("4 N 2nd Street 95113");
119 ret = location_get_position_from_freeformed_address(NULL, addr_str, &pos_list, &acc_list);
121 tet_printf("Returned value: %d", ret);
122 if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
123 else tet_result(TET_FAIL);
127 utc_location_get_position_from_freeformed_address_03()
129 GList *pos_list = NULL;
130 GList *acc_list = NULL;
131 ret = location_get_position_from_freeformed_address(loc, NULL, &pos_list, &acc_list);
132 tet_printf("Returned value: %d", ret);
133 if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
134 else tet_result(TET_FAIL);
138 utc_location_get_position_from_freeformed_address_04()
140 GList *acc_list = NULL;
141 char* addr_str = g_strdup("4 N 2nd Street 95113");
142 ret = location_get_position_from_freeformed_address(loc, addr_str, NULL, &acc_list);
144 tet_printf("Returned value: %d", ret);
145 if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
146 else tet_result(TET_FAIL);