diff options
author | Kibum Kim <kb0929.kim@samsung.com> | 2012-01-07 00:48:36 +0900 |
---|---|---|
committer | Kibum Kim <kb0929.kim@samsung.com> | 2012-01-07 00:48:36 +0900 |
commit | 898d84180c87e006fbea489673129b129756e2bd (patch) | |
tree | 6cf5d2bff7fb9dc725cf91a0bd16449b577676b5 /TC | |
parent | a1587a945a0ed4e72ad4fffd3de37ed6e6ccc2d6 (diff) | |
download | libslp-location-898d84180c87e006fbea489673129b129756e2bd.tar.gz libslp-location-898d84180c87e006fbea489673129b129756e2bd.tar.bz2 libslp-location-898d84180c87e006fbea489673129b129756e2bd.zip |
Git init
Diffstat (limited to 'TC')
35 files changed, 3097 insertions, 0 deletions
diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100644 index 0000000..7a7b2ae --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,14 @@ +export ARCH=target + +export TET_INSTALL_PATH=~/opensrc/tet3.7 # tetware root path +export TET_TARGET_PATH=$TET_INSTALL_PATH # tetware target path +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +set $(pwd) +export TET_SUITE_ROOT=$1 + +set $(date +%s) +FILE_NAME_EXTENSION=$1 diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100644 index 0000000..323bb38 --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,14 @@ +export ARCH=target + +export TET_INSTALL_PATH=/opt/home/root/TETware # path to mount +export TET_TARGET_PATH=$TET_INSTALL_PATH +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +set $(pwd) +export TET_SUITE_ROOT=$1 + +set $(date +%s) +FILE_NAME_EXTENSION=$1 diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..b6c54b9 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,17 @@ +. ./_export_env.sh # setting environment variables + +echo PATH=$PATH +echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo ARCH=$ARCH + +RESULT_DIR=results-$ARCH +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ # executing tcc, with clean option (-c) +tcc -b -j $JOURNAL_RESULT -p ./ # executing tcc to build test cases (-b) +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT # reporting the result diff --git a/TC/excute.sh b/TC/excute.sh new file mode 100755 index 0000000..2c6167e --- /dev/null +++ b/TC/excute.sh @@ -0,0 +1,16 @@ +. ./_export_target_env.sh # setting environment variables + +echo PATH=$PATH +echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo ARCH=$ARCH + +RESULT_DIR=results-$ARCH +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ # executing tcc, with –e option +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT # reporting the result diff --git a/TC/making_new_tet_scen.py b/TC/making_new_tet_scen.py new file mode 100755 index 0000000..6c5b845 --- /dev/null +++ b/TC/making_new_tet_scen.py @@ -0,0 +1,69 @@ +#!/usr/bin/python + +############################################# +# tet_scen auto generator +# +# ** argv[1] = TC root +############################################# + +import sys,string,os + + +write_file = open("tet_scen", 'w') + +# +# making new tet_scen +# +def making_tet_scen (filename): + #tmp_list = filename.strip().split('/') + n_filename = filename.replace(' ', '\\ ') + #print n_filename + #new_path = "/"+ sys.argv[1] +"/"+n_filename[2:-6] + new_path = "/"+n_filename[:-6] + #print new_path + file = open(filename, 'r') + lines = file.readlines() + for line in lines: + if len(line.strip()) > 1: + list = line.strip().split('/') + #print new_path + list[-1] + write_file.write("\t"+new_path+list[-1]+"\n") + +# +# usage() +# +def usage(): + print(" ") + print("./making_new_tet_scen.py tc_root") + print("Put the Test Case's root directory.") + print("Do not include '/' at the end") + print(" ") + +# +# main() +# +def main(): + if len(sys.argv) < 2: + usage() + sys.exit(0) + + os.system('find '+ sys.argv[1] +' -name "tslist" > tslist.txt') + + #write_file = open("tetscen", w) + write_file.write("# auto generated tet_scen\n") + write_file.write("all\n") + write_file.write("\t\"Starting Full Test Suite\"\n") + + for file in open("tslist.txt", 'r'): + #print file.strip() + making_tet_scen(file.strip()) + + write_file.write("\t\"Completed Full Test Suite\"\n") + write_file.write("# EOF\n") + write_file.close() + print(" ") + print("==============================") + print("New tet_scen file is made~~~~") + print("==============================") + print(" ") +main() diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100644 index 0000000..305a021 --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,29 @@ +# auto generated tet_scen +all + "Starting Full Test Suite" + /unit/utc_location_init + /unit/utc_location_new + /unit/utc_location_free + /unit/utc_location_start + /unit/utc_location_stop + /unit/utc_location_get_position + /unit/utc_location_get_velocity + /unit/utc_location_get_address + /unit/utc_location_get_address_from_position + /unit/utc_location_get_position_from_address + /unit/utc_location_get_position_from_freeformed_address + /unit/utc_signals_service_disabled + /unit/utc_signals_service_enabled + /unit/utc_signals_service_updated + /unit/utc_signals_zone_in + /unit/utc_signals_zone_out + /unit/utc_properties_method + /unit/utc_properties_boundary + /unit/utc_properties_last_position + /unit/stc_gps_position + /unit/stc_gps_velocity + /unit/stc_gps_satellite + /unit/stc_gps_nmea + /unit/stc_gps_zone + "Completed Full Test Suite" +# EOF diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL= make clean # clean tool +TET_CLEAN_FILE= Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/TC/unit/Makefile b/TC/unit/Makefile new file mode 100644 index 0000000..58743b6 --- /dev/null +++ b/TC/unit/Makefile @@ -0,0 +1,56 @@ +################################################### +# add your TestCase List Here +# +# e.g., +# TC1 = utc_frameworkName_apiName_func +# TC2 = utc_ApplicationLib_recurGetDayOfWeek_func +TC1 = stc_gps_position +TC2 = stc_gps_velocity +TC3 = stc_gps_satellite +TC4 = stc_gps_nmea +TC5 = stc_gps_zone +TC6 = utc_location_init +TC7 = utc_location_new +TC8 = utc_location_start +TC9 = utc_location_stop +TC10 = utc_location_free +TC11 = utc_location_get_position +TC12 = utc_location_get_velocity +TC13 = utc_properties_last_position +TC14 = utc_properties_method +TC16 = utc_properties_boundary +TC17 = utc_signals_service_disabled +TC18 = utc_signals_service_enabled +TC19 = utc_signals_service_updated +TC20 = utc_signals_zone_in +TC21 = utc_signals_zone_out +TC22 = utc_location_get_address +TC23 = utc_location_get_address_from_position +TC24 = utc_location_get_position_from_address +TC25 = utc_location_get_position_from_freeformed_address + +# +# add your Package Config Info Here +# +# e.g., +# PKGS=calendar +PKGS= location gconf-2.0 + +LDLIBS = `pkg-config --libs $(PKGS)` +LDLIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o +LDLIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s +LDLIBS +=-L$(TET_ROOT)/lib/tet3 -lapi_s + +CC = gcc +INCS = -I. `pkg-config --cflags $(PKGS)` +INCS += -I$(TET_ROOT)/inc/tet3 +CFLAGS = $(INCS) +CFLAGS += -Wall -D_TETWARE_MODE + +################################################### +# Modify here +# depending on the Test Case you want to build +# +# e.g., +# +TCLIST = $(TC1) $(TC2) $(TC3) $(TC4) $(TC5) $(TC6) $(TC7) $(TC8) $(TC9) $(TC10) $(TC11) $(TC12) $(TC13) $(TC14) $(TC16) $(TC17) $(TC18) $(TC19) $(TC20) $(TC21) $(TC22) $(TC23) $(TC24) $(TC25) diff --git a/TC/unit/stc_gps_nmea.c b/TC/unit/stc_gps_nmea.c new file mode 100644 index 0000000..1b0578e --- /dev/null +++ b/TC/unit/stc_gps_nmea.c @@ -0,0 +1,175 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_init(); +static void utc_location_new(); +static void utc_location_start(); +static void utc_get_method(); +static void utc_get_devname(); +static void utc_location_get_nmea(); +static void utc_location_svc_disabled(); +static void utc_location_free(); + + +struct tet_testlist tet_testlist[] = { + {utc_location_init,1}, + {utc_location_new,1}, + {utc_location_start,1}, + {utc_get_method,1}, + {utc_get_devname,1}, + {utc_location_get_nmea,1}, + {utc_location_svc_disabled,1}, + {utc_location_free,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + + +static void startup() +{ + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + tet_printf("\n TC End"); +} + +static void +utc_location_init() +{ + ret = location_init(); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_new() +{ + loc = location_new(LOCATION_METHOD_GPS); + if (loc) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_start() +{ + ret = location_start(loc); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_method() +{ + LocationMethod method; + g_object_get(loc, "method", &method, NULL); + if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_devname() +{ + char* devname = NULL; + g_object_get(loc, "dev-name", &devname, NULL); + if(devname){ + tet_result(TET_PASS); + g_free(devname); + } else tet_result(TET_FAIL); +} + +static void +_get_nmea (GObject *self, + guint _status, + gpointer userdata) +{ + char* nmea_data; + g_object_get(loc, "nmea", &nmea_data, NULL); + if (nmea_data) { + tet_result(TET_PASS); + g_free(nmea_data); + } else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_get_nmea() +{ + loop = g_main_loop_new (NULL, TRUE); + g_signal_connect (loc, "service-updated", G_CALLBACK(_get_nmea), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +_cb_disabled (GObject *self, + guint _status, + gpointer userdata) +{ + if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +gboolean +_stop_location() +{ + location_stop(loc); + return FALSE; +} + +static void +utc_location_svc_disabled() +{ + g_signal_connect (loc, "service-disabled", G_CALLBACK(_cb_disabled), loc); + g_timeout_add_seconds(1, _stop_location, NULL); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); + +} + +static void +utc_location_free() +{ + ret = location_free(loc); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/stc_gps_position.c b/TC/unit/stc_gps_position.c new file mode 100644 index 0000000..bb91dfe --- /dev/null +++ b/TC/unit/stc_gps_position.c @@ -0,0 +1,197 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_init(); +static void utc_location_new(); +static void utc_location_start(); +static void utc_get_method(); +static void utc_get_devname(); +static void utc_location_get_position(); +static void utc_location_svc_updated(); +static void utc_location_stop(); +static void utc_get_lastpostion(); +static void utc_location_free(); + + +struct tet_testlist tet_testlist[] = { + {utc_location_init,1}, + {utc_location_new,1}, + {utc_location_start,1}, + {utc_get_method,1}, + {utc_get_devname,1}, + {utc_location_get_position,1}, + {utc_location_svc_updated,1}, + {utc_location_stop,1}, + {utc_get_lastpostion,1}, + {utc_location_free,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + + +static void startup() +{ + tet_printf("\n TC startup"); + loop = g_main_loop_new (NULL, TRUE); +} + +static void cleanup() +{ + tet_printf("\n TC End"); +} + +static void +utc_location_init() +{ + ret = location_init(); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_new() +{ + loc = location_new(LOCATION_METHOD_GPS); + if (loc) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_start() +{ + ret = location_start(loc); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_method() +{ + LocationMethod method; + g_object_get(loc, "method", &method, NULL); + + if(LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_devname() +{ + char* devname = NULL; + g_object_get(loc, "dev-name", &devname, NULL); + + if (devname) { + tet_result(TET_PASS); + g_free(devname); + } else tet_result(TET_FAIL); +} + +static void +utc_get_lastpostion() +{ + LocationPosition *pos = NULL; + g_object_get(loc, "last-position", &pos, NULL); + + if (pos) { + tet_result(TET_PASS); + location_position_free (pos); + } else tet_result(TET_FAIL); +} + +static void +_get_position (GObject *self, + guint _status, + gpointer userdata) +{ + LocationAccuracy *acc = NULL; + LocationPosition *pos = NULL; + LocationObject *loc = (LocationObject*)userdata; + + ret = location_get_position (loc, &pos, &acc); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); + + g_main_loop_quit (loop); +} + +static void +utc_location_get_position() +{ + g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_position), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_location_stop() +{ + ret = location_stop(loc); + + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +_cb_updated (GObject *self, + guint type, + gpointer data, + gpointer accuracy, + gpointer userdata) +{ + if ( POSITION_UPDATED <= type && type <= REVERSEGEOCODE_UPDATED) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_svc_updated() +{ + g_signal_connect (loc, "service-updated", G_CALLBACK(_cb_updated), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_location_free() +{ + ret = location_free(loc); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/stc_gps_satellite.c b/TC/unit/stc_gps_satellite.c new file mode 100644 index 0000000..86c6240 --- /dev/null +++ b/TC/unit/stc_gps_satellite.c @@ -0,0 +1,175 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_init(); +static void utc_location_new(); +static void utc_location_start(); +static void utc_get_method(); +static void utc_get_devname(); +static void utc_location_get_satellite(); +static void utc_location_svc_disabled(); +static void utc_location_free(); + + +struct tet_testlist tet_testlist[] = { + {utc_location_init,1}, + {utc_location_new,1}, + {utc_location_start,1}, + {utc_get_method,1}, + {utc_get_devname,1}, + {utc_location_get_satellite,1}, + {utc_location_svc_disabled,1}, + {utc_location_free,1}, + {NULL,0}, +}; + + + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + tet_printf("\n TC End"); +} + +static void +utc_location_init() +{ + ret = location_init(); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_new() +{ + loc = location_new(LOCATION_METHOD_GPS); + if(loc) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_start() +{ + ret = location_start(loc); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_method() +{ + LocationMethod method; + g_object_get(loc, "method", &method, NULL); + if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_devname() +{ + char* devname = NULL; + g_object_get(loc, "dev-name", &devname, NULL); + if (devname) { + tet_result(TET_PASS); + g_free(devname); + } else tet_result(TET_FAIL); +} + +static void +_get_satellite (GObject *self, + guint _status, + gpointer userdata) +{ + LocationSatellite *sat = NULL; + g_object_get (loc, "satellite", &sat, NULL); + if (sat) { + tet_result(TET_PASS); + location_satellite_free (sat); + } else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_get_satellite() +{ + loop = g_main_loop_new (NULL, TRUE); + g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_satellite), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +_cb_disabled (GObject *self, + guint _status, + gpointer userdata) +{ + if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +gboolean +_stop_location() +{ + location_stop(loc); + return FALSE; +} + +static void +utc_location_svc_disabled() +{ + g_signal_connect (loc, "service-disabled", G_CALLBACK(_cb_disabled), loc); + g_timeout_add_seconds(1, _stop_location, NULL); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_location_free() +{ + ret = location_free(loc); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/stc_gps_velocity.c b/TC/unit/stc_gps_velocity.c new file mode 100644 index 0000000..0f175d9 --- /dev/null +++ b/TC/unit/stc_gps_velocity.c @@ -0,0 +1,186 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_init(); +static void utc_location_new(); +static void utc_location_start(); +static void utc_get_method(); +static void utc_get_devname(); +static void utc_location_get_velocity(); +static void utc_location_stop(); +static void utc_location_svc_updated(); +static void utc_location_free(); + +struct tet_testlist tet_testlist[] = { + {utc_location_init,1}, + {utc_location_new,1}, + {utc_location_start,1}, + {utc_get_method,1}, + {utc_get_devname,1}, + {utc_location_get_velocity,1}, + {utc_location_svc_updated,1}, + {utc_location_stop,1}, + {utc_location_free,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + tet_printf("\n TC End"); +} + +static void +utc_location_init() +{ + ret = location_init(); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_new() +{ + loc = location_new(LOCATION_METHOD_GPS); + if (loc) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_start() +{ + ret = location_start(loc); + + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_method() +{ + LocationMethod method; + g_object_get(loc, "method", &method, NULL); + + if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_devname() +{ + char* devname = NULL; + g_object_get(loc, "dev-name", &devname, NULL); + + if(devname){ + tet_result(TET_PASS); + g_free(devname); + } else tet_result(TET_FAIL); +} + +static void +_get_velocity (GObject *self, + guint _status, + gpointer userdata) +{ + LocationVelocity *vel = NULL; + LocationAccuracy *acc = NULL; + LocationObject *loc = (LocationObject*)userdata; + + ret = location_get_velocity (loc, &vel, &acc); + if (ret == LOCATION_ERROR_NONE) { + location_velocity_free (vel); + location_accuracy_free (acc); + tet_result(TET_PASS); + } + else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_get_velocity() +{ + loop = g_main_loop_new (NULL, TRUE); + + g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_velocity), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_location_stop() +{ + ret = location_stop(loc); + + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +_cb_updated (GObject *self, + guint type, + gpointer data, + gpointer accuracy, + gpointer userdata) +{ + if ( POSITION_UPDATED <= type && type <= REVERSEGEOCODE_UPDATED) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_svc_updated() +{ + g_signal_connect (loc, "service-updated", G_CALLBACK(_cb_updated), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_location_free() +{ + ret = location_free(loc); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/stc_gps_zone.c b/TC/unit/stc_gps_zone.c new file mode 100644 index 0000000..3cfbb85 --- /dev/null +++ b/TC/unit/stc_gps_zone.c @@ -0,0 +1,284 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_init(); +static void utc_location_new(); +static void utc_location_start(); +static void utc_get_method(); +static void utc_get_devname(); +static void utc_location_svc_enabled(); +static void utc_set_boundary_in_suwonHQ(); +static void utc_get_boundary_in_suwonHQ(); +static void utc_zone_in(); +static void utc_set_boundary_in_Santorini(); +static void utc_get_boundary_in_Santorini(); +static void utc_zone_out(); +static void utc_location_stop(); +static void utc_location_free(); + + +struct tet_testlist tet_testlist[] = { + {utc_location_init,1}, + {utc_location_new,1}, + {utc_location_start,1}, + {utc_get_method,1}, + {utc_get_devname,1}, + {utc_location_svc_enabled,1}, + {utc_set_boundary_in_suwonHQ,1}, + {utc_get_boundary_in_suwonHQ,1}, + {utc_zone_in,1}, + {utc_set_boundary_in_Santorini,1}, + {utc_get_boundary_in_Santorini,1}, + {utc_zone_out,1}, + {utc_location_stop,1}, + {utc_location_free,1}, + {NULL,0}, +}; + + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + tet_printf("\n TC startup"); + loop = g_main_loop_new (NULL, TRUE); +} + +static void cleanup() +{ + tet_printf("\n TC End"); +} + +static void +utc_location_init() +{ + ret = location_init(); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_new() +{ + loc = location_new(LOCATION_METHOD_GPS); + if(loc) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_start() +{ + ret = location_start(loc); + + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_method() +{ + LocationMethod method; + g_object_get(loc, "method", &method, NULL); + + if(LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_get_devname() +{ + char* devname = NULL; + g_object_get(loc, "dev-name", &devname, NULL); + + if(devname){ + tet_result(TET_PASS); + g_free(devname); + } else tet_result(TET_FAIL); +} + +static void +_cb_svc_enabled (GObject *self, + guint _status, + gpointer userdata) +{ + if(LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit(loop); +} + + +static void +utc_location_svc_enabled() +{ + g_signal_connect (loc, "service-enabled", G_CALLBACK(_cb_svc_enabled), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_set_boundary_in_suwonHQ() +{ + LocationPosition *rb = location_position_new(0, 37.253, 127.058, 0, LOCATION_STATUS_2D_FIX); + LocationPosition *lt = location_position_new(0, 37.261, 127.052, 0, LOCATION_STATUS_2D_FIX); + LocationBoundary *bound = location_boundary_new_for_rect(lt, rb); + location_position_free (rb); + location_position_free (lt); + g_object_set(loc, "boundary", bound, NULL); + if (loc) { + tet_result(TET_PASS); + location_boundary_free (bound); + } else tet_result(TET_FAIL); +} + +static void +utc_get_boundary_in_suwonHQ() +{ + LocationBoundary* bound = NULL; + + g_object_get(loc, "boundary", &bound, NULL); + if ( bound && + bound->type ==LOCATION_BOUNDARY_RECT && + bound->rect.right_bottom->latitude == 37.253 && + bound->rect.right_bottom->longitude == 127.058 && + bound->rect.left_top->latitude == 37.261 && + bound->rect.left_top->longitude == 127.052 ){ + tet_result(TET_PASS); + location_boundary_free (bound); + } + else + tet_result(TET_FAIL); +} + +static void +_cb_zone_in(LocationObject *self, + guint type, + gpointer position, + gpointer accuracy) +{ + LocationPosition *pos = (LocationPosition*) position; + if( (37.253 <= pos->latitude && pos->latitude <= 37.261) && + (127.052 <= pos->longitude && pos->longitude <= 127.058) ) { + tet_result(TET_PASS); // I am in Suwon HQ + } else tet_result(TET_FAIL); + + g_main_loop_quit(loop); +} + +static void +utc_zone_in() +{ + g_signal_connect (loc, "zone-in", G_CALLBACK(_cb_zone_in), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_set_boundary_in_Santorini() +{ + LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX); + LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX); + LocationBoundary* bound = location_boundary_new_for_rect(lt, rb); + location_position_free (rb); + location_position_free (lt); + g_object_set(loc, "boundary", bound, NULL); + + if (loc) { + tet_result(TET_PASS); + location_boundary_free (bound); + } else tet_result(TET_FAIL); +} + +static void +utc_get_boundary_in_Santorini() +{ + LocationBoundary* bound = NULL; + g_object_get(loc, "boundary", &bound, NULL); + + if ( bound && + bound->type ==LOCATION_BOUNDARY_RECT && + bound->rect.right_bottom->latitude == 36.395 && + bound->rect.right_bottom->longitude == 25.41 && + bound->rect.left_top->latitude == 36.413 && + bound->rect.left_top->longitude == 25.388 ){ + tet_result(TET_PASS); + location_boundary_free (bound); + } else tet_result(TET_FAIL); + +} + +static void +_cb_zone_out(LocationObject *self, + guint type, + gpointer position, + gpointer accuracy) +{ + LocationPosition *pos = (LocationPosition*) position; + + if( (37.253 <= pos->latitude && pos->latitude <= 37.261) && + (27.052 <= pos->longitude && pos->longitude <= 127.058) ) { + tet_result(TET_PASS); // I am in Suwon HQ + } else tet_result(TET_FAIL); + g_main_loop_quit(loop); +} + + +static void +utc_zone_out() +{ + g_signal_connect (loc, "zone-out", G_CALLBACK(_cb_zone_out), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_location_stop() +{ + ret = location_stop(loc); + + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_free() +{ + ret = location_free(loc); + if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/tslist b/TC/unit/tslist new file mode 100644 index 0000000..7d73612 --- /dev/null +++ b/TC/unit/tslist @@ -0,0 +1,24 @@ +stc_gps_nmea +stc_gps_position +stc_gps_satellite +stc_gps_velocity +stc_gps_zone +utc_location_free +utc_location_get_address +utc_location_get_address_from_position +utc_location_get_position_from_address +utc_location_get_position_from_freeformed_address +utc_location_get_position +utc_location_get_velocity +utc_location_init +utc_location_new +utc_location_start +utc_location_stop +utc_properties_boundary +utc_properties_last_position +utc_properties_method +utc_signals_service_disabled +utc_signals_service_enabled +utc_signals_service_updated +utc_signals_zone_in +utc_signals_zone_out diff --git a/TC/unit/utc_location_free.c b/TC/unit/utc_location_free.c new file mode 100644 index 0000000..e107106 --- /dev/null +++ b/TC/unit/utc_location_free.c @@ -0,0 +1,85 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_free_01(); +static void utc_location_free_02(); + +struct tet_testlist tet_testlist[] = { + {utc_location_free_01,1}, + {utc_location_free_02,2}, + {NULL,0}, +}; + +int ret; +LocationObject* loc; + +static void startup() +{ + ret = location_init(); + loc = location_new(LOCATION_METHOD_GPS); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + if(loc) + location_free(loc); + + tet_printf("\n TC End"); +} + +static void +utc_location_free_01() +{ + ret = location_free(loc); + + tet_printf("Returned value: %d", ret); + if(ret == LOCATION_ERROR_NONE){ + tet_result(TET_PASS); + loc = NULL; + } + else{ + tet_result(TET_FAIL); + } +} + +static void +utc_location_free_02() +{ + ret = location_free(NULL); + + tet_printf("Returned value: %d", ret); + if(ret == LOCATION_ERROR_PARAMETER){ + tet_result(TET_PASS); + } + else{ + tet_result(TET_FAIL); + } +} + diff --git a/TC/unit/utc_location_get_address.c b/TC/unit/utc_location_get_address.c new file mode 100644 index 0000000..3561da4 --- /dev/null +++ b/TC/unit/utc_location_get_address.c @@ -0,0 +1,133 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <gconf/gconf-client.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_get_address_01(); +static void utc_location_get_address_02(); +static void utc_location_get_address_03(); + +struct tet_testlist tet_testlist[] = { + {utc_location_get_address_01,1}, + {utc_location_get_address_02,2}, + {utc_location_get_address_03,3}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +LocationObject* loc = NULL; +int ret = LOCATION_ERROR_NONE; +int isNetStarted = 0; + +#define GCONF_PROXY_MODE "/system/proxy/mode" +#define GCONF_HTTP_PROXY_HOST "/system/http_proxy/host" +#define GCONF_HTTP_PROXY_PORT "/system/http_proxy/port" +#define ENV_HTTP_PROXY "http_proxy" + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + return FALSE; +} + +static gboolean +exit_loop_fail (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + + loop = g_main_loop_new(NULL,FALSE); + g_main_loop_run (loop); + + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +_get_address (GObject *self, + guint _status, + gpointer userdata) +{ + LocationAccuracy *acc = NULL; + LocationAddress *addr = NULL; + + ret = location_get_address(loc, &addr, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_NONE || + ret == LOCATION_ERROR_CONFIGURATION) { + location_address_free(addr); + location_accuracy_free(acc); + tet_result(TET_PASS); + } else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_get_address_01() +{ + g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_address), loc); + location_start(loc); + g_timeout_add_seconds(60, exit_loop_fail, NULL); + g_main_loop_run (loop); +} + + static void +utc_location_get_address_02() +{ + LocationAccuracy *acc = NULL; + LocationAddress *addr = NULL; + + ret = location_get_address(NULL, &addr, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + + static void +utc_location_get_address_03() +{ + LocationAccuracy *acc = NULL; + ret = location_get_address(loc, NULL, &acc); + tet_printf("Returned value: %d", ret); + if(ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_location_get_address_from_position.c b/TC/unit/utc_location_get_address_from_position.c new file mode 100644 index 0000000..fc52ece --- /dev/null +++ b/TC/unit/utc_location_get_address_from_position.c @@ -0,0 +1,133 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <gconf/gconf-client.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_get_address_from_position_01(); +static void utc_location_get_address_from_position_02(); +static void utc_location_get_address_from_position_03(); +static void utc_location_get_address_from_position_04(); + +struct tet_testlist tet_testlist[] = { + {utc_location_get_address_from_position_01,1}, + {utc_location_get_address_from_position_02,2}, + {utc_location_get_address_from_position_03,3}, + {utc_location_get_address_from_position_04,4}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +LocationObject* loc; +int ret; +int isNetStarted = 0; + +#define GCONF_PROXY_MODE "/system/proxy/mode" +#define GCONF_HTTP_PROXY_HOST "/system/http_proxy/host" +#define GCONF_HTTP_PROXY_PORT "/system/http_proxy/port" +#define ENV_HTTP_PROXY "http_proxy" + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + + loop = g_main_loop_new(NULL,FALSE); + g_main_loop_run (loop); + + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_free(loc); + tet_printf("\n TC End"); +} + +static void +utc_location_get_address_from_position_01() +{ + LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX); + LocationAccuracy *acc = NULL; + LocationAddress *addr = NULL; + ret = location_get_address_from_position(loc, pos, &addr, &acc); + location_position_free(pos); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_NONE || + ret == LOCATION_ERROR_CONFIGURATION) { + location_address_free(addr); + location_accuracy_free(acc); + tet_result(TET_PASS); + } else tet_result(TET_FAIL); +} + +static void +utc_location_get_address_from_position_02() +{ + LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX); + LocationAccuracy *acc = NULL; + LocationAddress *addr = NULL; + + ret = location_get_address_from_position(NULL, pos, &addr, &acc); + location_position_free(pos); + location_address_free(addr); + location_accuracy_free(acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + + static void +utc_location_get_address_from_position_03() +{ + LocationAccuracy *acc = NULL; + LocationAddress *addr = NULL; + ret = location_get_address_from_position(loc, NULL, &addr, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + + static void +utc_location_get_address_from_position_04() +{ + LocationAccuracy *acc = NULL; + LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX); + + ret = location_get_address_from_position(loc, pos, NULL, &acc); + location_position_free(pos); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_location_get_position.c b/TC/unit/utc_location_get_position.c new file mode 100644 index 0000000..3590fff --- /dev/null +++ b/TC/unit/utc_location_get_position.c @@ -0,0 +1,128 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_get_position_01(); +static void utc_location_get_position_02(); +static void utc_location_get_position_03(); +static void utc_location_get_position_04(); + +struct tet_testlist tet_testlist[] = { + {utc_location_get_position_01,1}, + {utc_location_get_position_02,2}, + {utc_location_get_position_03,3}, + {utc_location_get_position_04,4}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +_get_position (GObject *self, + guint _status, + gpointer userdata) +{ + LocationAccuracy *acc = NULL; + LocationPosition *pos = NULL; + LocationObject *loc = (LocationObject*)userdata; + + ret = location_get_position (loc, &pos, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_NONE) { + location_position_free (pos); + location_accuracy_free (acc); + tet_result(TET_PASS); + } else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_get_position_01() +{ + g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_position), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + +static void +utc_location_get_position_02() +{ + LocationAccuracy *acc = NULL; + LocationPosition *pos = NULL; + + ret = location_get_position (NULL, &pos, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_position_03() +{ + LocationAccuracy *acc = NULL; + ret = location_get_position (loc, NULL, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_position_04() +{ + LocationPosition *pos = NULL; + ret = location_get_position (loc, &pos, NULL); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_location_get_position_from_address.c b/TC/unit/utc_location_get_position_from_address.c new file mode 100644 index 0000000..558a7e3 --- /dev/null +++ b/TC/unit/utc_location_get_position_from_address.c @@ -0,0 +1,131 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <gconf/gconf-client.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_get_position_from_address_01(); +static void utc_location_get_position_from_address_02(); +static void utc_location_get_position_from_address_03(); +static void utc_location_get_position_from_address_04(); + +struct tet_testlist tet_testlist[] = { + {utc_location_get_position_from_address_01,1}, + {utc_location_get_position_from_address_02,2}, + {utc_location_get_position_from_address_03,3}, + {utc_location_get_position_from_address_04,4}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +LocationObject* loc; +int ret; +int isNetStarted = 0; + +#define GCONF_PROXY_MODE "/system/proxy/mode" +#define GCONF_HTTP_PROXY_HOST "/system/http_proxy/host" +#define GCONF_HTTP_PROXY_PORT "/system/http_proxy/port" +#define ENV_HTTP_PROXY "http_proxy" + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + + loop = g_main_loop_new(NULL,FALSE); + g_main_loop_run (loop); + + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_free(loc); + tet_printf("\n TC End"); +} + +static void +utc_location_get_position_from_address_01() +{ + LocationPosition *pos = NULL; + LocationAccuracy *acc = NULL; + LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113"); + ret = location_get_position_from_address (loc, addr, &pos, &acc); + location_address_free(addr); + tet_printf("Returned value: %d", ret); + if( (ret == LOCATION_ERROR_NONE && + 37.325276 <= pos->latitude && pos->latitude <= 37.345276 && + -121.900059 <= pos->longitude && pos->longitude<= -121.880059) || + ret == LOCATION_ERROR_CONFIGURATION ) { + location_position_free(pos); + location_accuracy_free(acc); + tet_result(TET_PASS); + } else tet_result(TET_FAIL); +} + +static void +utc_location_get_position_from_address_02() +{ + LocationPosition *pos = NULL; + LocationAccuracy *acc = NULL; + LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113"); + ret = location_get_position_from_address (NULL, addr, &pos, &acc); + location_address_free(addr); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_position_from_address_03() +{ + LocationPosition *pos = NULL; + LocationAccuracy *acc = NULL; + ret = location_get_position_from_address(loc, NULL, &pos, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_position_from_address_04() +{ + LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");; + LocationAccuracy *acc = NULL; + ret = location_get_position_from_address(loc, addr, NULL, &acc); + location_address_free (addr); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_location_get_position_from_freeformed_address.c b/TC/unit/utc_location_get_position_from_freeformed_address.c new file mode 100644 index 0000000..d33b750 --- /dev/null +++ b/TC/unit/utc_location_get_position_from_freeformed_address.c @@ -0,0 +1,135 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <gconf/gconf-client.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_get_position_from_freeformed_address_01(); +static void utc_location_get_position_from_freeformed_address_02(); +static void utc_location_get_position_from_freeformed_address_03(); +static void utc_location_get_position_from_freeformed_address_04(); + +struct tet_testlist tet_testlist[] = { + {utc_location_get_position_from_freeformed_address_01,1}, + {utc_location_get_position_from_freeformed_address_02,2}, + {utc_location_get_position_from_freeformed_address_03,3}, + {utc_location_get_position_from_freeformed_address_04,4}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +LocationObject* loc; +int ret; +int isNetStarted = 0; + +#define GCONF_PROXY_MODE "/system/proxy/mode" +#define GCONF_HTTP_PROXY_HOST "/system/http_proxy/host" +#define GCONF_HTTP_PROXY_PORT "/system/http_proxy/port" +#define ENV_HTTP_PROXY "http_proxy" + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + + loop = g_main_loop_new(NULL,FALSE); + g_main_loop_run (loop); + + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_free(loc); + tet_printf("\n TC End"); +} + +static void +utc_location_get_position_from_freeformed_address_01() +{ + LocationPosition *pos = NULL; + LocationAccuracy *acc = NULL; + char* addr_str = g_strdup("4 N 2nd Street 95113"); + ret = location_get_position_from_freeformed_address(loc, addr_str, &pos, &acc); + g_free(addr_str); + tet_printf("Returned value: %d", ret); + if( (ret == LOCATION_ERROR_NONE && + 37.325276 <= pos->latitude && pos->latitude <= 37.345276 && + -121.900059 <= pos->longitude && pos->longitude<= -121.880059) || + ret == LOCATION_ERROR_CONFIGURATION ) { + location_position_free (pos); + location_accuracy_free (acc); + tet_result(TET_PASS); + } + else + tet_result(TET_FAIL); + +} + +static void +utc_location_get_position_from_freeformed_address_02() +{ + LocationPosition *pos = NULL; + LocationAccuracy *acc = NULL; + char* addr_str = g_strdup("4 N 2nd Street 95113"); + ret = location_get_position_from_freeformed_address(NULL, addr_str, &pos, &acc); + g_free(addr_str); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_position_from_freeformed_address_03() +{ + LocationPosition *pos = NULL; + LocationAccuracy *acc = NULL; + ret = location_get_position_from_freeformed_address(loc, NULL, &pos, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_position_from_freeformed_address_04() +{ + LocationAccuracy *acc = NULL; + char* addr_str = g_strdup("4 N 2nd Street 95113"); + ret = location_get_position_from_freeformed_address(loc, addr_str, NULL, &acc); + g_free (addr_str); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + diff --git a/TC/unit/utc_location_get_velocity.c b/TC/unit/utc_location_get_velocity.c new file mode 100644 index 0000000..cd4c803 --- /dev/null +++ b/TC/unit/utc_location_get_velocity.c @@ -0,0 +1,128 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_get_velocity_01(); +static void utc_location_get_velocity_02(); +static void utc_location_get_velocity_03(); +static void utc_location_get_velocity_04(); + +struct tet_testlist tet_testlist[] = { + {utc_location_get_velocity_01,1}, + {utc_location_get_velocity_02,2}, + {utc_location_get_velocity_03,3}, + {utc_location_get_velocity_04,4}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + + +static void +_get_velocity (GObject *self, + guint _status, + gpointer userdata) +{ + LocationVelocity *vel = NULL; + LocationAccuracy *acc = NULL; + LocationObject *loc = (LocationObject*)userdata; + ret = location_get_velocity (loc, &vel, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_NONE) { + location_velocity_free (vel); + location_accuracy_free (acc); + tet_result(TET_PASS); + } else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_get_velocity_01() +{ + g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_velocity), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} + + +static void +utc_location_get_velocity_02() +{ + LocationVelocity *vel = NULL; + LocationAccuracy *acc = NULL; + ret = location_get_velocity (NULL, &vel, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_velocity_03() +{ + LocationAccuracy *acc = NULL; + ret = location_get_velocity (loc, NULL, &acc); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_get_velocity_04() +{ + LocationVelocity *vel = NULL; + ret = location_get_velocity (loc, &vel, NULL); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_location_init.c b/TC/unit/utc_location_init.c new file mode 100644 index 0000000..a0efe5a --- /dev/null +++ b/TC/unit/utc_location_init.c @@ -0,0 +1,55 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_init(); + +struct tet_testlist tet_testlist[] = { + {utc_location_init,1}, + {NULL,0}, +}; + +int ret; + +static void startup() +{ + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + tet_printf("\n TC End"); +} + +static void +utc_location_init() +{ + ret = location_init(); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_location_new.c b/TC/unit/utc_location_new.c new file mode 100644 index 0000000..ee33c6b --- /dev/null +++ b/TC/unit/utc_location_new.c @@ -0,0 +1,70 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_new_01(); +static void utc_location_new_02(); + +struct tet_testlist tet_testlist[] = { + {utc_location_new_01,1}, + {utc_location_new_02,1}, + {NULL,0}, +}; + +int ret; +LocationObject* loc; + +static void startup() +{ + ret = location_init(); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + if (loc) location_free(loc); + tet_printf("\n TC End"); +} + +static void +utc_location_new_01() +{ + loc = location_new(LOCATION_METHOD_GPS); + if (loc) tet_result(TET_PASS); + else tet_result(TET_FAIL); + location_free(loc); +} + +static void +utc_location_new_02() +{ + loc = location_new(-1); + if (!loc) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + diff --git a/TC/unit/utc_location_start.c b/TC/unit/utc_location_start.c new file mode 100644 index 0000000..a4bf54c --- /dev/null +++ b/TC/unit/utc_location_start.c @@ -0,0 +1,76 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_start_01(); +static void utc_location_start_02(); + +struct tet_testlist tet_testlist[] = { + {utc_location_start_01,1}, + {utc_location_start_02,2}, + {NULL,0}, +}; + +int ret; +LocationObject* loc; + +static void startup() +{ + ret = location_init(); + loc = location_new(LOCATION_METHOD_GPS); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + if( loc ) + location_free(loc); + tet_printf("\n TC End"); +} + +static void +utc_location_start_01() +{ + ret = location_start(loc); + + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); + location_stop(loc); +} + +static void +utc_location_start_02() +{ + ret = location_start(NULL); + + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + diff --git a/TC/unit/utc_location_stop.c b/TC/unit/utc_location_stop.c new file mode 100644 index 0000000..d879480 --- /dev/null +++ b/TC/unit/utc_location_stop.c @@ -0,0 +1,78 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_stop_01(); +static void utc_location_stop_02(); + +struct tet_testlist tet_testlist[] = { + {utc_location_stop_01,1}, + {utc_location_stop_02,2}, + {NULL,0}, +}; + +int ret; +LocationObject* loc; + +static void startup() +{ + ret = location_init(); + loc = location_new(LOCATION_METHOD_GPS); + ret = location_start(loc); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + if( loc ){ + location_stop(loc); + location_free(loc); + } + tet_printf("\n TC End"); +} + +static void +utc_location_stop_01() +{ + ret = location_stop(loc); + + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + +static void +utc_location_stop_02() +{ + location_start(loc); + ret = location_stop(NULL); + tet_printf("Returned value: %d", ret); + if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} + diff --git a/TC/unit/utc_properties_boundary.c b/TC/unit/utc_properties_boundary.c new file mode 100644 index 0000000..8cc0845 --- /dev/null +++ b/TC/unit/utc_properties_boundary.c @@ -0,0 +1,86 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_set_boundary_in_suwonHQ(); +static void utc_get_boundary_in_suwonHQ(); + +struct tet_testlist tet_testlist[] = { + {utc_set_boundary_in_suwonHQ,1}, + {utc_get_boundary_in_suwonHQ,2}, + {NULL,0}, +}; + +int ret; +LocationObject* loc; + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +utc_set_boundary_in_suwonHQ() +{ + LocationPosition *rb = location_position_new(0, 37.258, 127.056, 0, LOCATION_STATUS_2D_FIX); + LocationPosition *lt = location_position_new(0, 37.260, 127.054, 0, LOCATION_STATUS_2D_FIX); + LocationBoundary* bound = location_boundary_new_for_rect(lt, rb); + g_object_set(loc, "boundary", bound, NULL); + location_position_free (rb); + location_position_free (lt); + location_boundary_free(bound); + if (loc) { + tet_result(TET_PASS); + } else tet_result(TET_FAIL); +} + +static void +utc_get_boundary_in_suwonHQ() +{ + LocationBoundary* bound = NULL; + g_object_get(loc, "boundary", &bound, NULL); + if ( bound && + bound->type == LOCATION_BOUNDARY_RECT && + bound->rect.right_bottom->latitude == 37.258 && + bound->rect.right_bottom->longitude == 127.056 && + bound->rect.left_top->latitude == 37.260 && + bound->rect.left_top->longitude == 127.054 ){ + tet_result(TET_PASS); + location_boundary_free (bound); + } else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_properties_last_position.c b/TC/unit/utc_properties_last_position.c new file mode 100644 index 0000000..03c08cf --- /dev/null +++ b/TC/unit/utc_properties_last_position.c @@ -0,0 +1,87 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_get_lastpostion(); + +struct tet_testlist tet_testlist[] = { + {utc_get_lastpostion,1}, + {NULL,0}, +}; + + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +static gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +cb_updated (GObject *self, + guint type, + gpointer data, + gpointer accuracy, + gpointer userdata) +{ + LocationPosition *pos = NULL; + g_object_get(loc, "last-position", &pos, NULL); + if (pos) { + location_position_free (pos); + tet_result(TET_PASS); + } else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_get_lastpostion() +{ + g_signal_connect (loc, "service-updated", G_CALLBACK(cb_updated), loc); + g_timeout_add_seconds (60, exit_loop, NULL); + g_main_loop_run (loop); +} diff --git a/TC/unit/utc_properties_method.c b/TC/unit/utc_properties_method.c new file mode 100644 index 0000000..bdb3430 --- /dev/null +++ b/TC/unit/utc_properties_method.c @@ -0,0 +1,60 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_get_method(); + +struct tet_testlist tet_testlist[] = { + {utc_get_method,1}, + {NULL,0}, +}; + +int ret; +LocationObject* loc; + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_free(loc); + tet_printf("\n TC End"); +} + +static void +utc_get_method() +{ + LocationMethod method; + g_object_get(loc, "method", &method, NULL); + if (method == LOCATION_METHOD_GPS) tet_result(TET_PASS); + else tet_result(TET_FAIL); +} diff --git a/TC/unit/utc_signals_service_disabled.c b/TC/unit/utc_signals_service_disabled.c new file mode 100644 index 0000000..e8a44b1 --- /dev/null +++ b/TC/unit/utc_signals_service_disabled.c @@ -0,0 +1,91 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_svc_disabled(); + +struct tet_testlist tet_testlist[] = { + {utc_location_svc_disabled,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +cb_enabled (GObject *self, + guint _status, + gpointer userdata) +{ + location_stop(loc); +} + +static void +cb_disabled (GObject *self, + guint _status, + gpointer userdata) +{ + if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_svc_disabled() +{ + g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_enabled), loc); + g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_disabled), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); + +} diff --git a/TC/unit/utc_signals_service_enabled.c b/TC/unit/utc_signals_service_enabled.c new file mode 100644 index 0000000..02cea2a --- /dev/null +++ b/TC/unit/utc_signals_service_enabled.c @@ -0,0 +1,81 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_svc_enabled(); + +struct tet_testlist tet_testlist[] = { + {utc_location_svc_enabled,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +_cb_svc_enabled (GObject *self, + guint _status, + gpointer userdata) +{ + if (LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit(loop); +} + +static void +utc_location_svc_enabled() +{ + g_signal_connect (loc, "service-enabled", G_CALLBACK(_cb_svc_enabled), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} diff --git a/TC/unit/utc_signals_service_updated.c b/TC/unit/utc_signals_service_updated.c new file mode 100644 index 0000000..737fd11 --- /dev/null +++ b/TC/unit/utc_signals_service_updated.c @@ -0,0 +1,83 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_location_svc_updated(); + +struct tet_testlist tet_testlist[] = { + {utc_location_svc_updated,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +cb_updated (GObject *self, + guint type, + gpointer data, + gpointer accuracy, + gpointer userdata) +{ + if ( POSITION_UPDATED <= type && type <= REVERSEGEOCODE_UPDATED) tet_result(TET_PASS); + else tet_result(TET_FAIL); + g_main_loop_quit (loop); +} + +static void +utc_location_svc_updated() +{ + g_signal_connect (loc, "service-updated", G_CALLBACK(cb_updated), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} diff --git a/TC/unit/utc_signals_zone_in.c b/TC/unit/utc_signals_zone_in.c new file mode 100644 index 0000000..c0d42c9 --- /dev/null +++ b/TC/unit/utc_signals_zone_in.c @@ -0,0 +1,93 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_zone_in(); + +struct tet_testlist tet_testlist[] = { + {utc_zone_in,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + + LocationPosition *rb = location_position_new(0, 37.254, 127.057, 0, LOCATION_STATUS_2D_FIX); + LocationPosition *lt = location_position_new(0, 37.261, 127.050, 0, LOCATION_STATUS_2D_FIX); + LocationBoundary* bound = location_boundary_new_for_rect(lt, rb); + location_position_free (rb); + location_position_free (lt); + g_object_set(loc, "boundary", bound, NULL); + location_boundary_free (bound); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +cb_zone_in(LocationObject *self, + guint type, + gpointer position, + gpointer accuracy) +{ + LocationPosition *pos = (LocationPosition*) position; + + if( (37.255 <= pos->latitude && pos->latitude <= 37.265) && + (127.052 <= pos->longitude && pos->longitude <= 127.058)) tet_result(TET_PASS); // I am in Suwon HQ + else tet_result(TET_FAIL); + g_main_loop_quit(loop); +} + +static void +utc_zone_in() +{ + g_signal_connect (loc, "zone-in", G_CALLBACK(cb_zone_in), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} diff --git a/TC/unit/utc_signals_zone_out.c b/TC/unit/utc_signals_zone_out.c new file mode 100644 index 0000000..5070a66 --- /dev/null +++ b/TC/unit/utc_signals_zone_out.c @@ -0,0 +1,93 @@ +/* + * libslp-location + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, + * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include <tet_api.h> +#include <glib.h> +#include <location.h> + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_zone_out(); + +struct tet_testlist tet_testlist[] = { + {utc_zone_out,1}, + {NULL,0}, +}; + +static GMainLoop *loop = NULL; +int ret; +LocationObject* loc; + +gboolean +exit_loop (gpointer data) +{ + g_main_loop_quit (loop); + tet_result(TET_FAIL); + return FALSE; +} + +static void startup() +{ + location_init(); + loc = location_new(LOCATION_METHOD_GPS); + location_start(loc); + loop = g_main_loop_new(NULL,FALSE); + + LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX); + LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX); + LocationBoundary* bound = location_boundary_new_for_rect(lt, rb); + location_position_free (rb); + location_position_free (lt); + g_object_set(loc, "boundary", bound, NULL); + location_boundary_free (bound); + tet_printf("\n TC startup"); +} + +static void cleanup() +{ + location_stop(loc); + location_free(loc); + tet_printf("\n TC End"); +} + +static void +_cb_zone_out(LocationObject *self, + guint type, + gpointer position, + gpointer accuracy) +{ + LocationPosition *pos = (LocationPosition*) position; + + if( (37.255 <= pos->latitude && pos->latitude <= 37.265) && + (27.052 <= pos->longitude && pos->longitude <= 127.060) ) tet_result(TET_PASS); // I am in Suwon HQ + else tet_result(TET_FAIL); + g_main_loop_quit(loop); +} + + +static void +utc_zone_out() +{ + g_signal_connect (loc, "zone-out", G_CALLBACK(_cb_zone_out), loc); + g_timeout_add_seconds(60, exit_loop, NULL); + g_main_loop_run (loop); +} |