Skip to content

Commit 9c0eef0

Browse files
committed
Move the pngsuite test (which tests the PNG reader code) into the regression test framework.
1 parent 582f287 commit 9c0eef0

21 files changed

+667
-29
lines changed

examples/tests/pngsuite/pngsuite.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

examples/tests/pngsuite/truth.png

-40 KB
Binary file not shown.
Binary file not shown.
Loading

lib/matplotlib/tests/baseline_images/test_png/pngsuite.svg

Lines changed: 638 additions & 0 deletions
Loading

lib/matplotlib/tests/test_png.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from matplotlib.testing.decorators import image_comparison, knownfailureif
2+
from matplotlib import pyplot as plt
3+
import matplotlib.cm as cm
4+
import glob
5+
import os
6+
7+
@image_comparison(baseline_images=['pngsuite'])
8+
def test_pngsuite():
9+
dirname = os.path.join(
10+
os.path.dirname(__file__),
11+
'baseline_images',
12+
'pngsuite')
13+
files = glob.glob(os.path.join(dirname, 'basn*.png'))
14+
files.sort()
15+
16+
fig = plt.figure(figsize=(len(files), 2))
17+
18+
for i, fname in enumerate(files):
19+
data = plt.imread(fname)
20+
cmap = None # use default colormap
21+
if data.ndim==2:
22+
# keep grayscale images gray
23+
cmap = cm.gray
24+
plt.imshow(data, extent=[i,i+1,0,1], cmap=cmap)
25+
26+
plt.gca().get_frame().set_facecolor("#ddffff")
27+
plt.gca().set_xlim(0, len(files))
28+
29+
fig.savefig('pngsuite')

0 commit comments

Comments
 (0)