Exemple #1
0
def test_default_new():
    entity = Leader.new(
        handle="ABBA",
        owner="0",
        dxfattribs={
            "color": 7,
        },
    )
    assert entity.dxf.layer == "0"
    assert entity.dxf.color == 7
    assert entity.dxf.dimstyle == "Standard"
    assert entity.dxf.has_arrowhead == 1
    assert entity.dxf.path_type == 0
    assert entity.dxf.annotation_type == 3
    assert entity.dxf.hookline_direction == 1
    assert entity.dxf.has_hookline == 1
    assert entity.dxf.text_height == 1
    assert entity.dxf.text_width == 1
    assert entity.dxf.block_color == 7
    assert entity.dxf.annotation_handle == "0"
    assert entity.dxf.normal_vector == (0, 0, 1)
    assert entity.dxf.horizontal_direction == (1, 0, 0)
    assert entity.dxf.leader_offset_block_ref == (0, 0, 0)
    assert entity.dxf.leader_offset_annotation_placement == (0, 0, 0)
    assert len(entity.vertices) == 0
Exemple #2
0
def test_virtual_sub_entities_source_tracking():
    leader = Leader.new()
    leader.vertices = VERTICES

    result = set(e.source_of_copy for e in leader.virtual_entities())
    assert len(result) == 1, "only one source of copy expected"
    assert leader in result, "lwpolyline should be the source of copy"
Exemple #3
0
def test_virtual_etities():
    leader = Leader.new()
    leader.vertices = [
        (0, 0, 0),
        (1, 1, 0),
        (2, 1, 0),
    ]
    result = list(leader.virtual_entities())
    assert len(result) == 2
Exemple #4
0
def test_leader_to_code():
    from ezdxf.entities.leader import Leader
    entity = Leader.new(handle='ABBA', owner='0', dxfattribs={
        'color': '7',
    })
    entity.set_vertices([
        (1, 2, 0, 0, 0),
        (4, 3, 0, 0, 0),
        (7, 8, 0, 0, 0),
    ])
    new_entity = translate_to_code_and_execute(entity)
    assert new_entity.dxf.color == entity.dxf.color
    for np, ep in zip(new_entity.vertices, entity.vertices):
        assert np == ep
Exemple #5
0
def test_supports_virtual_entities_protocol():
    leader = Leader.new()
    leader.vertices = VERTICES
    assert isinstance(leader, SupportsVirtualEntities)
    assert len(query_virtual_entities(leader)) == 2