Commit 3469b3f2 authored by ggaren's avatar ggaren
Browse files

- Added test case for fix to http://bugzilla.opendarwin.org/show_bug.cgi?id=4892

          Date constructor has problems with months larger than 11

        Test cases added:

        * layout-tests/fast/js/date-big-constructor-expected.txt: Added.
        * layout-tests/fast/js/date-big-constructor.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@10572 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e149b43
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x72
RenderText {TEXT} at (0,0) size 766x72
text run at (0,0) width 724: "This test case checks that months greater than 11 are handled correctly when passed to the Date constructor and the"
text run at (0,18) width 131: "Date.UTC function. "
text run at (131,18) width 622: "The ECMA 262 specification says that months > 11 should be treated as month % 12 and the year "
text run at (753,18) width 13: "as"
text run at (0,36) width 160: "year + floor(month / 12). "
text run at (160,36) width 338: "The expected output on success is \"Success!\" below. "
text run at (498,36) width 191: "On failure a list of differences "
text run at (689,36) width 53: "between"
text run at (0,54) width 265: "expected and actual output will be shown."
RenderBlock {DIV} at (0,88) size 784x18
RenderBlock {DIV} at (0,0) size 784x18
RenderText {TEXT} at (0,0) size 55x18
text run at (0,0) width 55: "Success!"
<html>
<head>
<title>Test Case: Verify that months greater than 11 are handled correctly in Date constructor and Date.UTC</title>
</head>
<body>
<p>
This test case checks that months greater than 11 are handled correctly when passed to the Date constructor and the
Date.UTC function. The ECMA 262 specification says that months &gt; 11 should be treated as month % 12 and the year
as year + floor(month / 12). The expected output on success is "Success!" below. On failure a list of differences
between expected and actual output will be shown.
</p>
<div id="console">
</div>
<script type="text/javascript">
var failures = 0;
function write(msg) {
var n = document.createElement("div");
n.appendChild(document.createTextNode(msg));
document.getElementById("console").appendChild(n);
}
function expect(expected, input, actual) {
if (expected != actual) {
write("Expected " + expected + " for " + input + " but got " + actual);
failures++;
}
}
var expectedUTC = [1104537600000, 1107216000000, 1109635200000, 1112313600000,
1114905600000, 1117584000000, 1120176000000, 1122854400000,
1125532800000, 1128124800000, 1130803200000, 1133395200000,
1136073600000, 1138752000000, 1141171200000, 1143849600000,
1146441600000, 1149120000000, 1151712000000, 1154390400000,
1157068800000, 1159660800000, 1162339200000, 1164931200000,
1167609600000, 1170288000000, 1172707200000, 1175385600000,
1177977600000, 1180656000000, 1183248000000, 1185926400000,
1188604800000, 1191196800000, 1193875200000, 1196467200000];
for (var i = 0; i < 36; i++) {
var d = new Date(2005, i, 1);
var input = 2005 + "-" + i;
var expected = 2005 + Math.floor(i / 12) + "-" + (i % 12);
var actual = d.getFullYear() + "-" + d.getMonth();
expect(expected, input, actual);
}
for (var i = 0; i < 36; i++) {
var u = Date.UTC(2005, i, 1);
var input = 2005 + "-" + i;
expect(expectedUTC[i], input, u);
}
if (! failures)
write("Success!");
</script>
</body>
</html>
\ No newline at end of file
2005-09-20 Geoffrey Garen <ggaren@apple.com>
- Added test case for fix to http://bugzilla.opendarwin.org/show_bug.cgi?id=4892
Date constructor has problems with months larger than 11
Test cases added:
* layout-tests/fast/js/date-big-constructor-expected.txt: Added.
* layout-tests/fast/js/date-big-constructor.html: Added.
2005-09-20 Geoffrey Garen <ggaren@apple.com>
- Rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4247
addEventListener in Obj-C does not work
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment