Changeset 55275 in webkit


Ignore:
Timestamp:
Feb 26, 2010 2:40:17 AM (14 years ago)
Author:
hamaji@chromium.org
Message:

2010-02-26 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Eric Seidel.

Refine LayoutTests/printing/css2.1 with numberOfPages
https://bugs.webkit.org/show_bug.cgi?id=35334

Small refinements were done in paged-media-test-utils.js.

Note that WebKit doesn't pass page-break-after-003 for now.

  • printing/css2.1/README.txt:
  • printing/css2.1/page-break-after-000-expected.txt:
  • printing/css2.1/page-break-after-000.html:
  • printing/css2.1/page-break-after-001-expected.txt:
  • printing/css2.1/page-break-after-001.html:
  • printing/css2.1/page-break-after-002-expected.txt:
  • printing/css2.1/page-break-after-002.html:
  • printing/css2.1/page-break-after-003-expected.txt: Added.
  • printing/css2.1/page-break-after-003.html: Added.
  • printing/css2.1/page-break-after-004-expected.txt:
  • printing/css2.1/page-break-after-004.html:
  • printing/css2.1/page-break-before-000-expected.txt:
  • printing/css2.1/page-break-before-000.html:
  • printing/css2.1/page-break-before-001-expected.txt:
  • printing/css2.1/page-break-before-001.html:
  • printing/css2.1/page-break-before-002-expected.txt:
  • printing/css2.1/page-break-before-002.html:
  • printing/css2.1/page-break-inside-000-expected.txt:
  • printing/css2.1/page-break-inside-000.html:
  • printing/resources/paged-media-test-utils.js: (appendResult): (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest):
