From 468e6fed89f6826f612132108c19eac3be22d4c0 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Fri, 15 Mar 2019 17:43:46 +0100 Subject: [PATCH] Add test for box-decoration-break Related to #771. --- weasyprint/tests/test_layout/test_block.py | 61 +++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/weasyprint/tests/test_layout/test_block.py b/weasyprint/tests/test_layout/test_block.py index 2bf8e4f2a..e47a18707 100644 --- a/weasyprint/tests/test_layout/test_block.py +++ b/weasyprint/tests/test_layout/test_block.py @@ -540,9 +540,8 @@ def test_vertical_space_9(margin_1, margin_2, result): @assert_no_logs -def test_box_decoration_break(): +def test_box_decoration_break_block_slice(): # http://www.w3.org/TR/css3-background/#the-box-decoration-break - # Property not implemented yet, always "slice". page_1, page_2 = parse(''' +

+
+
+
+
''') + html, = page_1.children + body, = html.children + paragraph, = body.children + line_1, line_2 = paragraph.children + assert paragraph.position_y == 0 + assert paragraph.margin_top == 5 + assert paragraph.border_top_width == 3 + assert paragraph.padding_top == 2 + assert paragraph.content_box_y() == 10 + assert line_1.position_y == 10 + assert line_2.position_y == 50 + assert paragraph.height == 80 + # TODO: bottom margin should be 0 + # https://www.w3.org/TR/css-break-3/#valdef-box-decoration-break-clone + # "Cloned margins are truncated on block-level boxes." + # See https://github.com/Kozea/WeasyPrint/issues/115 + assert paragraph.margin_bottom == 5 + assert paragraph.border_bottom_width == 3 + assert paragraph.padding_bottom == 2 + assert paragraph.margin_height() == 100 + + html, = page_2.children + body, = html.children + paragraph, = body.children + line_1, line_2 = paragraph.children + assert paragraph.position_y == 0 + # TODO: top margin should be 0 + # https://www.w3.org/TR/css-break-3/#valdef-box-decoration-break-clone + # "Cloned margins are truncated on block-level boxes." + # See https://github.com/Kozea/WeasyPrint/issues/115 + assert paragraph.margin_top == 5 + assert paragraph.border_top_width == 3 + assert paragraph.padding_top == 2 + assert paragraph.content_box_y() == 10 + assert line_1.position_y == 10 + assert line_2.position_y == 50 + assert paragraph.height == 80 + assert paragraph.padding_bottom == 2 + assert paragraph.border_bottom_width == 3 + assert paragraph.margin_bottom == 5 + assert paragraph.margin_height() == 100