def test_table_vertical_align(assert_pixels):
    assert_pixels('''
        rrrrrrrrrrrrrrrrrrrrrrrrrrrr
        rBBBBBBBBBBBBBBBBBBBBBBBBBBr
        rBrBB_BB_BB_BB_BBrrBBrrBB_Br
        rBrBB_BB_BBrBBrBBrrBBrrBBrBr
        rB_BBrBB_BBrBBrBBrrBBrrBBrBr
        rB_BBrBB_BB_BB_BBrrBBrrBB_Br
        rB_BB_BBrBB_BB_BB__BB__BB_Br
        rB_BB_BBrBB_BB_BB__BB__BB_Br
        rBBBBBBBBBBBBBBBBBBBBBBBBBBr
        rrrrrrrrrrrrrrrrrrrrrrrrrrrr
    ''', '''
      <style>
        @page { size: 28px 10px }
        html { font-size: 1px; color: red }
        body { margin: 0; width: 28px; height: 10px }
        td {
          width: 1em;
          padding: 0 !important;
          border: 1px solid blue;
          line-height: 1em;
          font-family: weasyprint;
        }
      </style>
      <table style="border: 1px solid red; border-spacing: 0">
        <tr>
          <!-- Test vertical-align: top, auto height -->
          <td style="vertical-align: top">o o</td>

          <!-- Test vertical-align: middle, auto height -->
          <td style="vertical-align: middle">o o</td>

          <!-- Test vertical-align: bottom, fixed useless height -->
          <td style="vertical-align: bottom; height: 2em">o o</td>

          <!-- Test default vertical-align value (baseline),
               fixed useless height -->
          <td style="height: 5em">o o</td>

          <!-- Test vertical-align: baseline with baseline set by next cell,
               auto height -->
          <td style="vertical-align: baseline">o o</td>

          <!-- Set baseline height to 2px, auto height -->
          <td style="vertical-align: baseline; font-size: 2em">o o</td>

          <!-- Test padding-bottom, fixed useless height,
               set the height of the cells to 2 lines * 2em + 2px = 6px -->
          <td style="vertical-align: baseline; height: 1em;
                     font-size: 2em; padding-bottom: 2px !important">
            o o
          </td>

          <!-- Test padding-top, auto height -->
          <td style="vertical-align: top; padding-top: 1em !important">
            o o
          </td>
        </tr>
      </table>
    ''')
,
tests/layout/test_table.py