Added a new test for set_color_to_alpha

This commit is contained in:
Blake Thompson 2015-01-15 21:03:42 -06:00
parent 33ccc12355
commit 5bc83eee49

View file

@ -5,7 +5,7 @@ import sys
import os, mapnik
from timeit import Timer, time
from nose.tools import *
from utilities import execution_path, run_all
from utilities import execution_path, run_all, get_unique_colors
def setup():
# All of the paths used are relative, if we run the tests
@ -28,6 +28,13 @@ def test_image_premultiply():
eq_(im.demultiply(), False)
eq_(im.premultiplied(),False)
def test_set_color_to_alpha():
im = mapnik.Image(256,256)
im.background = mapnik.Color('rgba(12,12,12,255)')
eq_(get_unique_colors(im), ['rgba(12,12,12,255)'])
im.set_color_to_alpha(mapnik.Color('rgba(12,12,12,0)'))
eq_(get_unique_colors(im), ['rgba(0,0,0,0)'])
@raises(RuntimeError)
def test_negative_image_dimensions():
# TODO - this may have regressed in https://github.com/mapnik/mapnik/commit/4f3521ac24b61fc8ae8fd344a16dc3a5fdf15af7