示例#1
0
def test_rendering(dxf):
    MockCell.reset()
    layout = dxf.blocks.new('test_rendering')
    table = Table((0, 0), 3, 3)
    indices = [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1),
               (2, 2)]
    cell = MockCell(table, 'default', (1, 1))
    for row, col in indices:
        table.set_cell(row, col, cell)
    table.render(layout)
    assert cell.counter == 9  # count get_dxf_entity calls
示例#2
0
def test_dxf_creation_span(dxf):
    MockCell.reset()
    layout = dxf.blocks.new('test_dxf_creation_span')
    table = Table((0, 0), 3, 3)
    indices = [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1),
               (2, 2)]
    cell = MockCell(table, 'default', (1, 1))
    for row, col in indices:
        table.set_cell(row, col, cell)
    spancell = MockCell(table, 'default', span=(2, 2))  # hides 3 cells
    table.set_cell(0, 0, spancell)
    table.render(layout)
    assert cell.counter == 6  # count get_dxf_entity calls