コード例 #1
0
def test_text_cell():
    table = Table((0, 0), 10, 10)
    table.text_cell(8, 8, 'test88', span=(2, 2), style='extrastyle')
    cell = table.get_cell(8, 8)
    assert cell.span == (2, 2)
    assert cell.text == 'test88'
    assert cell.stylename == 'extrastyle'
コード例 #2
0
def test_default_text_cell():
    table = Table((0, 0), 10, 10)
    table.text_cell(0, 0, 'test')
    cell = table.get_cell(0, 0)
    assert cell.span == (1, 1)
    assert cell.text == 'test'
    assert cell.stylename == 'default'
コード例 #3
0
def test_text_cell():
    table = Table((0, 0), 10, 10)
    table.text_cell(8, 8, "test88", span=(2, 2), style="extrastyle")
    cell = table.get_cell(8, 8)
    assert cell.span == (2, 2)
    assert cell.text == "test88"
    assert cell.stylename == "extrastyle"
コード例 #4
0
def test_default_text_cell():
    table = Table((0, 0), 10, 10)
    table.text_cell(0, 0, "test")
    cell = table.get_cell(0, 0)
    assert cell.span == (1, 1)
    assert cell.text == "test"
    assert cell.stylename == "default"
コード例 #5
0
def test_span_beyond_table_borders(dxf):
    layout = dxf.blocks.new('test_span_beyond_table_borders')
    table = Table((0, 0), 3, 3)
    table.text_cell(0, 2, "ERROR", span=(1, 2))
    with pytest.raises(IndexError):
        table.render(layout)
    table.text_cell(2, 0, "ERROR", span=(2, 1))
    with pytest.raises(IndexError):
        table.render(layout)
コード例 #6
0
ファイル: test_802_table.py プロジェクト: yening2020/ezdxf
def test_visibility_map():
    from ezdxf.addons.table import VisibilityMap

    table = Table((0, 0), 3, 3)
    textcell = table.text_cell(0, 0, 'text', span=(2, 2))
    vmap = VisibilityMap(table)
    empty = table.empty_cell
    expected = [(0, 0, textcell), (0, 2, empty),  # cell (0, 1) is covered by (0,0)
                (1, 2, empty),  # cells (1, 0), (1, 2) are coverd by cell (0, 0)
                (2, 0, empty), (2, 1, empty), (2, 2, empty)]  # row 2
    for got, should in zip(table.iter_visible_cells(vmap), expected):
        assert got[0] == should[0]  # row
        assert got[1] == should[1]  # col
        assert got[2] == should[2]  # cell