1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
# Created: 06.2020
# Copyright (c) 2020, Matthew Broadway
# License: MIT License
import pytest
plt = pytest.importorskip("matplotlib.pyplot")
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
@pytest.fixture()
def backend():
fig, ax = plt.subplots()
return MatplotlibBackend(ax)
def test_get_text_width(backend):
assert backend.get_text_line_width(
" abc", 100
) > backend.get_text_line_width("abc", 100)
assert backend.get_text_line_width(
" abc ", 100
) == backend.get_text_line_width(" abc", 100)
assert backend.get_text_line_width(" ", 100) == 0
assert backend.get_text_line_width(" ", 100) == 0
|