[headed][time] fix icu related string issue in riscv64 76/311576/2
authorchen <chen89.chen@samsung.com>
Thu, 23 May 2024 03:02:43 +0000 (11:02 +0800)
committerchen chen <chen89.chen@samsung.com>
Wed, 22 May 2024 11:03:18 +0000 (11:03 +0000)
Change-Id: Ibb21f48120943dc1c4c5f38df15653d08c718e22
Signed-off-by: chen <chen89.chen@samsung.com>
common/tct-time-tizen-tests/time/TZDate_toLocaleString_for_specific_date.html
common/tct-time-tizen-tests/time/TZDate_toString_for_specific_date.html
common/tct-time-tizen-tests/time/TZDate_toTimeString_for_specific_date.html
common/tct-time-tizen-tests/time/TimeUtil_getTimeFormat.html
common/tct-time-tizen-tests/time/support/time_common.js

index db93c9febc7068633c241c35b47bc47ef5f47b68..3955563867fe0a7f64a34e8b61df4c5ca0a8355d 100755 (executable)
@@ -40,7 +40,12 @@ Authors:
 //==== PRIORITY P1
 //==== TEST_CRITERIA MNA MR
 test(function () {
-    assert_equals(date.toLocaleString(), "Friday, November 11, 2011 at 4:55:54 AM", this.name);
+    icu_ver = getLibicuVersion();
+    if(icu_ver < NEWVERSION_ICU) {
+        assert_equals(date.toLocaleString(), "Friday, November 11, 2011, 4:55:54 AM", this.name);
+    } else {
+        assert_equals(date.toLocaleString(), "Friday, November 11, 2011 at 4:55:54 AM", this.name);
+    }
 }, document.title);
 
 </script>
index 85b1d6b9f12dd56d3e76ce8b93379e4c4a4c33dd..6fd63fd5f15b28477c08db9e0c5439ff94828eaa 100755 (executable)
@@ -36,7 +36,12 @@ Authors:
 //==== TEST_CRITERIA MNA MR
 
 test(function () {
-    assert_regexp_match(date.toString(), /Friday, November 11, 2011 at 4:55:54 AM GMT\+0900 South Korea Time/, this.name);
+    icu_ver = getLibicuVersion();
+    if(icu_ver < NEWVERSION_ICU) {
+        assert_regexp_match(date.toTimeString(), /0?4:55:54( AM)? GMT\+0900 South Korea Time/, this.name);
+    } else {
+        assert_regexp_match(date.toString(), /Friday, November 11, 2011 at 4:55:54 AM GMT\+0900 South Korea Time/, this.name);
+    }
 }, document.title);
 
 </script>
index 1734a391eacd35b2a130cdcc7c51496384c46e93..b2e8f25ff487fa6528ea2ec9d6d04b6d9d24370c 100755 (executable)
@@ -39,7 +39,12 @@ Authors:
 //==== PRIORITY P1
 //==== TEST_CRITERIA MNA MR
 test(function () {
-    assert_regexp_match(date.toTimeString(), /4:55:54 AM GMT\+0900 South Korea Time/, this.name);
+    icu_ver = getLibicuVersion();
+    if(icu_ver < NEWVERSION_ICU) {
+        assert_regexp_match(date.toTimeString(), /0?4:55:54( AM)? GMT\+0900 South Korea Time/, this.name);
+    } else {
+        assert_regexp_match(date.toTimeString(), /4:55:54 AM GMT\+0900 South Korea Time/, this.name);
+    }
 }, document.title);
 
 </script>
index c0e36f85b47139ec08772df66c31096a8405747c..2eae18f53fd0005b9649178d6ceed13ae1b962d6 100755 (executable)
@@ -40,7 +40,12 @@ test(function () {
     var returnedValue;
     returnedValue = tizen.time.getTimeFormat();
     assert_type(returnedValue, "string", "Time format type");
-    assert_equals(returnedValue, "h:m:s ap", "Time format");
+    icu_ver = getLibicuVersion();
+    if(icu_ver < NEWVERSION_ICU) {
+        assert_equals(returnedValue, "h:m:s ap", "Time format");
+    } else {
+        assert_equals(returnedValue, "h:m:s ap", "Time format");
+    }
 }, document.title);
 
 </script>
index 35107f4ffcdacd8f437835c474e39cc539c7a993..22893ab8f4633ff6e83facf00a558b9d7339c0d5 100755 (executable)
@@ -140,6 +140,31 @@ var testAdditionalParamArray = [ERROR_NUM, null, undefined];
 
 var DATE_FORMAT = "D, d M y"; // this variable MUST be set before executing tests
 var TIME_FORMAT = "h:m:s ap"; // this variable MUST be set before executing tests
+var NEWVERSION_ICU = 72.1;
+
+function getLibicuVersion() {
+    var toSend = {'cmd' : "rpm -qa |grep icu"};
+    var response =  $.ajax({
+        type: "POST",
+        url: 'http://127.0.0.1:8000/execute_command',
+        async: false,
+        dataType: 'json',
+        data: toSend
+    });
+    //This log provides console output after executing shell command.
+    console.log(JSON.stringify(response));
+    str = JSON.stringify(response)
+    console.log(JSON.stringify(response));
+    const pattern = /-(\d+\.\d+)-/;
+    const result = str.match(pattern);
+
+    if (result) {
+        console.log(result[1]);// 输出 70.1
+    } else {
+        assert_unreached("No match found.");
+    }
+    return parseFloat(result[1])
+}
 
 // change date and time format
 document.write('<script src="../webrunner/jquery-1.10.2.min.js"></script>');