Location:
trunk/LayoutTests
Files:
1 added
19 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55274 r55275  
     12010-02-26  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Refine LayoutTests/printing/css2.1 with numberOfPages
     6        https://bugs.webkit.org/show_bug.cgi?id=35334
     7
     8        Small refinements were done in paged-media-test-utils.js.
     9
     10        Note that WebKit doesn't pass page-break-after-003 for now.
     11
     12        * printing/css2.1/README.txt:
     13        * printing/css2.1/page-break-after-000-expected.txt:
     14        * printing/css2.1/page-break-after-000.html:
     15        * printing/css2.1/page-break-after-001-expected.txt:
     16        * printing/css2.1/page-break-after-001.html:
     17        * printing/css2.1/page-break-after-002-expected.txt:
     18        * printing/css2.1/page-break-after-002.html:
     19        * printing/css2.1/page-break-after-003-expected.txt: Added.
     20        * printing/css2.1/page-break-after-003.html: Added.
     21        * printing/css2.1/page-break-after-004-expected.txt:
     22        * printing/css2.1/page-break-after-004.html:
     23        * printing/css2.1/page-break-before-000-expected.txt:
     24        * printing/css2.1/page-break-before-000.html:
     25        * printing/css2.1/page-break-before-001-expected.txt:
     26        * printing/css2.1/page-break-before-001.html:
     27        * printing/css2.1/page-break-before-002-expected.txt:
     28        * printing/css2.1/page-break-before-002.html:
     29        * printing/css2.1/page-break-inside-000-expected.txt:
     30        * printing/css2.1/page-break-inside-000.html:
     31        * printing/resources/paged-media-test-utils.js:
     32        (appendResult):
     33        (pageNumberForElementShouldBe):
     34        (numberOfPagesShouldBe):
     35        (runPrintingTest):
     36
    1372010-02-26  Philippe Normand  <pnormand@igalia.com>
    238
  • trunk/LayoutTests/printing/css2.1/README.txt

    r54538 r55275  
    1111- Add dumpAsText() call.
    1212- Add test() function and implement it using layoutTestController functions.
     13- Call test() function using runPrintintTest(test) from body's onload.
    1314- Add id attributes for elements in question.
    14 - Add <div id="results"> to report the test results.
    15 
    16 FIXME: We have no way to get the number of last page for now.
    17        Though page-break-before-003 is actually failing, we cannot add
    18        failing test due to the lack of this feature.
    1915
    2016FIXME: page-margin-* aren't added yet. We may need
  • trunk/LayoutTests/printing/css2.1/page-break-after-000-expected.txt

    r54538 r55275  
    11There must be a page break after this paragraph, followed by another line of content. This test should produce two pages of output.
    22This text should be at the top of the second and final page.
    3 PASS
    43
     4PASS: page number of "test" is 1
     5PASS: number of pages is 2
     6All tests passed
  • trunk/LayoutTests/printing/css2.1/page-break-after-000.html

    r54538 r55275  
    2424    function test()
    2525    {
    26         pageNumberShouldBe('test', 1);
     26        pageNumberForElementShouldBe('test', 1);
     27        numberOfPagesShouldBe(2);
    2728    }
    2829
    2930</script>
    3031</head>
    31 <body onload="test()">
     32<body onload="runPrintingTest(test)">
    3233    <div class="break">There must be a page break after this paragraph, followed by another line of content. This test should produce two pages of output.</div>
    3334    <div id="test">
    3435        This text should be at the top of the second and final page.
    3536    </div>
    36     <div id="results"></div>
    3737</body>
    3838</html>
  • trunk/LayoutTests/printing/css2.1/page-break-after-001-expected.txt

    r54538 r55275  
    11There must not be a page break after this line of text.
    22This test should produce only one page of output.
    3 PASS
    43
     4PASS: page number of "test" is 0
     5PASS: number of pages is 1
     6All tests passed
  • trunk/LayoutTests/printing/css2.1/page-break-after-001.html

    r54538 r55275  
    2323    function test()
    2424    {
    25         pageNumberShouldBe('test', 0);
     25        pageNumberForElementShouldBe('test', 0);
     26        numberOfPagesShouldBe(1);
    2627    }
    2728
    2829</script>
    2930</head>
    30 <body onload="test()">
     31<body onload="runPrintingTest(test)">
    3132    <div class="noBreak">There must <strong>not</strong> be a page break after this line of text.</div>
    3233    <div id="test">This test should produce only one page of output.</div>
    33     <div id="results"></div>
    3434</body>
    3535</html>
  • trunk/LayoutTests/printing/css2.1/page-break-after-002-expected.txt

    r54538 r55275  
    44This sentence must be either on the second or on the third page.
    55
    6 PASS
    7 PASS
    86
     7PASS: page number of "test1" is 1
     8PASS: page number of "test2" is 1
     9All tests passed
  • trunk/LayoutTests/printing/css2.1/page-break-after-002.html

    r54538 r55275  
    2323    function test()
    2424    {
    25         pageNumberShouldBe('test1', 1);
     25        pageNumberForElementShouldBe('test1', 1);
    2626        // As of February 2010, CSS spec says user agents may apply
    2727        // page-break-* to inline boxes. Though we are using 1 as the
    2828        // expected page number, 2 should be also OK.
    29         pageNumberShouldBe('test2', 1);
     29        pageNumberForElementShouldBe('test2', 1);
    3030    }
    3131
    3232</script>
    3333</head>
    34 <body onload="test()">
     34<body onload="runPrintingTest(test)">
    3535    <p>This sentence must be on the first page.</p>
    3636        <p class="noBreak" id="test1">This sentence must be on the second page.</p>
    3737    <p id="test2">This sentence must be either on the second or on the third page.</p>
    38     <div id="results"></div>
    39 
    4038</body>
    4139</html>
  • trunk/LayoutTests/printing/css2.1/page-break-after-003.html

    r55274 r55275  
    33<head>
    44<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    5 <title>CSS Test: page-break-after: always</title>
     5<title>CSS Test: page-break-after (no inherit)</title>
    66<link rel="author" href="mailto:mturnwall@revenution.com" title="Michael Turnwall">
    77<link rel="author" href="http://www.hp.com/" title="Hewlett-Packard Company">
    88<link rel="help" href="http://www.w3.org/TR/CSS21/page.html#page-break-props">
    99<meta content="paged" name="flags">
    10 <meta content="The 'always' value of the 'page-break-after' property forces a page break after the box." name="assert">
     10<meta content="The 'page-break-after' property is not inherited." name="assert">
    1111<style type="text/css">
    1212
    13     div.break {
     13    div {
    1414        page-break-after:always;
    1515    }
     
    2424    function test()
    2525    {
    26         pageNumberShouldBe('test', 1);
     26        pageNumberForElementShouldBe('test1', 0);
     27        pageNumberForElementShouldBe('test2', 1);
     28        numberOfPagesShouldBe(2);
    2729    }
    2830
    2931</script>
    3032</head>
    31 <body onload="test()">
    32     <div class="break">There must be a page break after this paragraph, followed by another line of content. This test should produce two pages of output.</div>
    33     <div id="test">
     33<body onload="runPrintingTest(test)">
     34    <div>
     35        <p>There must <strong>not</strong> be a page break after this line of text.</p>
     36        <span id="test1">This test should produce two pages of output.</span>
     37    </div>
     38    <div id="test2">
    3439        This text should be at the top of the second and final page.
    3540    </div>
    36     <div id="results"></div>
    3741</body>
    3842</html>
  • trunk/LayoutTests/printing/css2.1/page-break-after-004-expected.txt

    r54538 r55275  
    44This must be the last sentence on the second and final page.
    55
    6 PASS
    7 PASS
    86
     7PASS: page number of "test1" is 1
     8PASS: page number of "test2" is 1
     9PASS: number of pages is 2
     10All tests passed
  • trunk/LayoutTests/printing/css2.1/page-break-after-004.html

    r54538 r55275  
    3535    function test()
    3636    {
    37         pageNumberShouldBe('test1', 1);
    38         pageNumberShouldBe('test2', 1);
     37        pageNumberForElementShouldBe('test1', 1);
     38        pageNumberForElementShouldBe('test2', 1);
     39        numberOfPagesShouldBe(2);
    3940    }
    4041
    4142</script>
    4243</head>
    43 <body onload="test()">
     44<body onload="runPrintingTest(test)">
    4445    <div class="noBreakAuto">This test must produce two pages of output. This sentence must be on the first page.</div>
    4546    <div class="noBreakLeft" id="test1">This sentence must be at the top of the second page.</div>
    4647    <div class="noBreakAlways dummy">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</div>
    4748    <p id="test2">This must be the last sentence on the second and final page.</p>
    48     <div id="results"></div>
    4949</body>
    5050</html>
  • trunk/LayoutTests/printing/css2.1/page-break-before-000-expected.txt

    r54538 r55275  
    11This test should produce two pages of output. This text should be at the top of the first page.
    22This text should be at the top of the second and final page.
    3 PASS
    43
     4PASS: page number of "test1" is 0
     5PASS: page number of "test2" is 1
     6PASS: number of pages is 2
     7All tests passed
  • trunk/LayoutTests/printing/css2.1/page-break-before-000.html

    r54538 r55275  
    2525    function test()
    2626    {
    27         pageNumberShouldBe('test', 1);
     27        pageNumberForElementShouldBe('test1', 0);
     28        pageNumberForElementShouldBe('test2', 1);
     29        numberOfPagesShouldBe(2);
    2830    }
    2931
    3032</script>
    3133</head>
    32 <body onload="test()">
    33     <div>This test should produce two pages of output. This text should be at the top of the first page.</div>
    34     <div class="break" id="test">This text should be at the top of the second and final page.</div>
    35     <div id="results"></div>
     34<body onload="runPrintingTest(test)">
     35    <div id="test1">This test should produce two pages of output. This text should be at the top of the first page.</div>
     36    <div class="break" id="test2">This text should be at the top of the second and final page.</div>
    3637</body>
    3738</html>
  • trunk/LayoutTests/printing/css2.1/page-break-before-001-expected.txt

    r54538 r55275  
    11There must not be a page break after this line of text.
    22This test should produce only one page of output.
    3 PASS
    43
     4PASS: page number of "test" is 0
     5PASS: number of pages is 1
     6All tests passed
  • trunk/LayoutTests/printing/css2.1/page-break-before-001.html

    r54538 r55275  
    2525    function test()
    2626    {
    27         pageNumberShouldBe('test', 0);
     27        pageNumberForElementShouldBe('test', 0);
     28        numberOfPagesShouldBe(1);
    2829    }
    2930
    3031</script>
    3132</head>
    32 <body onload="test()">
     33<body onload="runPrintingTest(test)">
    3334    <div>There must <strong>not</strong> be a page break after this line of text.</div>
    3435    <div class="noBreak" id="test">This test should produce only one page of output.</div>
    35     <div id="results"></div>
    3636</body>
    3737</html>
  • trunk/LayoutTests/printing/css2.1/page-break-before-002-expected.txt

    r54538 r55275  
    11There must not be a page break after this line of text.
    22This test should produce only one page of output.
    3 PASS
    43
     4PASS: page number of "test" is 0
     5PASS: number of pages is 1
     6All tests passed
  • trunk/LayoutTests/printing/css2.1/page-break-before-002.html

    r54538 r55275  
    2525    function test()
    2626    {
    27         pageNumberShouldBe('test', 0);
     27        pageNumberForElementShouldBe('test', 0);
     28        numberOfPagesShouldBe(1);
    2829    }
    2930
    3031</script>
    3132</head>
    32 <body onload="test()">
     33<body onload="runPrintingTest(test)">
    3334    <div>There must <strong>not</strong> be a page break after this line of text.</div>
    3435    <div class="noBreak" id="test">This test should produce only one page of output.</div>
    35     <div id="results"></div>
    3636</body>
    3737</html>
  • trunk/LayoutTests/printing/css2.1/page-break-inside-000-expected.txt

    r54538 r55275  
    11There must be a page break below between "FIRST" and "LAST"
    22FIRST dummy dummy dummy dummy dummy dummy dummy dummy dummy FIRST
    3 FAIL expect page number is 0. Was -1
    4 FAIL expect page number is 1. Was 0
    53
     4FAIL: expected page number of "test1" is 0. Was -1
     5FAIL: expected page number of "test2" is 1. Was 0
  • trunk/LayoutTests/printing/css2.1/page-break-inside-000.html

    r54538 r55275  
    3737    function test()
    3838    {
    39         pageNumberShouldBe('test1', 0);
    40         pageNumberShouldBe('test2', 1);
     39        pageNumberForElementShouldBe('test1', 0);
     40        pageNumberForElementShouldBe('test2', 1);
    4141    }
    4242
    4343</script>
    4444</head>
    45 <body onload="test()">
     45<body onload="runPrintingTest(test)">
    4646    <div class="marginDiv1"></div>
    4747    <div class="marginDiv2"></div>
     
    6060        <span id="test2">FIRST</span>
    6161    </div>
    62     <div id="results"></div>
    6362</body>
    6463</html>
  • trunk/LayoutTests/printing/resources/paged-media-test-utils.js

    r54538 r55275  
    1 function pageNumberShouldBe(id, expectedPageNumber)
     1// The buffer to store the results.  We output the results after all
     2// tests finish.   Note that we cannot have a DOM element where the
     3// results are stored in HTMLs because the DOM element to store
     4// results may change the number of pages.
     5var _results = '';
     6var _errored = false;
     7
     8function appendResult(result)
     9{
     10    _results += '<br>' + result;
     11}
     12
     13function pageNumberForElementShouldBe(id, expectedPageNumber)
    214{
    315    var actualPageNumber = layoutTestController.pageNumberForElementById(id);
    4     var result = '';
    516    if (actualPageNumber == expectedPageNumber)
    6         result = 'PASS';
    7     else
    8         result = 'FAIL expect page number is ' + expectedPageNumber + '. Was ' + actualPageNumber;
    9     document.getElementById('results').innerHTML += result + '<br>';
     17        appendResult('PASS: page number of "' + id + '" is ' + actualPageNumber);
     18    else {
     19        appendResult('FAIL: expected page number of "' + id + '" is ' + expectedPageNumber + '. Was ' + actualPageNumber);
     20        _errored = true;
     21    }
    1022}
     23
     24function numberOfPagesShouldBe(expectedNumberOfPages)
     25{
     26    var actualNumberOfPages = layoutTestController.numberOfPages();
     27    if (actualNumberOfPages == expectedNumberOfPages)
     28        appendResult('PASS: number of pages is ' + actualNumberOfPages);
     29    else {
     30        appendResult('FAIL: expected number of pages is ' + expectedNumberOfPages + '. Was ' + actualNumberOfPages);
     31        _errored = true;
     32    }
     33}
     34
     35function runPrintingTest(testFunction)
     36{
     37    if (window.layoutTestController) {
     38        try {
     39            testFunction();
     40        } catch (err) {
     41            _results += '<p>Exception: ' + err.toString();
     42            _errored = true;
     43        }
     44
     45        if (!_errored)
     46            _results += '<br>All tests passed';
     47    } else {
     48        _results += 'This test requires layoutTestController. You can test this manually with the above description.';
     49    }
     50
     51    var resultElement = document.createElement('p');
     52    resultElement.innerHTML = _results;
     53    document.body.appendChild(resultElement);
     54}
Note: See TracChangeset for help on using the changeset viewer.