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

Skip to content

Commit 272b377

Browse files
committed
Fixed tests to include svg and pdf for figimage
1 parent 22091d6 commit 272b377

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

lib/matplotlib/tests/test_image.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ def test_interp_nearest_vs_none():
7272
ax2.set_title('interpolation nearest')
7373

7474

75-
@image_comparison(baseline_images=['figimage-0', 'figimage-1'], extensions=['png'])
75+
@image_comparison(baseline_images=['figimage-0'],
76+
extensions=['png','svg','pdf'])
7677
def test_figimage():
7778
'test the figimage method'
7879

79-
for suppressComposite in False, True:
80+
for suppressComposite in [False]:
8081
fig = plt.figure(figsize=(2,2), dpi=100)
8182
fig.suppressComposite = suppressComposite
8283
x,y = np.ix_(np.arange(100.0)/100.0, np.arange(100.0)/100.0)
@@ -89,6 +90,25 @@ def test_figimage():
8990
fig.figimage(img[:,::-1], xo=100, yo=0, origin='lower')
9091
fig.figimage(img[::-1,::-1], xo=100, yo=100, origin='lower')
9192

93+
@image_comparison(baseline_images=['figimage-1'],
94+
extensions=['png','svg','pdf'])
95+
def test_figimage():
96+
'test the figimage method'
97+
98+
for suppressComposite in [True]:
99+
fig = plt.figure(figsize=(2,2), dpi=100)
100+
fig.suppressComposite = suppressComposite
101+
x,y = np.ix_(np.arange(100.0)/100.0, np.arange(100.0)/100.0)
102+
z = np.sin(x**2 + y**2 - x*y)
103+
c = np.sin(20*x**2 + 50*y**2)
104+
img = z + c/5
105+
106+
fig.figimage(img, xo=0, yo=0, origin='lower')
107+
fig.figimage(img[::-1,:], xo=0, yo=100, origin='lower')
108+
fig.figimage(img[:,::-1], xo=100, yo=0, origin='lower')
109+
fig.figimage(img[::-1,::-1], xo=100, yo=100, origin='lower')
110+
111+
92112
def test_image_python_io():
93113
fig = plt.figure()
94114
ax = fig.add_subplot(111)

0 commit comments

Comments
 (0)