From: chen Date: Thu, 23 May 2024 03:02:43 +0000 (+0800) Subject: [headed][time] fix icu related string issue in riscv64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F76%2F311576%2F2;p=test%2Ftct%2Fweb%2Fapi.git [headed][time] fix icu related string issue in riscv64 Change-Id: Ibb21f48120943dc1c4c5f38df15653d08c718e22 Signed-off-by: chen --- diff --git a/common/tct-time-tizen-tests/time/TZDate_toLocaleString_for_specific_date.html b/common/tct-time-tizen-tests/time/TZDate_toLocaleString_for_specific_date.html index db93c9feb..395556386 100755 --- a/common/tct-time-tizen-tests/time/TZDate_toLocaleString_for_specific_date.html +++ b/common/tct-time-tizen-tests/time/TZDate_toLocaleString_for_specific_date.html @@ -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); diff --git a/common/tct-time-tizen-tests/time/TZDate_toString_for_specific_date.html b/common/tct-time-tizen-tests/time/TZDate_toString_for_specific_date.html index 85b1d6b9f..6fd63fd5f 100755 --- a/common/tct-time-tizen-tests/time/TZDate_toString_for_specific_date.html +++ b/common/tct-time-tizen-tests/time/TZDate_toString_for_specific_date.html @@ -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); diff --git a/common/tct-time-tizen-tests/time/TZDate_toTimeString_for_specific_date.html b/common/tct-time-tizen-tests/time/TZDate_toTimeString_for_specific_date.html index 1734a391e..b2e8f25ff 100755 --- a/common/tct-time-tizen-tests/time/TZDate_toTimeString_for_specific_date.html +++ b/common/tct-time-tizen-tests/time/TZDate_toTimeString_for_specific_date.html @@ -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); diff --git a/common/tct-time-tizen-tests/time/TimeUtil_getTimeFormat.html b/common/tct-time-tizen-tests/time/TimeUtil_getTimeFormat.html index c0e36f85b..2eae18f53 100755 --- a/common/tct-time-tizen-tests/time/TimeUtil_getTimeFormat.html +++ b/common/tct-time-tizen-tests/time/TimeUtil_getTimeFormat.html @@ -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); diff --git a/common/tct-time-tizen-tests/time/support/time_common.js b/common/tct-time-tizen-tests/time/support/time_common.js index 35107f4ff..22893ab8f 100755 --- a/common/tct-time-tizen-tests/time/support/time_common.js +++ b/common/tct-time-tizen-tests/time/support/time_common.js @@ -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('');