[webkit-changes] cvs commit: WebCore/layout-tests/fast/js date-big-constructor-expected.txt date-big-constructor.html

Geoffrey ggaren at opensource.apple.com
Tue Sep 20 01:08:57 PDT 2005


ggaren      05/09/20 01:08:57

  Modified:    .        ChangeLog
  Added:       layout-tests/fast/js date-big-constructor-expected.txt
                        date-big-constructor.html
  Log:
          - 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.
  
  Revision  Changes    Path
  1.136     +10 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.135
  retrieving revision 1.136
  diff -u -r1.135 -r1.136
  --- ChangeLog	20 Sep 2005 07:55:53 -0000	1.135
  +++ ChangeLog	20 Sep 2005 08:08:56 -0000	1.136
  @@ -1,4 +1,14 @@
   2005-09-20  Geoffrey Garen  <ggaren at 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 at apple.com>
           - Rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4247
             addEventListener in Obj-C does not work
   
  
  
  
  1.1                  WebCore/layout-tests/fast/js/date-big-constructor-expected.txt
  
  Index: date-big-constructor-expected.txt
  ===================================================================
  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!"
  
  
  
  1.1                  WebCore/layout-tests/fast/js/date-big-constructor.html
  
  Index: date-big-constructor.html
  ===================================================================
  <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>
  
  



More information about the webkit-changes mailing list