improve png comparison tests
|
@ -42,8 +42,10 @@ combinations = ['png',
|
||||||
'png:z=1:s=filtered',
|
'png:z=1:s=filtered',
|
||||||
'png:z=1:s=huff',
|
'png:z=1:s=huff',
|
||||||
'png:z=1:s=rle',
|
'png:z=1:s=rle',
|
||||||
'png:m=h;g=2.0',
|
'png:m=h:g=2.0',
|
||||||
'png:m=h;g=1.0',
|
'png:m=h:g=1.0',
|
||||||
|
'png:e=miniz',
|
||||||
|
'png8:e=miniz'
|
||||||
]
|
]
|
||||||
|
|
||||||
tiles = [
|
tiles = [
|
||||||
|
|
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 103 B |
After Width: | Height: | Size: 103 B |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 103 B |
After Width: | Height: | Size: 103 B |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 103 B |
After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
After Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 116 B |
After Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 200 B |
|
@ -32,6 +32,8 @@ if mapnik.has_png():
|
||||||
'png8:m=h:c=1:t=0',
|
'png8:m=h:c=1:t=0',
|
||||||
'png8:m=h:t=1',
|
'png8:m=h:t=1',
|
||||||
'png8:m=h:t=2',
|
'png8:m=h:t=2',
|
||||||
|
'png:e=miniz',
|
||||||
|
'png8:e=miniz'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Todo - use itertools.product
|
# Todo - use itertools.product
|
||||||
|
@ -44,6 +46,7 @@ if mapnik.has_png():
|
||||||
generate = False
|
generate = False
|
||||||
|
|
||||||
def test_expected_encodings():
|
def test_expected_encodings():
|
||||||
|
# blank image
|
||||||
im = mapnik.Image(256,256)
|
im = mapnik.Image(256,256)
|
||||||
for opt in opts:
|
for opt in opts:
|
||||||
expected = gen_filepath('solid',opt)
|
expected = gen_filepath('solid',opt)
|
||||||
|
@ -53,10 +56,12 @@ if mapnik.has_png():
|
||||||
im.save(expected,opt)
|
im.save(expected,opt)
|
||||||
else:
|
else:
|
||||||
im.save(actual,opt)
|
im.save(actual,opt)
|
||||||
eq_(mapnik.Image.open(actual).tostring(),
|
eq_(mapnik.Image.open(actual).tostring(),
|
||||||
mapnik.Image.open(expected).tostring(),
|
mapnik.Image.open(expected).tostring(),
|
||||||
'%s (actual) not == to %s (expected)' % (actual,expected))
|
'%s (actual) not == to %s (expected)' % (actual,expected))
|
||||||
|
|
||||||
|
# solid image
|
||||||
|
im.background = mapnik.Color('green');
|
||||||
for opt in opts:
|
for opt in opts:
|
||||||
expected = gen_filepath('blank',opt)
|
expected = gen_filepath('blank',opt)
|
||||||
actual = os.path.join(tmp_dir,os.path.basename(expected))
|
actual = os.path.join(tmp_dir,os.path.basename(expected))
|
||||||
|
@ -65,7 +70,21 @@ if mapnik.has_png():
|
||||||
im.save(expected,opt)
|
im.save(expected,opt)
|
||||||
else:
|
else:
|
||||||
im.save(actual,opt)
|
im.save(actual,opt)
|
||||||
eq_(mapnik.Image.open(actual).tostring(),
|
eq_(mapnik.Image.open(actual).tostring(),
|
||||||
|
mapnik.Image.open(expected).tostring(),
|
||||||
|
'%s (actual) not == to %s (expected)' % (actual,expected))
|
||||||
|
|
||||||
|
# aerial
|
||||||
|
im = mapnik.Image.open('./images/support/transparency/aerial_rgba.png')
|
||||||
|
for opt in opts:
|
||||||
|
expected = gen_filepath('aerial_rgba',opt)
|
||||||
|
actual = os.path.join(tmp_dir,os.path.basename(expected))
|
||||||
|
if generate or not os.path.exists(expected):
|
||||||
|
print 'generating expected image %s' % expected
|
||||||
|
im.save(expected,opt)
|
||||||
|
else:
|
||||||
|
im.save(actual,opt)
|
||||||
|
eq_(mapnik.Image.open(actual).tostring(),
|
||||||
mapnik.Image.open(expected).tostring(),
|
mapnik.Image.open(expected).tostring(),
|
||||||
'%s (actual) not == to %s (expected)' % (actual,expected))
|
'%s (actual) not == to %s (expected)' % (actual,expected))
|
||||||
|
|
||||||
|
|