Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3be4aea

Browse files
committed
Add text wrapping tests
1 parent dfb458e commit 3be4aea

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/matplotlib/tests/test_text.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,3 +592,17 @@ def test_large_subscript_title():
592592
tt.set_position((x, 1.01))
593593
ax.set_title('Old Way', loc='left')
594594
ax.set_xticklabels('')
595+
596+
597+
def test_long_word_wrap():
598+
fig = plt.figure(figsize=(6, 4))
599+
text = fig.text(9.5, 8, 'Alonglineoftexttowrap', wrap=True)
600+
fig.canvas.draw()
601+
assert text._get_wrapped_text() == 'Alonglineoftexttowrap'
602+
603+
604+
def test_wrap_no_wrap():
605+
fig = plt.figure(figsize=(6, 4))
606+
text = fig.text(0, 0, 'non wrapped text', wrap=True)
607+
fig.canvas.draw()
608+
assert text._get_wrapped_text() == 'non wrapped text'

0 commit comments

Comments
 (0)