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

Skip to content

Commit ac535a1

Browse files
dikshajangra12918-ossapple
authored andcommitted
Add test_annotation_patchA_not_overridden function
Add test to verify that manually set patchA on annotation arrow is preserved after draw.
1 parent 92543f9 commit ac535a1

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lib/matplotlib/tests/test_text.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,4 +1330,18 @@ def test_draw_text_as_path_fallback(monkeypatch):
13301330
subfig = fig.subfigures(3, 1, height_ratios=heights)
13311331
_test_complex_shaping(subfig[0])
13321332
_test_text_features(subfig[1])
1333-
_test_text_language(subfig[2])
1333+
_test_text_language(subfig[2])
1334+
def test_annotation_patchA_not_overridden():
1335+
# Test that manually setting patchA on annotation arrow is not overridden by update_positions. See GitHub issue #28316.
1336+
fig, ax = plt.subplots()
1337+
ann = ax.annotate(
1338+
'',
1339+
xy=(0.5, 0.6),
1340+
xytext=(0.2, 0.5),
1341+
arrowprops=dict(arrowstyle="->")
1342+
)
1343+
text = ax.text(0.2, 0.5, 'Text', ha='center', va='center')
1344+
ann.arrow_patch.set_patchA(text)
1345+
fig.draw_without_rendering()
1346+
assert ann.arrow_patch.patchA is text
1347+

0 commit comments

Comments
 (0)