[Notification] Added missing values casting 50/81750/1
authorPiotr Kosko <p.kosko@samsung.com>
Thu, 28 Jul 2016 06:44:47 +0000 (08:44 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Thu, 28 Jul 2016 07:03:51 +0000 (09:03 +0200)
[Bug] Native API expects range of 0-1, but webapi spec defines it with 0-100,
  additional values casting was needed.

[Verification] TCT passrate is 100%.
  Code below generates notification with "12%" progress bar:
tizen.notification.post(
    new tizen.StatusNotification(
        "PROGRESS",
        "Progress Notification",
        {
            content:"Progress",
            progressValue : 12 ,
            progressType : "PERCENTAGE"
        }
    )
);

Change-Id: Ib8b5ed9bbc8235071591e93f4dc19b1fa450b557
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/notification/status_notification.cc

index 894b43270054abb00cc49eb0968cb270b5395c53..9b03933a7444a56027960668c72b7cde9d5f1fb1 100644 (file)
@@ -856,6 +856,8 @@ PlatformResult StatusNotification::GetProgressValue(
       return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
                             "Get notification progress error");
     }
+    // native api uses range 0-1, but webapi expects 0-100, so we need to multiply result with 100
+    tmp_progress_value *= 100;
   } else {
     return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
                           "Unknown notification progress type",
@@ -884,7 +886,8 @@ PlatformResult StatusNotification::SetProgressValue(
           progress_value);
     }
   } else if (progress_type == kProgressTypePercentage) {
-    ret = notification_set_progress(noti_handle, progress_value);
+    // native api uses range 0-1, but webapi expects 0-100, so we need to divide by 100
+    ret = notification_set_progress(noti_handle, progress_value/100);
 
     if (is_update) {
       ret = notification_update_progress(noti_handle, NOTIFICATION_PRIV_ID_NONE,