8000 TST: tweak add_artist_test to make svgs output clearer · matplotlib/matplotlib@697c519 · GitHub
[go: up one dir, main page]

Skip to content

Commit 697c519

Browse files
committed
TST: tweak add_artist_test to make svgs output clearer
- add gid to artists to make SVG more readable - make sure zorder is identical This makes the diff between the expected and produced svgs readable. The svg tests passes locally (inkscape 0.92) and on other travis runs (inkscape 0.48). Fails on travis with inkscape 0.91
1 parent 885e634 commit 697c519

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lib/matplotlib/tests/test_figure.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,22 +389,25 @@ def test_add_artist(fig_test, fig_ref):
389389
fig_ref.set_dpi(100)
390390

391391
ax = fig_test.subplots()
392-
l1 = plt.Line2D([.2, .7], [.7, .7])
393-
l2 = plt.Line2D([.2, .7], [.8, .8])
394-
r1 = plt.Circle((20, 20), 100, transform=None)
395-
r2 = plt.Circle((.7, .5), .05)
392+
l1 = plt.Line2D([.2, .7], [.7, .7], gid='l1')
393+
l2 = plt.Line2D([.2, .7], [.8, .8], gid='l2')
394+
r1 = plt.Circle((20, 20), 100, transform=None, gid='C1')
395+
r2 = plt.Circle((.7, .5), .05, gid='C2')
396396
r3 = plt.Circle((4.5, .8), .55, transform=fig_test.dpi_scale_trans,
397-
facecolor='crimson')
397+
facecolor='crimson', gid='C3')
398398
for a in [l1, l2, r1, r2, r3]:
399399
fig_test.add_artist(a)
400400
l2.remove()
401401

402402
ax2 = fig_ref.subplots()
403-
l1 = plt.Line2D([.2, .7], [.7, .7], transform=fig_ref.transFigure)
404-
r1 = plt.Circle((20, 20), 100, transform=None, clip_on=False, zorder=20)
405-
r2 = plt.Circle((.7, .5), .05, transform=fig_ref.transFigure)
403+
l1 = plt.Line2D([.2, .7], [.7, .7], transform=fig_ref.transFigure,
404+
gid='l1', zorder=21)
405+
r1 = plt.Circle((20, 20), 100, transform=None, clip_on=False, zorder=20,
406+
gid='C1')
407+
r2 = plt.Circle((.7, .5), .05, transform=fig_ref.transFigure, gid='C2',
408+
zorder=20)
406409
r3 = plt.Circle((4.5, .8), .55, transform=fig_ref.dpi_scale_trans,
407-
facecolor='crimson', clip_on=False, zorder=20)
410+
facecolor='crimson', clip_on=False, zorder=20, gid='C3')
408411
for a in [l1, r1, r2, r3]:
409412
ax2.add_artist(a)
410413

0 commit comments

Comments
 (0)
0