[common][tct-time-tizen-tests][Update tc due to issue] 65/119965/1
authorxy.qian <xy.qian@samsung.com>
Tue, 21 Mar 2017 02:26:40 +0000 (10:26 +0800)
committerxy.qian <xy.qian@samsung.com>
Tue, 21 Mar 2017 02:26:40 +0000 (10:26 +0800)
Change-Id: I46c43d876a04e12bed53646604e987555ea6e77e
Signed-off-by: xy.qian <xy.qian@samsung.com>
common/tct-time-tizen-tests/time/TimeUtil_getDateFormat.html
common/tct-time-tizen-tests/time/support/time_common.js

index b653599b03620bd0ffdd88206c3028fddde1b55a..27678381230b85fb6a7c767dea18ff5032676a27 100755 (executable)
@@ -41,7 +41,7 @@ test(function () {
     var returnedValue, shortformat = true;
     returnedValue = tizen.time.getDateFormat(shortformat);
     assert_type(returnedValue, "string", "Timezone type");
-    assert_equals(returnedValue, DATE_FORMAT, "Date format");
+    assert_equals(returnedValue, getShortDateFormat(DATE_FORMAT), "Date format");
 }, document.title);
 
 </script>
index d3ffa27883be6c51db8a9a7f9a14518b4445def7..35107f4ffcdacd8f437835c474e39cc539c7a993 100755 (executable)
@@ -69,12 +69,78 @@ var invalidArgument = [
     function () {}
 ];
 
+function getExpectedLocaleString (dateformat) {
+    var i = 0, resultString = "";
+    for (i = 0; i < dateformat.length; i++) {
+        if (dateformat.charAt(i) == "D")
+            resultString += "Friday";
+        else if (dateformat.charAt(i) == "y")
+            resultString += "2011";
+        else if (dateformat.charAt(i) == "d")
+            resultString += "11";
+        else if (dateformat.charAt(i) == "m")
+            resultString += "11";
+        else if (dateformat.charAt(i) == "M")
+            resultString += "November";
+        else if (dateformat.charAt(i) == " ")
+            resultString += " ";
+        else if (dateformat.charAt(i) == ",")
+            resultString += ",";
+        else { 
+            assert_unreached("Wrong time format.");
+        }
+    }
+    return [resultString+", 4:55:54 a.m.", resultString+" 4:55:54 a.m."];
+}
+
+function getExpectedLocaleDateString (dateformat) {
+    var i = 0, resultString = "";
+    for (i = 0; i < dateformat.length; i++) {
+        if (dateformat.charAt(i) == "D")
+            resultString += "Friday";
+        else if (dateformat.charAt(i) == "y")
+            resultString += "2011";
+        else if (dateformat.charAt(i) == "d")
+            resultString += "11";
+        else if (dateformat.charAt(i) == "m")
+            resultString += "11";
+        else if (dateformat.charAt(i) == "M")
+            resultString += "November";
+        else if (dateformat.charAt(i) == " ")
+            resultString += " ";
+        else if (dateformat.charAt(i) == ",")
+            resultString += ",";
+        else { 
+            assert_unreached("Wrong time format.");
+        }
+    }
+    return resultString;
+}
+
+function getShortDateFormat (dateformat) {
+    var i = 0, resultString = "";
+    for (i = 0; i < dateformat.length; i++) {
+        if (dateformat.charAt(i) == "D" || dateformat.charAt(i) == " " || dateformat.charAt(i) == ",")
+            resultString += "";
+        else if (dateformat.charAt(i) == "y")
+            resultString += "y/";
+        else if (dateformat.charAt(i) == "d")
+            resultString += "d/";
+        else if (dateformat.charAt(i) == "m" || dateformat.charAt(i) == "M")
+            resultString += "m/";
+        else { 
+            assert_unreached("Wrong time format.");
+        }
+    }
+    return resultString.slice(0, 5);
+}
+
+
 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
 
-// change Major and Minor channel
-document.write('<script src="../testkit/web/jquery-1.10.2.min.js"></script>');
+// change date and time format
+document.write('<script src="../webrunner/jquery-1.10.2.min.js"></script>');
 document.write('<script src="support/getJsonConf.js"></script>');
-