@@ -2075,3 +2075,61 @@ def test_inline_table_baseline(vertical_align, table_position_y):
2075
2075
assert text1 .position_y == text2 .position_y == 0
2076
2076
assert table .height == 10 * 2
2077
2077
assert table .position_y == table_position_y
2078
+
2079
+
2080
+ @assert_no_logs
2081
+ def test_table_caption_margin_top ():
2082
+ page , = render_pages ('''
2083
+ <style>
2084
+ table { margin: 20px; }
2085
+ caption, h1, h2 { margin: 20px; height: 10px }
2086
+ td { height: 10px }
2087
+ </style>
2088
+ <h1></h1>
2089
+ <table>
2090
+ <caption></caption>
2091
+ <tr>
2092
+ <td></td>
2093
+ </tr>
2094
+ </table>
2095
+ <h2></h2>
2096
+ ''' )
2097
+ html , = page .children
2098
+ body , = html .children
2099
+ h1 , wrapper , h2 = body .children
2100
+ caption , table = wrapper .children
2101
+ tbody , = table .children
2102
+ assert (h1 .content_box_x (), h1 .content_box_y ()) == (20 , 20 )
2103
+ assert (wrapper .content_box_x (), wrapper .content_box_y ()) == (20 , 50 )
2104
+ assert (caption .content_box_x (), caption .content_box_y ()) == (40 , 70 )
2105
+ assert (tbody .content_box_x (), tbody .content_box_y ()) == (20 , 100 )
2106
+ assert (h2 .content_box_x (), h2 .content_box_y ()) == (20 , 130 )
2107
+
2108
+
2109
+ @assert_no_logs
2110
+ def test_table_caption_margin_bottom ():
2111
+ page , = render_pages ('''
2112
+ <style>
2113
+ table { margin: 20px; }
2114
+ caption, h1, h2 { margin: 20px; height: 10px; caption-side: bottom }
2115
+ td { height: 10px }
2116
+ </style>
2117
+ <h1></h1>
2118
+ <table>
2119
+ <caption></caption>
2120
+ <tr>
2121
+ <td></td>
2122
+ </tr>
2123
+ </table>
2124
+ <h2></h2>
2125
+ ''' )
2126
+ html , = page .children
2127
+ body , = html .children
2128
+ h1 , wrapper , h2 = body .children
2129
+ table , caption = wrapper .children
2130
+ tbody , = table .children
2131
+ assert (h1 .content_box_x (), h1 .content_box_y ()) == (20 , 20 )
2132
+ assert (wrapper .content_box_x (), wrapper .content_box_y ()) == (20 , 50 )
2133
+ assert (tbody .content_box_x (), tbody .content_box_y ()) == (20 , 50 )
2134
+ assert (caption .content_box_x (), caption .content_box_y ()) == (40 , 80 )
2135
+ assert (h2 .content_box_x (), h2 .content_box_y ()) == (20 , 130 )
0 commit comments