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_init();
31 static void utc_location_new();
32 static void utc_location_start();
33 static void utc_get_method();
34 static void utc_get_devname();
35 static void utc_location_get_position();
36 static void utc_location_svc_updated();
37 static void utc_location_stop();
38 static void utc_get_lastpostion();
39 static void utc_location_free();
42 struct tet_testlist tet_testlist[] = {
43 {utc_location_init,1},
45 {utc_location_start,1},
48 {utc_location_get_position,1},
49 {utc_location_svc_updated,1},
50 {utc_location_stop,1},
51 {utc_get_lastpostion,1},
52 {utc_location_free,1},
56 static GMainLoop *loop = NULL;
61 exit_loop (gpointer data)
63 g_main_loop_quit (loop);
71 tet_printf("\n TC startup");
72 loop = g_main_loop_new (NULL, TRUE);
77 tet_printf("\n TC End");
83 ret = location_init();
84 if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
85 else tet_result(TET_FAIL);
91 loc = location_new(LOCATION_METHOD_GPS);
92 if (loc) tet_result(TET_PASS);
93 else tet_result(TET_FAIL);
99 ret = location_start(loc);
100 if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
101 else tet_result(TET_FAIL);
107 LocationMethod method;
108 g_object_get(loc, "method", &method, NULL);
110 if(LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
111 else tet_result(TET_FAIL);
117 char* devname = NULL;
118 g_object_get(loc, "dev-name", &devname, NULL);
121 tet_result(TET_PASS);
123 } else tet_result(TET_FAIL);
127 utc_get_lastpostion()
129 LocationPosition *pos = NULL;
130 g_object_get(loc, "last-position", &pos, NULL);
133 tet_result(TET_PASS);
134 location_position_free (pos);
135 } else tet_result(TET_FAIL);
139 _get_position (GObject *self,
143 LocationAccuracy *acc = NULL;
144 LocationPosition *pos = NULL;
145 LocationObject *loc = (LocationObject*)userdata;
147 ret = location_get_position (loc, &pos, &acc);
148 if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
149 else tet_result(TET_FAIL);
151 g_main_loop_quit (loop);
155 utc_location_get_position()
157 g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_position), loc);
158 g_timeout_add_seconds(60, exit_loop, NULL);
159 g_main_loop_run (loop);
165 ret = location_stop(loc);
167 if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
168 else tet_result(TET_FAIL);
172 _cb_updated (GObject *self,
178 if ( POSITION_UPDATED <= type && type <= REVERSEGEOCODE_UPDATED) tet_result(TET_PASS);
179 else tet_result(TET_FAIL);
180 g_main_loop_quit (loop);
184 utc_location_svc_updated()
186 g_signal_connect (loc, "service-updated", G_CALLBACK(_cb_updated), loc);
187 g_timeout_add_seconds(60, exit_loop, NULL);
188 g_main_loop_run (loop);
194 ret = location_free(loc);
195 if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
196 else tet_result(TET_FAIL);