From: Inkyun Kil Date: Fri, 21 Jun 2019 05:59:02 +0000 (+0900) Subject: [UTC][capi-appfw-alarm][non-ACR][improves alarm TC] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac5ab578d6209ae9a273110b0ef8f3422f89cd8d;p=test%2Ftct%2Fnative%2Fapi.git [UTC][capi-appfw-alarm][non-ACR][improves alarm TC] Change-Id: I35b53507b9befaf9109ccf3f5bbc9c9f9b3bf0f0 Signed-off-by: Inkyun Kil --- diff --git a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-aarch64.tpk b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-aarch64.tpk index d2100493c..9bfd01be4 100755 Binary files a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-aarch64.tpk and b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-aarch64.tpk differ diff --git a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-arm.tpk b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-arm.tpk index 502b22314..ebad781c2 100755 Binary files a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-arm.tpk and b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-arm.tpk differ diff --git a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-i386.tpk b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-i386.tpk index 8569cb7ce..f832939eb 100755 Binary files a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-i386.tpk and b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-i386.tpk differ diff --git a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-x86_64.tpk b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-x86_64.tpk index cef7ec04b..8282d7ec7 100755 Binary files a/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-x86_64.tpk and b/src/utc/alarm/res/mobile/org.tizen.helloworld-1.0.0-x86_64.tpk differ diff --git a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-aarch64.tpk b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-aarch64.tpk index d2100493c..9bfd01be4 100755 Binary files a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-aarch64.tpk and b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-aarch64.tpk differ diff --git a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-arm.tpk b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-arm.tpk index 502b22314..ebad781c2 100755 Binary files a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-arm.tpk and b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-arm.tpk differ diff --git a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-i386.tpk b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-i386.tpk index 8569cb7ce..f832939eb 100755 Binary files a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-i386.tpk and b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-i386.tpk differ diff --git a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-x86_64.tpk b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-x86_64.tpk index cef7ec04b..8282d7ec7 100755 Binary files a/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-x86_64.tpk and b/src/utc/alarm/res/tizeniot/org.tizen.helloworld-1.0.0-x86_64.tpk differ diff --git a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-aarch64.tpk b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-aarch64.tpk index d2100493c..9bfd01be4 100755 Binary files a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-aarch64.tpk and b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-aarch64.tpk differ diff --git a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-arm.tpk b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-arm.tpk index 502b22314..ebad781c2 100755 Binary files a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-arm.tpk and b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-arm.tpk differ diff --git a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-i386.tpk b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-i386.tpk index 8569cb7ce..f832939eb 100755 Binary files a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-i386.tpk and b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-i386.tpk differ diff --git a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-x86_64.tpk b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-x86_64.tpk index cef7ec04b..8282d7ec7 100755 Binary files a/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-x86_64.tpk and b/src/utc/alarm/res/tv/org.tizen.helloworld-1.0.0-x86_64.tpk differ diff --git a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-aarch64.tpk b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-aarch64.tpk index d2100493c..9bfd01be4 100755 Binary files a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-aarch64.tpk and b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-aarch64.tpk differ diff --git a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-arm.tpk b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-arm.tpk index 502b22314..ebad781c2 100755 Binary files a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-arm.tpk and b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-arm.tpk differ diff --git a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-i386.tpk b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-i386.tpk index 8569cb7ce..f832939eb 100755 Binary files a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-i386.tpk and b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-i386.tpk differ diff --git a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-x86_64.tpk b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-x86_64.tpk index cef7ec04b..8282d7ec7 100755 Binary files a/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-x86_64.tpk and b/src/utc/alarm/res/wearable/org.tizen.helloworld-1.0.0-x86_64.tpk differ diff --git a/src/utc/alarm/utc_alarm.c b/src/utc/alarm/utc_alarm.c index 64efb35b4..3f991a32e 100755 --- a/src/utc/alarm/utc_alarm.c +++ b/src/utc/alarm/utc_alarm.c @@ -92,6 +92,33 @@ static bool foreach_alarm_cb(int alarm, void *user_data) return true; } +static gboolean __alarm_check(gpointer data) +{ + app_control_h app_control = (app_control_h)data; + int ret; + bool is_running = false; + const char *app_id = "org.tizen.helloworld"; + + ret = app_manager_is_running(app_id, &is_running); + assert_eq_with_exit(ret, APP_MANAGER_ERROR_NONE); + + if (is_running) { + ret = app_control_add_extra_data(app_control, "ALARM_UTC", "TERM"); + assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); + + ret = app_control_send_launch_request(app_control, NULL, NULL); + assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); + + normal_exit(0); + } else { + normal_exit(1); + } + + app_control_destroy(app_control); + alarm_cancel_all(); + return true; +} + /** * @testcase utc_alarm_schedule_after_delay_p * @since_tizen 2.3 @@ -331,7 +358,7 @@ int utc_alarm_schedule_once_after_delay_p(void) app_control_h app_control; int tid; int ret = ALARM_ERROR_NONE; - int delay = 1; + int delay = 5; const char *app_id = "org.tizen.helloworld"; ret = app_control_create(&app_control); @@ -344,12 +371,9 @@ int utc_alarm_schedule_once_after_delay_p(void) assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); ret = alarm_schedule_once_after_delay(app_control, delay, &tid); - - app_control_destroy(app_control); - alarm_cancel_all(); - assert_eq_with_exit(ret, ALARM_ERROR_NONE); - normal_exit(0); + + g_timeout_add_seconds(10, __alarm_check, app_control); return 0; } @@ -441,7 +465,8 @@ int utc_alarm_cancel_p(void) int ret2 = ALARM_ERROR_NONE; int tid; int delay = 1; - int period = 1; + int period = 5; + bool is_running = false; const char *app_id = "org.tizen.helloworld"; ret = app_control_create(&app_control); @@ -456,6 +481,12 @@ int utc_alarm_cancel_p(void) ret1 = alarm_schedule_after_delay(app_control, delay, period, &tid); ret2 = alarm_cancel(tid); + sleep(10); + + ret = app_manager_is_running(app_id, &is_running); + assert_eq_with_exit(ret, APP_MANAGER_ERROR_NONE); + assert_eq_with_exit(is_running, false); + app_control_destroy(app_control); alarm_cancel_all(); @@ -578,13 +609,18 @@ int utc_alarm_foreach_registered_alarm_n(void) int utc_alarm_get_scheduled_date_p(void) { struct tm date; + struct tm get_date; app_control_h app_control; int ret = ALARM_ERROR_NONE; int tid; - int delay = 1; - int period = 5; + time_t now; const char *app_id = "org.tizen.helloworld"; + time(&now); + now += 20; + tzset(); + localtime_r(&now, &date); + ret = app_control_create(&app_control); assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); @@ -594,14 +630,17 @@ int utc_alarm_get_scheduled_date_p(void) ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); - alarm_schedule_after_delay(app_control, delay, period, &tid); + ret = alarm_schedule_once_at_date(app_control, &date, &tid); + assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); + + ret = alarm_get_scheduled_date(tid, &get_date); + assert_eq_with_exit(ret, ALARM_ERROR_NONE); - ret = alarm_get_scheduled_date(tid, &date); + assert_eq_with_exit(date.tm_sec, get_date.tm_sec); app_control_destroy(app_control); alarm_cancel_all(); - assert_eq_with_exit(ret, ALARM_ERROR_NONE); normal_exit(0); return 0; @@ -707,11 +746,10 @@ int utc_alarm_schedule_once_at_date_p(void) app_control_h app_control; int tid; const char *app_id = "org.tizen.helloworld"; - int ret = ALARM_ERROR_NONE; time(&now); - now += 20; + now += 5; tzset(); localtime_r(&now, &date); @@ -726,11 +764,7 @@ int utc_alarm_schedule_once_at_date_p(void) ret = alarm_schedule_once_at_date(app_control, &date, &tid); - app_control_destroy(app_control); - alarm_cancel_all(); - - assert_eq_with_exit(ret, ALARM_ERROR_NONE); - normal_exit(0); + g_timeout_add_seconds(10, __alarm_check, app_control); return 0; } @@ -876,7 +910,7 @@ int utc_alarm_schedule_with_recurrence_week_flag_p(void) time(&now); tzset(); localtime_r(&now, &date); - date.tm_sec += 3; + date.tm_sec += 5; ret = app_control_create(&app_control); assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); @@ -887,13 +921,13 @@ int utc_alarm_schedule_with_recurrence_week_flag_p(void) ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE); - ret = alarm_schedule_with_recurrence_week_flag(app_control, &date, ALARM_WEEK_FLAG_MONDAY, &tid); - - app_control_destroy(app_control); - alarm_cancel_all(); + ret = alarm_schedule_with_recurrence_week_flag(app_control, &date, + ALARM_WEEK_FLAG_MONDAY | ALARM_WEEK_FLAG_TUESDAY | + ALARM_WEEK_FLAG_WEDNESDAY | ALARM_WEEK_FLAG_THURSDAY | + ALARM_WEEK_FLAG_FRIDAY | ALARM_WEEK_FLAG_SATURDAY | + ALARM_WEEK_FLAG_SUNDAY, &tid); - assert_eq_with_exit(ret, ALARM_ERROR_NONE); - normal_exit(0); + g_timeout_add_seconds(10, __alarm_check, app_control); return 0; } @@ -1950,8 +1984,6 @@ int utc_alarm_update_delay_p(void) app_control_h app_control; int alarm_id; int ret = ALARM_ERROR_NONE; - int delay = 1; - int period = 1; const char *app_id = "org.tizen.helloworld"; ret = app_control_create(&app_control);