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

Skip to content

Commit c8077e1

Browse files
committed
Add test for text wrapping
1 parent 3be4aea commit c8077e1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/matplotlib/tests/test_text.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,16 @@ def test_large_subscript_title():
594594
ax.set_xticklabels('')
595595

596596

597+
def test_wrap():
598+
fig = plt.figure(figsize=(6, 4))
599+
s = 'This is a very long text that should be wrapped multiple times.'
600+
text = fig.text(0.7, 0.5, s, wrap=True)
601+
fig.canvas.draw()
602+
assert text._get_wrapped_text() == ('This is a very long text\n'
603+
'that should be wrapped\n'
604+
'multiple times.')
605+
606+
597607
def test_long_word_wrap():
598608
fig = plt.figure(figsize=(6, 4))
599609
text = fig.text(9.5, 8, 'Alonglineoftexttowrap', wrap=True)

0 commit comments

Comments
 (0)