From 4ed0c3c9877110380abc9655fc8990ff26e0325d Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 25 Apr 2015 17:48:08 +0200 Subject: [PATCH] Test vertical-align property in tables (fix #31) --- weasyprint/layout/tables.py | 1 - weasyprint/tests/test_layout.py | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/weasyprint/layout/tables.py b/weasyprint/layout/tables.py index 8f6eaa5c5..5ea665e7d 100644 --- a/weasyprint/layout/tables.py +++ b/weasyprint/layout/tables.py @@ -198,7 +198,6 @@ def group_layout(group, position_y, max_position_y, elif cell.vertical_align == 'bottom': vertical_align_shift = ( cell.computed_height - cell.content_height) - # TODO: elif cell.vertical_align == 'baseline': if vertical_align_shift > 0: for child in cell.children: child.translate(dy=vertical_align_shift) diff --git a/weasyprint/tests/test_layout.py b/weasyprint/tests/test_layout.py index 5de46a925..d4811d7bc 100644 --- a/weasyprint/tests/test_layout.py +++ b/weasyprint/tests/test_layout.py @@ -3278,6 +3278,76 @@ def test_table_row_height(): row_group, = table.children +@assert_no_logs +def test_table_vertical_align(): + from .test_draw import _, r, B, assert_pixels + assert_pixels('table_vertical_align', 40, 14, [ + _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, + _+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, + _+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, + _+B+_+B+B+B+_+B+B+B+_+B+B+B+_+B+B+B+_+B+B+B+_+B+B+B+B+_+B+B+B+B+_+B+B+B+B+_+B+_, + _+B+_+B+r+B+_+B+_+B+_+B+_+B+_+B+_+B+_+B+_+B+_+B+r+r+B+_+B+r+r+B+_+B+_+_+B+_+B+_, + _+B+_+B+r+B+_+B+_+B+_+B+_+B+_+B+r+B+_+B+r+B+_+B+r+r+B+_+B+r+r+B+_+B+r+r+B+_+B+_, + _+B+_+B+_+B+_+B+r+B+_+B+_+B+_+B+r+B+_+B+r+B+_+B+r+r+B+_+B+r+r+B+_+B+r+r+B+_+B+_, + _+B+_+B+_+B+_+B+r+B+_+B+_+B+_+B+_+B+_+B+_+B+_+B+r+r+B+_+B+r+r+B+_+B+r+r+B+_+B+_, + _+B+_+B+_+B+_+B+_+B+_+B+r+B+_+B+_+B+_+B+_+B+_+B+_+_+B+_+B+_+_+B+_+B+r+r+B+_+B+_, + _+B+_+B+_+B+_+B+_+B+_+B+r+B+_+B+_+B+_+B+_+B+_+B+_+_+B+_+B+_+_+B+_+B+_+_+B+_+B+_, + _+B+_+B+B+B+_+B+B+B+_+B+B+B+_+B+B+B+_+B+B+B+_+B+B+B+B+_+B+B+B+B+_+B+B+B+B+_+B+_, + _+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, + _+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, + _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, + ], ''' + + + + + + + + + + + + + + + + + + + + + + + + + + + +
o oo oo oo oo oo o + o o + + o o +
+ ''') + + @assert_no_logs def test_table_wrapper(): page, = parse('''