Commit 59cf1aa7 authored by eric@webkit.org's avatar eric@webkit.org

2010-06-19 Hayato Ito <hayato@chromium.org>

        Reviewed by Adam Barth.

        Add tests for 'page-break-{before,after}: avoid'.
        All tests are expected to fail due to lack of implementations.

        https://bugs.webkit.org/show_bug.cgi?id=40814

        * printing/page-break-after-avoid-expected.txt: Added.
        * printing/page-break-after-avoid.html: Added.
        * printing/page-break-avoid-expected.txt: Added.
        * printing/page-break-avoid.html: Added.
        * printing/page-break-before-avoid-expected.txt: Added.
        * printing/page-break-before-avoid.html: Added.
        * printing/script-tests/page-break-after-avoid.js: Added.
        (test):
        * printing/script-tests/page-break-avoid.js: Added.
        (test):
        * printing/script-tests/page-break-before-avoid.js: Added.
        (test):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@61501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent af8df7ea
2010-06-19 Hayato Ito <hayato@chromium.org>
Reviewed by Adam Barth.
Add tests for 'page-break-{before,after}: avoid'.
All tests are expected to fail due to lack of implementations.
https://bugs.webkit.org/show_bug.cgi?id=40814
* printing/page-break-after-avoid-expected.txt: Added.
* printing/page-break-after-avoid.html: Added.
* printing/page-break-avoid-expected.txt: Added.
* printing/page-break-avoid.html: Added.
* printing/page-break-before-avoid-expected.txt: Added.
* printing/page-break-before-avoid.html: Added.
* printing/script-tests/page-break-after-avoid.js: Added.
(test):
* printing/script-tests/page-break-avoid.js: Added.
(test):
* printing/script-tests/page-break-before-avoid.js: Added.
(test):
2010-06-19 Tony Gentilcore <tonyg@chromium.org>
Reviewed by Adam Barth.
......
Test for page-break-after:avoid
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS: page number of "page1" is 1
FAIL: expected page number of "page2-1" is 2. Was 1
FAIL: expected page number of "page2-2" is 2. Was 1
PASS: page number of "page3-1" is 3
PASS: page number of "page3-2" is 3
PASS: page number of "page3-3" is 3
PASS: page number of "page5" is 5
FAIL: expected page number of "page6-1" is 6. Was 5
PASS: page number of "page6-7" is 6
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
<script src="../fast/js/resources/js-test-pre.js"></script>
<script src="resources/paged-media-test-utils.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="sandbox"></div>
<script src="script-tests/page-break-after-avoid.js"></script>
<script>runPrintingTest(test);</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Test for combined page-break-{before,after,inside}:avoid
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS: page number of "page1-1" is 1
FAIL: expected page number of "page2-1" is 2. Was 1
PASS: page number of "page2-8" is 2
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
<script src="../fast/js/resources/js-test-pre.js"></script>
<script src="resources/paged-media-test-utils.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="sandbox"></div>
<script src="script-tests/page-break-avoid.js"></script>
<script>runPrintingTest(test);</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Test for page-break-before:avoid
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS: page number of "page1" is 1
FAIL: expected page number of "page2-1" is 2. Was 1
FAIL: expected page number of "page2-2" is 2. Was 1
PASS: page number of "page3-1" is 3
PASS: page number of "page3-2" is 3
PASS: page number of "page3-3" is 3
PASS: page number of "page5" is 5
FAIL: expected page number of "page6-1" is 6. Was 5
PASS: page number of "page6-7" is 6
PASS: page number of "page7" is 7
PASS: page number of "page10" is 10
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
<script src="../fast/js/resources/js-test-pre.js"></script>
<script src="resources/paged-media-test-utils.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="sandbox"></div>
<script src="script-tests/page-break-before-avoid.js"></script>
<script>runPrintingTest(test);</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
description("Test for page-break-after:avoid");
function test()
{
createBlockWithRatioToPageHeight("page1", 0.5).style.pageBreakBefore = "always";
// A block 'page2-1' must move to the next page because it has 'page-break-after:avoid'
// and both 'page2-1' and 'page2-2' cannot be placed in the current page at the same time.
createBlockWithRatioToPageHeight("page2-1", 0.3).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page2-2", 0.3);
createBlockWithRatioToPageHeight("page3-1", 0.5).style.pageBreakBefore = "always";
// A page break can occur inside of 'page3-3' block because it has child elements.
createBlockWithRatioToPageHeight("page3-2", 0.3).style.pageBreakAfter = "avoid";
createBlockWithNumberOfLines("page3-3", 10);
createBlockWithRatioToPageHeight("page5", 0.5).style.pageBreakBefore = "always";
// It seems unrealistic, but block 'page6-1' must move to the next page.
createBlockWithRatioToPageHeight("page6-1", 0.1).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page6-2", 0.1).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page6-3", 0.1).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page6-4", 0.1).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page6-5", 0.1).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page6-6", 0.1).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page6-7", 0.1);
pageNumberForElementShouldBe("page1", 1);
pageNumberForElementShouldBe("page2-1", 2);
pageNumberForElementShouldBe("page2-2", 2);
pageNumberForElementShouldBe("page3-1", 3);
pageNumberForElementShouldBe("page3-2", 3);
pageNumberForElementShouldBe("page3-3", 3);
pageNumberForElementShouldBe("page5", 5);
pageNumberForElementShouldBe("page6-1", 6);
// Omit tests for intermediate blocks.
pageNumberForElementShouldBe("page6-7", 6);
document.body.removeChild(document.getElementById("sandbox"));
}
var successfullyParsed = true;
description("Test for combined page-break-{before,after,inside}:avoid");
function test()
{
var block;
createBlockWithRatioToPageHeight("page1-1", 0.4).style.pageBreakBefore = "always";
// A block 'page2-1' must move to the next page because we cannot find any
// allowed page breaks till the end of block page2-8.
createBlockWithRatioToPageHeight("page2-1", 0.1).style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page2-2", 0.1);
createBlockWithRatioToPageHeight("page2-3", 0.1).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page2-4", 0.1).style.pageBreakBefore = "avoid";
block = createBlockWithRatioToPageHeight("page2-5", 0.1);
block.style.pageBreakBefore = "avoid";
block.style.pageBreakAfter = "avoid";
createBlockWithRatioToPageHeight("page2-6", 0.1);
block = createBlockWithNumberOfLines("page2-7", 4);
block.style.pageBreakBefore = "avoid";
block.style.pageBreakAfter = "avoid";
block.style.pageBreakInside = "avoid";
createBlockWithRatioToPageHeight("page2-8", 0.1).style.pageBreakBefore = "avoid";
pageNumberForElementShouldBe("page1-1", 1);
pageNumberForElementShouldBe("page2-1", 2);
// Omit tests for intermediate blocks.
pageNumberForElementShouldBe("page2-8", 2);
document.body.removeChild(document.getElementById("sandbox"));
}
var successfullyParsed = true;
description("Test for page-break-before:avoid");
function test()
{
createBlockWithRatioToPageHeight("page1", 0.5).style.pageBreakBefore = "always";
// A block 'page2-1' must move to the next page because the following block 'page2-2'
// has 'page-break-before:avoid' and both blocks cannot be placed in the current page
// at the same time.
createBlockWithRatioToPageHeight("page2-1", 0.3);
createBlockWithRatioToPageHeight("page2-2", 0.3).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page3-1", 0.5).style.pageBreakBefore = "always";
// A page break can occur inside of 'page3-3' block because it has child elements.
createBlockWithRatioToPageHeight("page3-2", 0.3);
createBlockWithNumberOfLines("page3-3", 10).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page5", 0.5).style.pageBreakBefore = "always";
// It seems unrealistic, but block 'page6-1' must move to the next page.
createBlockWithRatioToPageHeight("page6-1", 0.1);
createBlockWithRatioToPageHeight("page6-2", 0.1).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page6-3", 0.1).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page6-4", 0.1).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page6-5", 0.1).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page6-6", 0.1).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page6-7", 0.1).style.pageBreakBefore = "avoid";
// We don't define where block 'page7or8-1' is placed.
createBlockWithRatioToPageHeight("page7", 0.5).style.pageBreakBefore = "always";
createBlockWithRatioToPageHeight("page7or8-1", 0.1);
createBlockWithRatioToPageHeight("page7or8-2", 3).style.pageBreakBefore = "avoid";
createBlockWithRatioToPageHeight("page10", 0.1);
pageNumberForElementShouldBe("page1", 1);
pageNumberForElementShouldBe("page2-1", 2);
pageNumberForElementShouldBe("page2-2", 2);
pageNumberForElementShouldBe("page3-1", 3);
pageNumberForElementShouldBe("page3-2", 3);
pageNumberForElementShouldBe("page3-3", 3);
pageNumberForElementShouldBe("page5", 5);
pageNumberForElementShouldBe("page6-1", 6);
// Omit tests for intermediate blocks.
pageNumberForElementShouldBe("page6-7", 6);
pageNumberForElementShouldBe("page7", 7);
pageNumberForElementShouldBe("page10", 10);
document.body.removeChild(document.getElementById("sandbox"));
}
var successfullyParsed = true;
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