[UTC][capi-appfw-alarm][Non-ACR][Fix notification alarm tc]
authorJiwoong Im <jiwoong.im@samsung.com>
Wed, 7 Dec 2016 00:30:11 +0000 (09:30 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Thu, 8 Dec 2016 01:48:39 +0000 (17:48 -0800)
Change-Id: I90d14e4aec9ca8471f385b4616b2948f4c14ba02
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
src/utc/alarm/utc_alarm.c

index 452ba30058788cf8d1a550fc654005266ecd6249..9e791ebbc31ef0ba9e2866c77ff8ada5b3fe80a2 100755 (executable)
@@ -1415,6 +1415,21 @@ int utc_alarm_get_global_n(void)
        return 0;
 }
 
+static gboolean _noti_check(gpointer data)
+{
+       notification_h noti;
+
+       noti = notification_load_by_tag("alarm-utc");
+       alarm_cancel_all();
+       assert_neq_with_exit(noti, NULL);
+
+       notification_delete(noti);
+       notification_free(noti);
+       normal_exit(0);
+
+       return FALSE;
+}
+
 /**
  * @testcase           utc_alarm_schedule_noti_once_at_date_p
  * @since_tizen        3.0
@@ -1434,7 +1449,7 @@ int utc_alarm_schedule_noti_once_at_date_p(void)
        int ret = ALARM_ERROR_NONE;
 
        time(&now);
-       now += 20;
+       now += 5;
        localtime_r(&now, &date);
 
        noti = notification_create(NOTIFICATION_TYPE_NOTI);
@@ -1443,13 +1458,21 @@ int utc_alarm_schedule_noti_once_at_date_p(void)
                        "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
        assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
 
+       ret = notification_set_display_applist(noti,
+                       NOTIFICATION_DISPLAY_APP_INDICATOR |
+                       NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
+                       NOTIFICATION_DISPLAY_APP_TICKER);
+       assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
+
+       ret = notification_set_tag(noti, "alarm-utc");
+       assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
+
        ret = alarm_schedule_noti_once_at_date(noti, &date, &tid);
+       assert_eq_with_exit(ret, ALARM_ERROR_NONE);
 
        notification_free(noti);
-       alarm_cancel_all();
 
-       assert_eq_with_exit(ret, ALARM_ERROR_NONE);
-       normal_exit(0);
+       g_timeout_add_seconds(10, _noti_check, &noti);
 
        return 0;
 }
@@ -1603,7 +1626,7 @@ int utc_alarm_schedule_noti_after_delay_n2(void)
        int delay = 1;
        int period = 1;
 
-       ret = alarm_schedule_after_delay(NULL, delay, period, &tid);
+       ret = alarm_schedule_noti_after_delay(NULL, delay, period, &tid);
 
        alarm_cancel_all();
 
@@ -1625,7 +1648,7 @@ int utc_alarm_schedule_noti_once_after_delay_p(void)
 {
        int tid;
        int ret = ALARM_ERROR_NONE;
-       int delay = 1;
+       int delay = 5;
        notification_h noti;
 
        noti = notification_create(NOTIFICATION_TYPE_NOTI);
@@ -1634,13 +1657,21 @@ int utc_alarm_schedule_noti_once_after_delay_p(void)
                        "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
        assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
 
+       ret = notification_set_display_applist(noti,
+                       NOTIFICATION_DISPLAY_APP_INDICATOR |
+                       NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
+                       NOTIFICATION_DISPLAY_APP_TICKER);
+       assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
+
+       ret = notification_set_tag(noti, "alarm-utc");
+       assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
+
        ret = alarm_schedule_noti_once_after_delay(noti, delay, &tid);
+       assert_eq_with_exit(ret, ALARM_ERROR_NONE);
 
        notification_free(noti);
-       alarm_cancel_all();
 
-       assert_eq_with_exit(ret, ALARM_ERROR_NONE);
-       normal_exit(0);
+       g_timeout_add_seconds(10, _noti_check, &noti);
 
        return 0;
 }
@@ -1717,23 +1748,39 @@ int utc_alarm_schedule_noti_with_recurrence_week_flag_p(void)
        int ret = ALARM_ERROR_NONE;
        notification_h noti;
 
+       time(&now);
+       now += 5;
+       localtime_r(&now, &date);
+
        noti = notification_create(NOTIFICATION_TYPE_NOTI);
 
        ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
                        "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
        assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
 
-       time(&now);
-       localtime_r(&now, &date);
-       date.tm_sec += 3;
+       ret = notification_set_display_applist(noti,
+                       NOTIFICATION_DISPLAY_APP_INDICATOR |
+                       NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
+                       NOTIFICATION_DISPLAY_APP_TICKER);
+       assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
+
+       ret = notification_set_tag(noti, "alarm-utc");
+       assert_eq_with_exit(ret, NOTIFICATION_ERROR_NONE);
 
-       ret = alarm_schedule_noti_with_recurrence_week_flag(noti, &date, ALARM_WEEK_FLAG_MONDAY, &tid);
+       ret = alarm_schedule_noti_with_recurrence_week_flag(noti, &date,
+                       ALARM_WEEK_FLAG_SUNDAY |
+                       ALARM_WEEK_FLAG_MONDAY |
+                       ALARM_WEEK_FLAG_TUESDAY |
+                       ALARM_WEEK_FLAG_WEDNESDAY |
+                       ALARM_WEEK_FLAG_THURSDAY |
+                       ALARM_WEEK_FLAG_FRIDAY |
+                       ALARM_WEEK_FLAG_SATURDAY
+                       , &tid);
+       assert_eq_with_exit(ret, ALARM_ERROR_NONE);
 
        notification_free(noti);
-       alarm_cancel_all();
 
-       assert_eq_with_exit(ret, ALARM_ERROR_NONE);
-       normal_exit(0);
+       g_timeout_add_seconds(10, _noti_check, &noti);
 
        return 0;
 }