4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
7 * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@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 #include <sys/types.h>
31 static void startup(void);
32 static void cleanup(void);
34 void (*tet_startup)(void) = startup;
35 void (*tet_cleanup)(void) = cleanup;
37 static void utc_ApplicationFW_alarmmgr_add_alarm_with_localtime_func_01(void);
38 static void utc_ApplicationFW_alarmmgr_add_alarm_with_localtime_func_02(void);
41 POSITIVE_TC_IDX = 0x01,
45 struct tet_testlist tet_testlist[] = {
46 { utc_ApplicationFW_alarmmgr_add_alarm_with_localtime_func_01, POSITIVE_TC_IDX },
47 { utc_ApplicationFW_alarmmgr_add_alarm_with_localtime_func_02, NEGATIVE_TC_IDX },
53 static void startup(void)
57 static void cleanup(void)
62 * @brief Positive test case of alarmmgr_add_alarm_with_localtime()
64 static void utc_ApplicationFW_alarmmgr_add_alarm_with_localtime_func_01(void)
66 int ret_val = ALARMMGR_RESULT_SUCCESS;
68 const char* destination = NULL;
73 alarm_date_t test_time;
75 const char* pkg_name = "com.samsung.test";
79 ret_val =alarmmgr_init(pkg_name) ;
80 if(ret_val != ALARMMGR_RESULT_SUCCESS)
82 tet_infoline("\nAlarm Manager : call to alarmmgr_init () failed \n");
89 printf("current time: %s\n", ctime(¤t_time));
90 localtime_r(¤t_time, ¤t_tm);
92 alarm = alarmmgr_create_alarm();
98 test_time.hour = current_tm.tm_hour;
99 test_time.min = current_tm.tm_min+1;
103 alarmmgr_set_time(alarm,test_time);
104 alarmmgr_set_repeat_mode(alarm,ALARM_REPEAT_MODE_WEEKLY, ALARM_WDAY_MONDAY);
105 alarmmgr_set_type(alarm,ALARM_TYPE_VOLATILE);
108 ret_val=alarmmgr_add_alarm_with_localtime(alarm,destination,&alarm_id);
110 if(ret_val == ALARMMGR_RESULT_SUCCESS)
112 tet_infoline("\nAlarm Manager : call to alarmmgr_add_alarm_with_localtime() is successful \n");
113 tet_result(TET_PASS);
117 tet_infoline("\nAlarm Manager : call to alarmmgr_add_alarm_with_localtime() failed \n");
118 tet_result(TET_FAIL);
120 alarmmgr_free_alarm( alarm) ;
124 * @brief Negative test case of ug_init alarmmgr_add_alarm_with_localtime()
126 static void utc_ApplicationFW_alarmmgr_add_alarm_with_localtime_func_02(void)
128 int ret_val = ALARMMGR_RESULT_SUCCESS;
129 alarm_entry_t* alarm = NULL;
130 const char* destination = NULL;
131 alarm_id_t* alarm_id = NULL;
133 const char* pkg_name = "com.samsung.test";
137 ret_val =alarmmgr_init(pkg_name) ;
138 if(ret_val != ALARMMGR_RESULT_SUCCESS)
140 tet_infoline("\nAlarm Manager : call to alarmmgr_init () failed \n");
141 tet_result(TET_FAIL);
145 ret_val = alarmmgr_add_alarm_with_localtime(alarm, destination, alarm_id);
146 if(ret_val == ERR_ALARM_INVALID_PARAM)
148 tet_infoline("\nAlarm Manager : call to alarmmgr_add_alarm_with_localtime() with invalid parameter is successful \n");
149 tet_result(TET_PASS);
153 tet_infoline("\nAlarm Manager : call to alarmmgr_add_alarm_with_localtime() failed \n");
154 tet_result(TET_FAIL);