tests for compositing operations
28
tests/python_tests/compositing_test.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
#encoding: utf8
|
||||
|
||||
from nose.tools import *
|
||||
import os,sys
|
||||
from utilities import execution_path
|
||||
from utilities import Todo
|
||||
import mapnik
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
# from another directory we need to chdir()
|
||||
os.chdir(execution_path('.'))
|
||||
|
||||
def test_compare_images():
|
||||
b = mapnik.Image.open('./images/support/b.png')
|
||||
for name in mapnik.CompositeOp.names:
|
||||
a = mapnik.Image.open('./images/support/a.png')
|
||||
a.composite(b,getattr(mapnik.CompositeOp,name))
|
||||
actual = '/tmp/mapnik-comp-op-test-' + name + '.png'
|
||||
expected = 'images/composited/' + name + '.png'
|
||||
a.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
# compare them
|
||||
eq_(a.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
BIN
tests/python_tests/images/composited/clear.png
Normal file
After Width: | Height: | Size: 334 B |
BIN
tests/python_tests/images/composited/color_burn.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/color_dodge.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
tests/python_tests/images/composited/contrast.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
tests/python_tests/images/composited/darken.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/difference.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/dst.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
tests/python_tests/images/composited/dst_atop.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
tests/python_tests/images/composited/dst_in.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
tests/python_tests/images/composited/dst_out.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
tests/python_tests/images/composited/dst_over.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
tests/python_tests/images/composited/exclusion.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/hard_light.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/invert.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
tests/python_tests/images/composited/invert_rgb.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
tests/python_tests/images/composited/lighten.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
tests/python_tests/images/composited/minus.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
tests/python_tests/images/composited/multiply.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/overlay.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/plus.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
tests/python_tests/images/composited/screen.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
tests/python_tests/images/composited/soft_light.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/python_tests/images/composited/src.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
tests/python_tests/images/composited/src_atop.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
tests/python_tests/images/composited/src_in.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
tests/python_tests/images/composited/src_out.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
tests/python_tests/images/composited/src_over.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
tests/python_tests/images/composited/xor.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
tests/python_tests/images/support/a.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
tests/python_tests/images/support/b.png
Normal file
After Width: | Height: | Size: 1.3 KiB |