2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <locations.h>
22 POSITIVE_TC_IDX = 0x01,
26 static void startup(void);
27 static void cleanup(void);
29 void (*tet_startup) (void) = startup;
30 void (*tet_cleanup) (void) = cleanup;
32 static void utc_location_location_manager_create_p(void);
33 static void utc_location_location_manager_create_p_02(void);
34 static void utc_location_location_manager_create_p_03(void);
35 static void utc_location_location_manager_create_p_04(void);
36 static void utc_location_location_manager_create_p_05(void);
37 static void utc_location_location_manager_create_n(void);
38 static void utc_location_location_manager_create_n_02(void);
39 static void utc_location_location_manager_create_n_03(void);
40 static void utc_location_location_manager_create_n_04(void);
41 static void utc_location_location_manager_create_n_05(void);
42 static void utc_location_location_manager_create_n_06(void);
43 static void utc_location_location_manager_add_boundary_p(void);
44 static void utc_location_location_manager_add_boundary_n(void);
45 static void utc_location_location_manager_add_boundary_n_02(void);
46 static void utc_location_location_manager_add_boundary_n_03(void);
47 static void utc_location_location_manager_add_boundary_n_04(void);
48 static void utc_location_location_manager_foreach_boundary_p(void);
49 static void utc_location_location_manager_foreach_boundary_n(void);
50 static void utc_location_location_manager_foreach_boundary_n_02(void);
51 static void utc_location_location_manager_foreach_boundary_n_03(void);
52 static void utc_location_location_manager_foreach_boundary_n_04(void);
53 static void utc_location_location_manager_remove_boundary_p(void);
54 static void utc_location_location_manager_remove_boundary_n(void);
55 static void utc_location_location_manager_remove_boundary_n_02(void);
56 static void utc_location_location_manager_remove_boundary_n_03(void);
57 static void utc_location_location_manager_remove_boundary_n_04(void);
58 static void utc_location_location_manager_get_method_p(void);
59 static void utc_location_location_manager_get_method_n(void);
60 static void utc_location_location_manager_get_method_n_02(void);
61 static void utc_location_location_manager_get_method_n_03(void);
62 static void utc_location_location_manager_get_method_n_04(void);
63 static void utc_location_location_manager_get_position_p(void);
64 static void utc_location_location_manager_get_position_n(void);
65 static void utc_location_location_manager_get_position_n_02(void);
66 static void utc_location_location_manager_get_position_n_03(void);
67 static void utc_location_location_manager_get_position_n_04(void);
68 static void utc_location_location_manager_get_position_n_05(void);
69 static void utc_location_location_manager_get_position_n_06(void);
70 static void utc_location_location_manager_get_velocity_p(void);
71 static void utc_location_location_manager_get_velocity_n(void);
72 static void utc_location_location_manager_get_velocity_n_02(void);
73 static void utc_location_location_manager_get_velocity_n_03(void);
74 static void utc_location_location_manager_get_velocity_n_04(void);
75 static void utc_location_location_manager_get_velocity_n_05(void);
76 static void utc_location_location_manager_get_velocity_n_06(void);
77 static void utc_location_location_manager_get_accuracy_p(void);
78 static void utc_location_location_manager_get_accuracy_n(void);
79 static void utc_location_location_manager_get_accuracy_n_02(void);
80 static void utc_location_location_manager_get_accuracy_n_03(void);
81 static void utc_location_location_manager_get_accuracy_n_04(void);
82 static void utc_location_location_manager_get_accuracy_n_05(void);
83 static void utc_location_location_manager_get_accuracy_n_06(void);
84 static void utc_location_location_bounds_foreach_polygon_coords_p(void);
85 static void utc_location_location_bounds_foreach_polygon_coords_n(void);
86 static void utc_location_location_bounds_foreach_polygon_coords_n_02(void);
87 static void utc_location_location_bounds_get_circle_coords_p(void);
88 static void utc_location_location_bounds_get_circle_coords_n(void);
89 static void utc_location_location_bounds_get_circle_coords_n_02(void);
90 static void utc_location_location_bounds_get_circle_coords_n_03(void);
91 static void utc_location_location_bounds_get_rect_coords_p(void);
92 static void utc_location_location_bounds_get_rect_coords_n(void);
93 static void utc_location_location_bounds_get_rect_coords_n_02(void);
94 static void utc_location_location_bounds_get_rect_coords_n_03(void);
95 static void utc_location_location_bounds_contains_coordinates_p(void);
96 static void utc_location_location_bounds_contains_coordinates_p_02(void);
97 static void utc_location_location_bounds_contains_coordinates_n(void);
98 static void utc_location_location_bounds_contains_coordinates_n_02(void);
99 static void utc_location_location_manager_get_last_accuracy_p(void);
100 static void utc_location_location_manager_get_last_accuracy_n(void);
101 static void utc_location_location_manager_get_last_accuracy_n_02(void);
102 static void utc_location_location_manager_get_last_accuracy_n_03(void);
103 static void utc_location_location_manager_get_last_accuracy_n_04(void);
104 static void utc_location_location_manager_get_last_position_p(void);
105 static void utc_location_location_manager_get_last_position_n(void);
106 static void utc_location_location_manager_get_last_position_n_02(void);
107 static void utc_location_location_manager_get_last_position_n_03(void);
108 static void utc_location_location_manager_get_last_position_n_04(void);
109 static void utc_location_location_manager_get_last_position_n_05(void);
110 static void utc_location_location_manager_get_last_velocity_p(void);
111 static void utc_location_location_manager_get_last_velocity_n(void);
112 static void utc_location_location_manager_get_last_velocity_n_02(void);
113 static void utc_location_location_manager_get_last_velocity_n_03(void);
114 static void utc_location_location_manager_get_last_velocity_n_04(void);
115 static void utc_location_location_manager_get_last_velocity_n_05(void);
116 static void utc_location_location_manager_is_supported_method_p(void);
117 static void utc_location_location_manager_is_supported_method_p_02(void);
118 static void utc_location_location_manager_is_supported_method_p_03(void);
119 static void utc_location_location_manager_is_supported_method_p_04(void);
120 static void utc_location_location_manager_is_supported_method_n(void);
121 static void utc_location_location_manager_is_supported_method_n_02(void);
122 static void utc_location_location_manager_send_command_p(void);
123 static void utc_location_location_manager_send_command_n(void);
124 static void utc_location_location_manager_destroy_p(void);
125 static void utc_location_location_manager_destroy_n(void);
126 static void utc_location_location_manager_destroy_n_02(void);
128 struct tet_testlist tet_testlist[] = {
129 {utc_location_location_manager_create_p, POSITIVE_TC_IDX},
130 {utc_location_location_manager_create_p_02, POSITIVE_TC_IDX},
131 {utc_location_location_manager_create_p_03, POSITIVE_TC_IDX},
132 { utc_location_location_manager_create_p_04, POSITIVE_TC_IDX },
133 // { utc_location_location_manager_create_p_05, POSITIVE_TC_IDX }, // LOCATIONS_METHOD_NONE is a negative TC.
134 {utc_location_location_manager_create_n, NEGATIVE_TC_IDX},
135 {utc_location_location_manager_create_n_02, NEGATIVE_TC_IDX},
136 {utc_location_location_manager_create_n_03, NEGATIVE_TC_IDX},
137 {utc_location_location_manager_create_n_04, NEGATIVE_TC_IDX},
138 {utc_location_location_manager_create_n_05, NEGATIVE_TC_IDX},
139 {utc_location_location_manager_create_n_06, NEGATIVE_TC_IDX},
140 {utc_location_location_manager_add_boundary_p, POSITIVE_TC_IDX},
141 {utc_location_location_manager_add_boundary_n, NEGATIVE_TC_IDX},
142 {utc_location_location_manager_add_boundary_n_02, NEGATIVE_TC_IDX},
143 {utc_location_location_manager_add_boundary_n_03, NEGATIVE_TC_IDX},
144 {utc_location_location_manager_add_boundary_n_04, NEGATIVE_TC_IDX},
145 {utc_location_location_manager_foreach_boundary_p, POSITIVE_TC_IDX},
146 {utc_location_location_manager_foreach_boundary_n, NEGATIVE_TC_IDX},
147 {utc_location_location_manager_foreach_boundary_n_02, NEGATIVE_TC_IDX},
148 // { utc_location_location_manager_foreach_boundary_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
149 {utc_location_location_manager_foreach_boundary_n_04, NEGATIVE_TC_IDX},
150 {utc_location_location_manager_remove_boundary_p, POSITIVE_TC_IDX},
151 {utc_location_location_manager_remove_boundary_n, NEGATIVE_TC_IDX},
152 {utc_location_location_manager_remove_boundary_n_02, NEGATIVE_TC_IDX},
153 // { utc_location_location_manager_remove_boundary_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
154 {utc_location_location_manager_remove_boundary_n_04, NEGATIVE_TC_IDX},
155 {utc_location_location_manager_get_method_p, POSITIVE_TC_IDX},
156 {utc_location_location_manager_get_method_n, NEGATIVE_TC_IDX},
157 {utc_location_location_manager_get_method_n_02, NEGATIVE_TC_IDX},
158 {utc_location_location_manager_get_method_n_03, NEGATIVE_TC_IDX},
159 // { utc_location_location_manager_get_method_n_04, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
160 {utc_location_location_manager_get_position_p, POSITIVE_TC_IDX},
161 {utc_location_location_manager_get_position_n, NEGATIVE_TC_IDX},
162 {utc_location_location_manager_get_position_n_02, NEGATIVE_TC_IDX},
163 // { utc_location_location_manager_get_position_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
164 {utc_location_location_manager_get_position_n_04, NEGATIVE_TC_IDX},
165 {utc_location_location_manager_get_position_n_05, NEGATIVE_TC_IDX},
166 {utc_location_location_manager_get_position_n_06, NEGATIVE_TC_IDX},
167 {utc_location_location_manager_get_velocity_p, POSITIVE_TC_IDX},
168 {utc_location_location_manager_get_velocity_n, NEGATIVE_TC_IDX},
169 {utc_location_location_manager_get_velocity_n_02, NEGATIVE_TC_IDX},
170 // { utc_location_location_manager_get_velocity_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
171 {utc_location_location_manager_get_velocity_n_04, NEGATIVE_TC_IDX},
172 {utc_location_location_manager_get_velocity_n_05, NEGATIVE_TC_IDX},
173 {utc_location_location_manager_get_velocity_n_06, NEGATIVE_TC_IDX},
174 {utc_location_location_manager_get_accuracy_p, POSITIVE_TC_IDX},
175 {utc_location_location_manager_get_accuracy_n, NEGATIVE_TC_IDX},
176 {utc_location_location_manager_get_accuracy_n_02, NEGATIVE_TC_IDX},
177 // { utc_location_location_manager_get_accuracy_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
178 {utc_location_location_manager_get_accuracy_n_04, NEGATIVE_TC_IDX},
179 {utc_location_location_manager_get_accuracy_n_05, NEGATIVE_TC_IDX},
180 {utc_location_location_manager_get_accuracy_n_06, NEGATIVE_TC_IDX},
181 {utc_location_location_bounds_foreach_polygon_coords_p, POSITIVE_TC_IDX},
182 {utc_location_location_bounds_foreach_polygon_coords_n, NEGATIVE_TC_IDX},
183 {utc_location_location_bounds_foreach_polygon_coords_n_02, NEGATIVE_TC_IDX},
184 {utc_location_location_bounds_get_circle_coords_p, POSITIVE_TC_IDX},
185 {utc_location_location_bounds_get_circle_coords_n, NEGATIVE_TC_IDX},
186 {utc_location_location_bounds_get_circle_coords_n_02, NEGATIVE_TC_IDX},
187 {utc_location_location_bounds_get_circle_coords_n_03, NEGATIVE_TC_IDX},
188 {utc_location_location_bounds_get_rect_coords_p, POSITIVE_TC_IDX},
189 {utc_location_location_bounds_get_rect_coords_n, NEGATIVE_TC_IDX},
190 {utc_location_location_bounds_get_rect_coords_n_02, NEGATIVE_TC_IDX},
191 {utc_location_location_bounds_get_rect_coords_n_03, NEGATIVE_TC_IDX},
192 {utc_location_location_bounds_contains_coordinates_p, POSITIVE_TC_IDX},
193 {utc_location_location_bounds_contains_coordinates_p_02, POSITIVE_TC_IDX},
194 {utc_location_location_bounds_contains_coordinates_n, NEGATIVE_TC_IDX},
195 {utc_location_location_bounds_contains_coordinates_n_02, NEGATIVE_TC_IDX},
196 {utc_location_location_manager_get_last_accuracy_p, POSITIVE_TC_IDX},
197 {utc_location_location_manager_get_last_accuracy_n, NEGATIVE_TC_IDX},
198 {utc_location_location_manager_get_last_accuracy_n_02, NEGATIVE_TC_IDX},
199 {utc_location_location_manager_get_last_accuracy_n_03, NEGATIVE_TC_IDX},
200 {utc_location_location_manager_get_last_accuracy_n_04, NEGATIVE_TC_IDX},
201 {utc_location_location_manager_get_last_position_p, POSITIVE_TC_IDX},
202 {utc_location_location_manager_get_last_position_n, NEGATIVE_TC_IDX},
203 {utc_location_location_manager_get_last_position_n_02, NEGATIVE_TC_IDX},
204 {utc_location_location_manager_get_last_position_n_03, NEGATIVE_TC_IDX},
205 {utc_location_location_manager_get_last_position_n_04, NEGATIVE_TC_IDX},
206 {utc_location_location_manager_get_last_position_n_05, NEGATIVE_TC_IDX},
207 {utc_location_location_manager_get_last_velocity_p, POSITIVE_TC_IDX},
208 {utc_location_location_manager_get_last_velocity_n, NEGATIVE_TC_IDX},
209 {utc_location_location_manager_get_last_velocity_n_02, NEGATIVE_TC_IDX},
210 {utc_location_location_manager_get_last_velocity_n_03, NEGATIVE_TC_IDX},
211 {utc_location_location_manager_get_last_velocity_n_04, NEGATIVE_TC_IDX},
212 {utc_location_location_manager_get_last_velocity_n_05, NEGATIVE_TC_IDX},
213 {utc_location_location_manager_is_supported_method_p, POSITIVE_TC_IDX},
214 {utc_location_location_manager_is_supported_method_p_02, POSITIVE_TC_IDX},
215 {utc_location_location_manager_is_supported_method_p_03, POSITIVE_TC_IDX},
216 {utc_location_location_manager_is_supported_method_p_04, POSITIVE_TC_IDX},
217 {utc_location_location_manager_is_supported_method_n, NEGATIVE_TC_IDX},
218 {utc_location_location_manager_is_supported_method_n_02, NEGATIVE_TC_IDX},
219 {utc_location_location_manager_destroy_p, POSITIVE_TC_IDX},
220 {utc_location_location_manager_destroy_n, NEGATIVE_TC_IDX},
221 // { utc_location_location_manager_destroy_n_02, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
225 static bool service_enabled = false;
226 static bool touch_foreach_bounds = false;
228 static GMainLoop *g_mainloop = NULL;
229 static GThread *event_thread;
231 gpointer GmainThread(gpointer data)
233 g_mainloop = g_main_loop_new(NULL, 0);
234 g_main_loop_run(g_mainloop);
238 static void validate_and_next(char *api_name, int act_ret, int ext_ret, char *fail_msg)
240 dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
241 if (act_ret != ext_ret) {
242 dts_message(api_name, "Fail Message: %s", fail_msg);
247 static void validate_eq(char *api_name, int act_ret, int ext_ret)
249 dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
250 if (act_ret == ext_ret) {
257 static void wait_for_service(char *api_name)
260 for (timeout; timeout < 60; timeout++) {
261 if (service_enabled) {
262 dts_message(api_name, "Location Service Enabled!!!!");
265 dts_message(api_name, "Location Service Disabled!!!!");
271 static void wait_for_bounds_foreach(char *api_name)
274 for (timeout; timeout < 30; timeout++) {
275 if (touch_foreach_bounds) {
276 dts_message(api_name, "bound foreach called!!!!");
279 dts_message(api_name, "No bound foreach!!!!");
285 static void __state_changed_cb(location_service_state_e state, void *user_data)
288 case LOCATIONS_SERVICE_ENABLED:
289 service_enabled = true;
291 case LOCATIONS_SERVICE_DISABLED:
292 service_enabled = false;
299 static bool __location_bounds_cb(location_bounds_h bounds, void *user_data)
302 printf("bounds ==NULL\n");
304 location_bounds_type_e type;
305 location_bounds_get_type(bounds, &type);
306 dts_message(__func__, "__location_bounds_cb - type : %d!!!!", type);
307 touch_foreach_bounds = TRUE;
312 static location_manager_h manager;
313 static location_bounds_h bounds_rect;
314 static location_bounds_h bounds_circle;
315 static location_bounds_h bounds_poly;
317 static void startup(void)
319 g_setenv("PKG_NAME", "com.samsung.capi-location-manager-test", 1);
320 g_setenv("LOCATION_TEST_ENABLE", "1", 1);
322 #if !GLIB_CHECK_VERSION (2, 31, 0)
323 if (!g_thread_supported()) {
328 event_thread = g_thread_create(GmainThread, NULL, 1, NULL);
331 static void cleanup(void)
334 location_manager_unset_service_state_changed_cb(manager);
335 location_manager_stop(manager);
336 location_manager_destroy(manager);
340 service_enabled = false;
341 touch_foreach_bounds = false;
342 g_main_loop_quit(g_mainloop);
343 g_thread_join(event_thread);
346 static void utc_location_location_manager_create_p(void)
350 ret = location_manager_create(LOCATIONS_METHOD_HYBRID, &manager);
351 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
353 ret = location_manager_set_service_state_changed_cb(manager, __state_changed_cb, NULL);
354 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
356 ret = location_manager_start(manager);
357 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
359 wait_for_service(__func__);
362 location_manager_stop(manager); //If you call start() and then stop(), service_enabled always set false.
363 location_manager_unset_service_state_changed_cb(manager);
366 validate_eq(__func__, service_enabled, true);
369 static void utc_location_location_manager_create_p_02(void)
372 location_manager_h manager_02;
374 ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager_02);
377 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
379 ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
380 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
382 ret = location_manager_start(manager_02);
383 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
385 wait_for_service(__func__);
387 location_manager_stop(manager_02);
388 location_manager_unset_service_state_changed_cb(manager_02);
391 location_manager_destroy(manager_02);
393 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
396 static void utc_location_location_manager_create_p_03(void)
399 location_manager_h manager_02;
401 ret = location_manager_create(LOCATIONS_METHOD_WPS, &manager_02);
404 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
406 ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
407 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
409 ret = location_manager_start(manager_02);
410 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
412 wait_for_service(__func__);
414 location_manager_stop(manager_02);
415 location_manager_unset_service_state_changed_cb(manager_02);
418 location_manager_destroy(manager_02);
420 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
423 static void utc_location_location_manager_create_p_04(void)
426 location_manager_h manager_02;
428 ret = location_manager_create(LOCATIONS_METHOD_CPS, &manager_02);
429 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
431 ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
432 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
434 ret = location_manager_start(manager_02);
435 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
437 wait_for_service(__func__);
439 location_manager_stop(manager_02);
440 location_manager_unset_service_state_changed_cb(manager_02);
441 location_manager_destroy(manager_02);
443 validate_eq(__func__, service_enabled, TRUE);
446 static void utc_location_location_manager_create_p_05(void)
449 location_manager_h manager_02;
451 ret = location_manager_create(LOCATIONS_METHOD_NONE, &manager_02);
452 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
454 ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
455 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
457 ret = location_manager_start(manager_02);
458 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
460 wait_for_service(__func__);
462 location_manager_stop(manager_02);
463 location_manager_unset_service_state_changed_cb(manager_02);
464 location_manager_destroy(manager_02);
466 validate_eq(__func__, service_enabled, TRUE);
469 static void utc_location_location_manager_create_n(void)
471 int ret = LOCATIONS_ERROR_NONE;
473 ret = location_manager_create(LOCATIONS_METHOD_HYBRID, NULL);
474 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
478 static void utc_location_location_manager_create_n_02(void)
480 int ret = LOCATIONS_ERROR_NONE;
482 ret = location_manager_create(LOCATIONS_METHOD_NONE, NULL);
483 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
487 static void utc_location_location_manager_create_n_03(void)
489 int ret = LOCATIONS_ERROR_NONE;
491 ret = location_manager_create(LOCATIONS_METHOD_GPS, NULL);
492 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
496 static void utc_location_location_manager_create_n_04(void)
498 int ret = LOCATIONS_ERROR_NONE;
500 ret = location_manager_create(LOCATIONS_METHOD_WPS, NULL);
501 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
505 static void utc_location_location_manager_create_n_05(void)
507 int ret = LOCATIONS_ERROR_NONE;
509 ret = location_manager_create(LOCATIONS_METHOD_CPS, NULL);
510 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
514 static void utc_location_location_manager_create_n_06(void)
516 int ret = LOCATIONS_ERROR_NONE;
517 location_manager_h manager_02;
519 ret = location_manager_create(LOCATIONS_METHOD_CPS + 1, &manager_02);
520 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
524 static void utc_location_location_manager_add_boundary_p(void)
526 int ret = LOCATIONS_ERROR_NONE;
528 //Add the circle bounds
529 location_coords_s center;
530 center.latitude = 37.258;
531 center.longitude = 127.056;
533 ret = location_bounds_create_circle(center, radius, &bounds_circle);
534 validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_circle() is failed");
536 ret = location_manager_add_boundary(manager, bounds_circle);
537 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_add_boundary() is failed");
539 //Add the rect bounds
540 location_coords_s left_top;
541 left_top.latitude = 30;
542 left_top.longitude = 30;
544 location_coords_s right_bottom;
545 right_bottom.latitude = 10;
546 right_bottom.longitude = 50;
548 ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
549 validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_rect() is failed");
551 ret = location_manager_add_boundary(manager, bounds_rect);
552 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_add_boundary() is failed");
554 //Add the polygon bounds
557 location_coords_s coord_list[poly_size];
559 coord_list[0].latitude = 10;
560 coord_list[0].longitude = 10;
561 coord_list[1].latitude = 20;
562 coord_list[1].longitude = 20;
563 coord_list[2].latitude = 30;
564 coord_list[2].longitude = 30;
566 ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
567 validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_polygon() is failed");
569 ret = location_manager_add_boundary(manager, bounds_poly);
570 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
573 static void utc_location_location_manager_add_boundary_n(void)
575 int ret = LOCATIONS_ERROR_NONE;
576 ret = location_manager_add_boundary(NULL, NULL);
577 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
580 static void utc_location_location_manager_add_boundary_n_02(void)
582 int ret = LOCATIONS_ERROR_NONE;
583 ret = location_manager_add_boundary(manager, NULL);
584 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
587 static void utc_location_location_manager_add_boundary_n_03(void)
589 int ret = LOCATIONS_ERROR_NONE;
591 //Add the circle bounds
592 location_coords_s center;
593 center.latitude = 37.258;
594 center.longitude = 127.056;
596 ret = location_bounds_create_circle(center, radius, &bounds_circle);
597 validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_circle() is failed");
599 ret = location_manager_add_boundary(NULL, bounds_circle);
600 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
603 static void utc_location_location_manager_add_boundary_n_04(void)
605 int ret = LOCATIONS_ERROR_NONE;
606 location_manager_h manager_02;
608 //Add the circle bounds
609 location_coords_s center;
610 center.latitude = 37.258;
611 center.longitude = 127.056;
613 ret = location_bounds_create_circle(center, radius, &bounds_circle);
614 validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_circle() is failed");
616 ret = location_manager_add_boundary(manager_02, bounds_circle);
617 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
620 static void utc_location_location_manager_foreach_boundary_p(void)
622 int ret = LOCATIONS_ERROR_NONE;
623 ret = location_manager_foreach_boundary(manager, __location_bounds_cb, (void *)manager);
624 validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_manager_foreach_boundary() is failed");
625 wait_for_bounds_foreach(__func__);
626 validate_eq(__func__, touch_foreach_bounds, TRUE);
629 static void utc_location_location_manager_foreach_boundary_n(void)
631 int ret = LOCATIONS_ERROR_NONE;
632 ret = location_manager_foreach_boundary(NULL, NULL, NULL);
633 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
636 static void utc_location_location_manager_foreach_boundary_n_02(void)
638 int ret = LOCATIONS_ERROR_NONE;
639 ret = location_manager_foreach_boundary(NULL, __location_bounds_cb, (void *)manager);
640 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
643 static void utc_location_location_manager_foreach_boundary_n_03(void)
645 int ret = LOCATIONS_ERROR_NONE;
646 location_manager_h manager_02;
647 ret = location_manager_foreach_boundary(manager_02, __location_bounds_cb, (void *)manager);
648 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
651 static void utc_location_location_manager_foreach_boundary_n_04(void)
653 int ret = LOCATIONS_ERROR_NONE;
654 location_manager_h manager_02;
655 ret = location_manager_foreach_boundary(manager, NULL, NULL);
656 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
659 static void utc_location_location_manager_remove_boundary_p(void)
661 int ret = LOCATIONS_ERROR_NONE;
662 ret = location_manager_remove_boundary(manager, bounds_rect);
663 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_remove_boundary(rect) is failed");
664 ret = location_manager_remove_boundary(manager, bounds_circle);
665 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_remove_boundary(circle) is failed");
666 ret = location_manager_remove_boundary(manager, bounds_poly);
667 location_bounds_destroy(bounds_rect);
668 location_bounds_destroy(bounds_circle);
669 location_bounds_destroy(bounds_poly);
670 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
673 static void utc_location_location_manager_remove_boundary_n(void)
675 int ret = LOCATIONS_ERROR_NONE;
676 ret = location_manager_remove_boundary(NULL, NULL);
677 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
680 static void utc_location_location_manager_remove_boundary_n_02(void)
682 int ret = LOCATIONS_ERROR_NONE;
683 ret = location_manager_remove_boundary(NULL, bounds_rect);
684 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
687 static void utc_location_location_manager_remove_boundary_n_03(void)
689 int ret = LOCATIONS_ERROR_NONE;
690 location_manager_h manager_02;
691 ret = location_manager_remove_boundary(manager_02, bounds_rect);
692 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
695 static void utc_location_location_manager_remove_boundary_n_04(void)
697 int ret = LOCATIONS_ERROR_NONE;
698 ret = location_manager_remove_boundary(manager, NULL);
699 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
702 static void utc_location_location_manager_get_method_p(void)
704 int ret = LOCATIONS_ERROR_NONE;
705 location_method_e method;
706 ret = location_manager_get_method(manager, &method);
707 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
710 static void utc_location_location_manager_get_method_n(void)
712 int ret = LOCATIONS_ERROR_NONE;
713 ret = location_manager_get_method(NULL, NULL);
714 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
718 static void utc_location_location_manager_get_method_n_02(void)
720 int ret = LOCATIONS_ERROR_NONE;
721 ret = location_manager_get_method(manager, NULL);
722 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
726 static void utc_location_location_manager_get_method_n_03(void)
728 int ret = LOCATIONS_ERROR_NONE;
729 location_method_e method;
730 ret = location_manager_get_method(NULL, &method);
731 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
735 static void utc_location_location_manager_get_method_n_04(void)
737 int ret = LOCATIONS_ERROR_NONE;
738 location_manager_h manager_02;
739 location_method_e method;
740 ret = location_manager_get_method(manager_02, &method);
741 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
745 static void utc_location_location_manager_get_position_p(void)
748 int ret = LOCATIONS_ERROR_NONE;
755 ret = location_manager_get_position(manager, &altitude, &latitude, &longitude, ×tamp);
756 dts_message(__func__, "altitude : %lf, latitude : %lf, longitude : %lf, timestamp:%d", latitude, latitude, longitude,
758 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
761 static void utc_location_location_manager_get_position_n(void)
763 int ret = LOCATIONS_ERROR_NONE;
769 ret = location_manager_get_position(manager, NULL, &latitude, &longitude, ×tamp);
770 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
773 static void utc_location_location_manager_get_position_n_02(void)
775 int ret = LOCATIONS_ERROR_NONE;
782 ret = location_manager_get_position(NULL, &altitude, &latitude, &longitude, ×tamp);
783 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
786 static void utc_location_location_manager_get_position_n_03(void)
788 int ret = LOCATIONS_ERROR_NONE;
794 location_manager_h manager_02;
796 ret = location_manager_get_position(manager_02, &altitude, &latitude, &longitude, ×tamp);
797 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
800 static void utc_location_location_manager_get_position_n_04(void)
802 int ret = LOCATIONS_ERROR_NONE;
808 ret = location_manager_get_position(manager, &altitude, NULL, &longitude, ×tamp);
809 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
812 static void utc_location_location_manager_get_position_n_05(void)
814 int ret = LOCATIONS_ERROR_NONE;
820 ret = location_manager_get_position(manager, &altitude, &latitude, NULL, ×tamp);
821 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
824 static void utc_location_location_manager_get_position_n_06(void)
826 int ret = LOCATIONS_ERROR_NONE;
832 ret = location_manager_get_position(manager, &altitude, &latitude, &longitude, NULL);
833 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
836 static void utc_location_location_manager_get_velocity_p(void)
838 int ret = LOCATIONS_ERROR_NONE;
845 ret = location_manager_get_velocity(manager, &climb, &direction, &speed, ×tamp);
846 dts_message(__func__, "climb : %lf, direction : %lf, speed : %lf, timestamp:%d", climb, direction, speed, timestamp);
847 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
850 static void utc_location_location_manager_get_velocity_n(void)
852 int ret = LOCATIONS_ERROR_NONE;
858 ret = location_manager_get_velocity(manager, NULL, &direction, &speed, ×tamp);
859 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
862 static void utc_location_location_manager_get_velocity_n_02(void)
864 int ret = LOCATIONS_ERROR_NONE;
871 ret = location_manager_get_velocity(NULL, &climb, &direction, &speed, ×tamp);
872 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
875 static void utc_location_location_manager_get_velocity_n_03(void)
877 int ret = LOCATIONS_ERROR_NONE;
883 location_manager_h manager_02;
885 ret = location_manager_get_velocity(manager_02, &climb, &direction, &speed, ×tamp);
886 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
889 static void utc_location_location_manager_get_velocity_n_04(void)
891 int ret = LOCATIONS_ERROR_NONE;
897 ret = location_manager_get_velocity(manager, &climb, NULL, &speed, ×tamp);
898 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
901 static void utc_location_location_manager_get_velocity_n_05(void)
903 int ret = LOCATIONS_ERROR_NONE;
909 ret = location_manager_get_velocity(manager, &climb, &direction, NULL, ×tamp);
910 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
913 static void utc_location_location_manager_get_velocity_n_06(void)
915 int ret = LOCATIONS_ERROR_NONE;
921 ret = location_manager_get_velocity(manager, &climb, &direction, &speed, NULL);
922 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
925 static void utc_location_location_manager_get_accuracy_p(void)
927 int ret = LOCATIONS_ERROR_NONE;
929 location_accuracy_level_e level;
933 ret = location_manager_get_accuracy(manager, &level, &horizontal, &vertical);
934 dts_message(__func__, "Level : %lf, horizontal : %lf, vertical : %lf", level, horizontal, vertical);
935 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
938 static void utc_location_location_manager_get_accuracy_n(void)
940 int ret = LOCATIONS_ERROR_NONE;
942 ret = location_manager_get_accuracy(manager, NULL, NULL, NULL);
943 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
946 static void utc_location_location_manager_get_accuracy_n_02(void)
948 int ret = LOCATIONS_ERROR_NONE;
950 location_accuracy_level_e level;
954 ret = location_manager_get_accuracy(NULL, &level, &horizontal, &vertical);
955 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
958 static void utc_location_location_manager_get_accuracy_n_03(void)
960 int ret = LOCATIONS_ERROR_NONE;
962 location_accuracy_level_e level;
965 location_manager_h manager_02;
967 ret = location_manager_get_accuracy(manager_02, &level, &horizontal, &vertical);
968 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
971 static void utc_location_location_manager_get_accuracy_n_04(void)
973 int ret = LOCATIONS_ERROR_NONE;
978 ret = location_manager_get_accuracy(manager, NULL, &horizontal, &vertical);
979 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
982 static void utc_location_location_manager_get_accuracy_n_05(void)
984 int ret = LOCATIONS_ERROR_NONE;
986 location_accuracy_level_e level;
989 ret = location_manager_get_accuracy(manager, &level, NULL, &vertical);
990 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
993 static void utc_location_location_manager_get_accuracy_n_06(void)
995 int ret = LOCATIONS_ERROR_NONE;
997 location_accuracy_level_e level;
1000 ret = location_manager_get_accuracy(manager, &level, &horizontal, NULL);
1001 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1004 static bool capi_poly_coords_cb(location_coords_s coords, void *user_data)
1006 printf("location_bounds_foreach_rect_coords(latitude : %lf, longitude: %lf) \n", coords.latitude, coords.longitude);
1010 static void utc_location_location_bounds_foreach_polygon_coords_p(void)
1012 int ret = LOCATIONS_ERROR_NONE;
1014 //Add the polygon bounds
1016 location_coords_s coord_list[poly_size];
1018 coord_list[0].latitude = 10;
1019 coord_list[0].longitude = 10;
1020 coord_list[1].latitude = 20;
1021 coord_list[1].longitude = 20;
1022 coord_list[2].latitude = 30;
1023 coord_list[2].longitude = 30;
1025 location_bounds_h bounds_poly;
1026 ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
1027 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
1029 ret = location_bounds_foreach_polygon_coords(bounds_poly, capi_poly_coords_cb, NULL);
1031 location_bounds_destroy(bounds_poly);
1033 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1036 static void utc_location_location_bounds_foreach_polygon_coords_n(void)
1038 int ret = LOCATIONS_ERROR_NONE;
1040 ret = location_bounds_foreach_polygon_coords(NULL, capi_poly_coords_cb, NULL);
1042 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1045 static void utc_location_location_bounds_foreach_polygon_coords_n_02(void)
1047 int ret = LOCATIONS_ERROR_NONE;
1049 //Add the polygon bounds
1051 location_coords_s coord_list[poly_size];
1053 coord_list[0].latitude = 10;
1054 coord_list[0].longitude = 10;
1055 coord_list[1].latitude = 20;
1056 coord_list[1].longitude = 20;
1057 coord_list[2].latitude = 30;
1058 coord_list[2].longitude = 30;
1060 location_bounds_h bounds_poly;
1061 ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
1062 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
1064 ret = location_bounds_foreach_polygon_coords(bounds_poly, NULL, NULL);
1066 location_bounds_destroy(bounds_poly);
1068 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1071 static void utc_location_location_bounds_get_circle_coords_p(void)
1073 int ret = LOCATIONS_ERROR_NONE;
1075 location_coords_s center;
1076 center.latitude = 37.258;
1077 center.longitude = 127.056;
1079 location_bounds_h bounds_circle;
1080 ret = location_bounds_create_circle(center, radius, &bounds_circle);
1081 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_circle() is failed");
1083 location_coords_s center2;
1085 ret = location_bounds_get_circle_coords(bounds_circle, ¢er2, &radius2);
1087 location_bounds_destroy(bounds_circle);
1089 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1092 static void utc_location_location_bounds_get_circle_coords_n(void)
1094 int ret = LOCATIONS_ERROR_NONE;
1096 location_coords_s center2;
1098 ret = location_bounds_get_circle_coords(NULL, ¢er2, &radius2);
1100 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1103 static void utc_location_location_bounds_get_circle_coords_n_02(void)
1105 int ret = LOCATIONS_ERROR_NONE;
1107 location_coords_s center;
1108 center.latitude = 37.258;
1109 center.longitude = 127.056;
1111 location_bounds_h bounds_circle;
1112 ret = location_bounds_create_circle(center, radius, &bounds_circle);
1113 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_circle() is failed");
1116 ret = location_bounds_get_circle_coords(bounds_circle, NULL, &radius2);
1118 location_bounds_destroy(bounds_circle);
1120 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1123 static void utc_location_location_bounds_get_circle_coords_n_03(void)
1125 int ret = LOCATIONS_ERROR_NONE;
1127 location_coords_s center;
1128 center.latitude = 37.258;
1129 center.longitude = 127.056;
1131 location_bounds_h bounds_circle;
1132 ret = location_bounds_create_circle(center, radius, &bounds_circle);
1133 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_circle() is failed");
1135 location_coords_s center2;
1136 ret = location_bounds_get_circle_coords(bounds_circle, ¢er2, NULL);
1138 location_bounds_destroy(bounds_circle);
1140 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1143 static void utc_location_location_bounds_get_rect_coords_p(void)
1145 int ret = LOCATIONS_ERROR_NONE;
1147 //Add the rect bounds
1148 location_coords_s left_top;
1149 left_top.latitude = 30;
1150 left_top.longitude = 30;
1152 location_coords_s right_bottom;
1153 right_bottom.latitude = 10;
1154 right_bottom.longitude = 50;
1156 location_bounds_h bounds_rect;
1157 ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
1158 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_rect() is failed");
1160 location_coords_s left_top2;
1161 location_coords_s right_bottom2;
1162 ret = location_bounds_get_rect_coords(bounds_rect, &left_top2, &right_bottom2);
1164 location_bounds_destroy(bounds_rect);
1166 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1169 static void utc_location_location_bounds_get_rect_coords_n(void)
1171 int ret = LOCATIONS_ERROR_NONE;
1173 location_coords_s left_top2;
1174 location_coords_s right_bottom2;
1175 ret = location_bounds_get_rect_coords(NULL, &left_top2, &right_bottom2);
1177 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1180 static void utc_location_location_bounds_get_rect_coords_n_02(void)
1182 int ret = LOCATIONS_ERROR_NONE;
1184 //Add the rect bounds
1185 location_coords_s left_top;
1186 left_top.latitude = 30;
1187 left_top.longitude = 30;
1189 location_coords_s right_bottom;
1190 right_bottom.latitude = 10;
1191 right_bottom.longitude = 50;
1193 location_bounds_h bounds_rect;
1194 ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
1195 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_rect() is failed");
1197 location_coords_s right_bottom2;
1198 ret = location_bounds_get_rect_coords(bounds_rect, NULL, &right_bottom2);
1200 location_bounds_destroy(bounds_rect);
1202 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1205 static void utc_location_location_bounds_get_rect_coords_n_03(void)
1207 int ret = LOCATIONS_ERROR_NONE;
1209 //Add the rect bounds
1210 location_coords_s left_top;
1211 left_top.latitude = 30;
1212 left_top.longitude = 30;
1214 location_coords_s right_bottom;
1215 right_bottom.latitude = 10;
1216 right_bottom.longitude = 50;
1218 location_bounds_h bounds_rect;
1219 ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
1220 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_rect() is failed");
1222 location_coords_s left_top2;
1223 ret = location_bounds_get_rect_coords(bounds_rect, &left_top2, NULL);
1225 location_bounds_destroy(bounds_rect);
1227 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1230 static void utc_location_location_bounds_contains_coordinates_p(void)
1232 int ret = LOCATIONS_ERROR_NONE;
1234 //Add the polygon bounds
1236 location_coords_s coord_list[poly_size];
1238 coord_list[0].latitude = 10;
1239 coord_list[0].longitude = 10;
1240 coord_list[1].latitude = 20;
1241 coord_list[1].longitude = 20;
1242 coord_list[2].latitude = 30;
1243 coord_list[2].longitude = 10;
1245 location_bounds_h bounds_poly;
1246 ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
1247 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
1249 location_coords_s test_coords;
1250 test_coords.latitude = 20;
1251 test_coords.longitude = 12;
1252 bool contained = FALSE;
1253 contained = location_bounds_contains_coordinates(bounds_poly, test_coords);
1255 location_bounds_destroy(bounds_poly);
1257 validate_eq(__func__, contained, TRUE);
1260 static void utc_location_location_bounds_contains_coordinates_p_02(void)
1262 int ret = LOCATIONS_ERROR_NONE;
1264 //Add the polygon bounds
1266 location_coords_s coord_list[poly_size];
1268 coord_list[0].latitude = 10;
1269 coord_list[0].longitude = 10;
1270 coord_list[1].latitude = 20;
1271 coord_list[1].longitude = 20;
1272 coord_list[2].latitude = 30;
1273 coord_list[2].longitude = 10;
1275 location_bounds_h bounds_poly;
1276 ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
1277 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
1279 location_coords_s test_coords;
1280 test_coords.latitude = 50;
1281 test_coords.longitude = 50;
1282 bool contained = FALSE;
1283 contained = location_bounds_contains_coordinates(bounds_poly, test_coords);
1285 location_bounds_destroy(bounds_poly);
1287 validate_eq(__func__, contained, FALSE);
1291 static void utc_location_location_bounds_contains_coordinates_n(void)
1293 int ret = LOCATIONS_ERROR_NONE;
1295 location_coords_s test_coords;
1296 test_coords.latitude = 12;
1297 test_coords.longitude = 12;
1298 ret = location_bounds_contains_coordinates(NULL, test_coords);
1300 validate_eq(__func__, ret, FALSE);
1303 static void utc_location_location_bounds_contains_coordinates_n_02(void)
1305 int ret = LOCATIONS_ERROR_NONE;
1307 //Add the polygon bounds
1309 location_coords_s coord_list[poly_size];
1311 coord_list[0].latitude = 10;
1312 coord_list[0].longitude = 10;
1313 coord_list[1].latitude = 20;
1314 coord_list[1].longitude = 20;
1315 coord_list[2].latitude = 30;
1316 coord_list[2].longitude = 10;
1318 location_bounds_h bounds_poly;
1319 ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
1320 validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
1322 location_coords_s coord_test;
1323 coord_test.latitude = -91;
1324 coord_test.longitude = 181;
1325 ret = location_bounds_contains_coordinates(bounds_poly, coord_test);
1327 location_bounds_destroy(bounds_poly);
1329 validate_eq(__func__, ret, FALSE);
1332 static void utc_location_location_manager_get_last_accuracy_p(void)
1335 int ret = LOCATIONS_ERROR_NONE;
1337 double horizontal, vertical;
1338 location_accuracy_level_e level;
1340 ret = location_manager_get_last_accuracy(manager, &level, &horizontal, &vertical);
1341 dts_message(__func__, "Level : %d, horizontal: %g, vertical : %g\n", level, horizontal, vertical);
1342 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1345 static void utc_location_location_manager_get_last_accuracy_n(void)
1347 int ret = LOCATIONS_ERROR_NONE;
1349 double horizontal, vertical;
1350 location_accuracy_level_e level;
1352 ret = location_manager_get_last_accuracy(NULL, &level, &horizontal, &vertical);
1353 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1356 static void utc_location_location_manager_get_last_accuracy_n_02(void)
1358 int ret = LOCATIONS_ERROR_NONE;
1360 double horizontal, vertical;
1362 ret = location_manager_get_last_accuracy(manager, NULL, &horizontal, &vertical);
1363 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1366 static void utc_location_location_manager_get_last_accuracy_n_03(void)
1368 int ret = LOCATIONS_ERROR_NONE;
1371 location_accuracy_level_e level;
1373 ret = location_manager_get_last_accuracy(manager, &level, NULL, &vertical);
1374 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1377 static void utc_location_location_manager_get_last_accuracy_n_04(void)
1379 int ret = LOCATIONS_ERROR_NONE;
1382 location_accuracy_level_e level;
1384 ret = location_manager_get_last_accuracy(manager, &level, &horizontal, NULL);
1385 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1388 static void utc_location_location_manager_get_last_position_p(void)
1391 int ret = LOCATIONS_ERROR_NONE;
1398 ret = location_manager_get_last_position(manager, &altitude, &latitude, &longitude, ×tamp);
1399 dts_message(__func__, "altitude : %lf, latitude : %lf, longitude : %lf, timestamp:%d", latitude, latitude, longitude,
1401 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1404 static void utc_location_location_manager_get_last_position_n(void)
1406 int ret = LOCATIONS_ERROR_NONE;
1413 ret = location_manager_get_last_position(NULL, &altitude, &latitude, &longitude, ×tamp);
1414 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1417 static void utc_location_location_manager_get_last_position_n_02(void)
1419 int ret = LOCATIONS_ERROR_NONE;
1425 ret = location_manager_get_last_position(manager, NULL, &latitude, &longitude, ×tamp);
1426 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1429 static void utc_location_location_manager_get_last_position_n_03(void)
1431 int ret = LOCATIONS_ERROR_NONE;
1437 ret = location_manager_get_last_position(manager, &altitude, NULL, &longitude, ×tamp);
1438 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1441 static void utc_location_location_manager_get_last_position_n_04(void)
1443 int ret = LOCATIONS_ERROR_NONE;
1449 ret = location_manager_get_last_position(manager, &altitude, &latitude, NULL, ×tamp);
1450 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1453 static void utc_location_location_manager_get_last_position_n_05(void)
1455 int ret = LOCATIONS_ERROR_NONE;
1461 ret = location_manager_get_last_position(manager, &altitude, &latitude, &longitude, NULL);
1462 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1465 static void utc_location_location_manager_get_last_velocity_p(void)
1468 int ret = LOCATIONS_ERROR_NONE;
1475 ret = location_manager_get_last_velocity(manager, &climb, &direction, &speed, ×tamp);
1476 dts_message(__func__, "climb : %lf, direction : %lf, speed : %lf, timestamp:%d", climb, direction, speed, timestamp);
1477 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1480 static void utc_location_location_manager_get_last_velocity_n(void)
1482 int ret = LOCATIONS_ERROR_NONE;
1489 ret = location_manager_get_last_velocity(NULL, &climb, &direction, &speed, ×tamp);
1490 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1493 static void utc_location_location_manager_get_last_velocity_n_02(void)
1495 int ret = LOCATIONS_ERROR_NONE;
1501 ret = location_manager_get_last_velocity(manager, NULL, &direction, &speed, ×tamp);
1502 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1505 static void utc_location_location_manager_get_last_velocity_n_03(void)
1507 int ret = LOCATIONS_ERROR_NONE;
1513 ret = location_manager_get_last_velocity(manager, &climb, NULL, &speed, ×tamp);
1514 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1517 static void utc_location_location_manager_get_last_velocity_n_04(void)
1519 int ret = LOCATIONS_ERROR_NONE;
1525 ret = location_manager_get_last_velocity(manager, &climb, &direction, NULL, ×tamp);
1526 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1529 static void utc_location_location_manager_get_last_velocity_n_05(void)
1531 int ret = LOCATIONS_ERROR_NONE;
1537 ret = location_manager_get_last_velocity(manager, &climb, &direction, &speed, NULL);
1538 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1541 static void utc_location_location_manager_is_supported_method_p(void)
1543 bool supported = FALSE;
1544 supported = location_manager_is_supported_method(LOCATIONS_METHOD_HYBRID);
1545 validate_eq(__func__, supported, TRUE);
1548 static void utc_location_location_manager_is_supported_method_p_02(void)
1550 bool supported = FALSE;
1551 supported = location_manager_is_supported_method(LOCATIONS_METHOD_GPS);
1552 validate_eq(__func__, supported, TRUE);
1555 static void utc_location_location_manager_is_supported_method_p_03(void)
1557 bool supported = FALSE;
1558 supported = location_manager_is_supported_method(LOCATIONS_METHOD_WPS);
1559 validate_eq(__func__, supported, TRUE);
1562 static void utc_location_location_manager_is_supported_method_p_04(void)
1564 bool supported = FALSE;
1565 supported = location_manager_is_supported_method(LOCATIONS_METHOD_CPS);
1566 validate_eq(__func__, supported, TRUE);
1569 static void utc_location_location_manager_is_supported_method_n(void)
1571 bool supported = FALSE;
1572 supported = location_manager_is_supported_method(LOCATIONS_METHOD_NONE);
1573 validate_eq(__func__, supported, FALSE);
1576 static void utc_location_location_manager_is_supported_method_n_02(void)
1578 bool supported = FALSE;
1579 supported = location_manager_is_supported_method(LOCATIONS_METHOD_CPS + 1);
1580 validate_eq(__func__, supported, FALSE);
1583 static void utc_location_location_manager_send_command_p(void)
1586 int ret = LOCATIONS_ERROR_NONE;
1588 const *str = "command";
1589 ret = location_manager_send_command(str);
1590 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1593 static void utc_location_location_manager_send_command_n(void)
1595 int ret = LOCATIONS_ERROR_NONE;
1597 ret = location_manager_send_command(NULL);
1598 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1601 static void utc_location_location_manager_destroy_p(void)
1603 int ret = LOCATIONS_ERROR_NONE;
1604 ret = location_manager_destroy(manager);
1605 validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
1609 static void utc_location_location_manager_destroy_n(void)
1611 int ret = LOCATIONS_ERROR_NONE;
1613 ret = location_manager_destroy(NULL);
1614 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
1618 static void utc_location_location_manager_destroy_n_02(void)
1620 int ret = LOCATIONS_ERROR_NONE;
1622 location_manager_h manager_02;
1624 ret = location_manager_destroy(manager_02);
1625 validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);