1# Copyright (c) 2019-2020 Manfred Moitzi
2# License: MIT License
3import ezdxf
4from ezdxf.render.arrows import ARROWS
5from ezdxf.layouts import VirtualLayout
6
7
8def test_filled_solid_arrow():
9    # special name: no name ""
10    assert "" in ARROWS
11    ARROWS.is_acad_arrow("")
12
13
14def test_arrow_name():
15    assert ARROWS.arrow_name('_CLOSEDFILLED') == ''
16    assert ARROWS.arrow_name('') == ''
17    assert ARROWS.arrow_name('_DOTSMALL') == 'DOTSMALL'
18    assert ARROWS.arrow_name('_boxBlank') == 'BOXBLANK'
19    assert ARROWS.arrow_name('EZ_ARROW') == 'EZ_ARROW'
20    assert ARROWS.arrow_name('abcdef') == 'abcdef'
21
22
23def test_closed_arrow_doc_r12():
24    doc = ezdxf.new(dxfversion='R12', setup=True)
25    blocks = doc.blocks
26    name = ARROWS.create_block(blocks, ARROWS.closed)
27    arrow_entities = list(blocks.get(name))
28    assert arrow_entities[0].dxftype() == 'POLYLINE'
29
30
31def test_closed_arrow_doc_r2000():
32    doc = ezdxf.new(dxfversion='R2000', setup=True)
33    blocks = doc.blocks
34    name = ARROWS.create_block(blocks, ARROWS.closed)
35    arrow_entities = list(blocks.get(name))
36    assert arrow_entities[0].dxftype() == 'LWPOLYLINE'
37
38
39def test_render_arrow():
40    layout = VirtualLayout()
41    ARROWS.render_arrow(layout, ARROWS.closed, insert=(0, 0, 0))
42    assert len(layout) > 0
43
44
45def test_virtual_entities():
46    entities = list(ARROWS.virtual_entities(ARROWS.closed, insert=(0, 0, 0)))
47    assert len(entities) > 0
48