Skip to content

Commit d256e47

Browse files
authored
Merge pull request matplotlib#25733 from oscargus/wraptext
Add tests for missing text wrap cases
2 parents e631edb + e471b3f commit d256e47

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: lib/matplotlib/tests/test_text.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,16 @@ def test_large_subscript_title():
690690
ax.set_xticklabels([])
691691

692692

693-
def test_wrap():
694-
fig = plt.figure(figsize=(6, 4))
693+
@pytest.mark.parametrize(
694+
"x, rotation, halign",
695+
[(0.7, 0, 'left'),
696+
(0.5, 95, 'left'),
697+
(0.3, 0, 'right'),
698+
(0.3, 185, 'left')])
699+
def test_wrap(x, rotation, halign):
700+
fig = plt.figure(figsize=(6, 6))
695701
s = 'This is a very long text that should be wrapped multiple times.'
696-
text = fig.text(0.7, 0.5, s, wrap=True)
702+
text = fig.text(x, 0.7, s, wrap=True, rotation=rotation, ha=halign)
697703
fig.canvas.draw()
698704
assert text._get_wrapped_text() == ('This is a very long\n'
699705
'text that should be\n'

0 commit comments

Comments
 (0)