8000 TST: add tighbbox tests · matplotlib/matplotlib@f93b291 · GitHub
[go: up one dir, main page]

Skip to content

Commit f93b291

Browse files
committed
TST: add tighbbox tests
1 parent 68cf458 commit f93b291

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/matplotlib/tests/test_figure.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,14 @@ def test_figure_repr():
382382
def test_fspath(fmt):
383383
from pathlib import Path
384384
plt.savefig(Path(os.devnull), format=fmt)
385+
386+
387+
def test_tightbbox():
388+
fig, ax = plt.subplots()
389+
ax.set_xlim(0, 1)
390+
t = ax.text(1., 0.5, 'This dangles over end')
391+
renderer = fig.canvas.get_renderer()
392+
assert t.get_tightbbox(renderer).x1 == 1445.625
393+
assert ax.get_tightbbox(renderer).x1 == 1445.625
394+
assert np.abs(fig.get_tightbbox(renderer).x1 - 9.035) < 0.002
395+
assert np.abs(fig.get_tightbbox(renderer).x0 - 0.679) < 0.002

0 commit comments

Comments
 (0)
0