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

Skip to content

Commit c2dc353

Browse files
committed
Add location codes test for AnchoredOffsetBox
1 parent 74023b1 commit c2dc353

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

lib/matplotlib/tests/test_offsetbox.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,27 @@ def test_offsetbox_clip_children():
8282
da.clip_children = True
8383
assert_true(fig.stale)
8484

85+
86+
@cleanup
87+
def test_offsetbox_loc_codes():
88+
# Check that valid string location codes all work with an AnchoredOffsetbox
89+
codes = {'upper right': 1,
90+
'upper left': 2,
91+
'lower left': 3,
92+
'lower right': 4,
93+
'right': 5,
94+
'center left': 6,
95+
'center right': 7,
96+
'lower center': 8,
97+
'upper center': 9,
98+
'center': 10,
99+
}
100+
fig, ax = plt.subplots()
101+
da = DrawingArea(100, 100)
102+
for code in codes:
103+
anchored_box = AnchoredOffsetbox(loc=code, child=da)
104+
ax.add_artist(anchored_box)
105+
fig.canvas.draw()
106+
85107
if __name__ == '__main__':
86108
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)