Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better output from pure white raster test checking since this is abou…

…t to start failing due to premultiplied rounding - refs #1508
  • Loading branch information...
commit 1dfbd1e4bfdbc1e6621ec86626b872c9b0422386 1 parent 0b9ebe2
Dane Springmeyer springmeyer authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 tests/python_tests/raster_symbolizer_test.py
18 tests/python_tests/raster_symbolizer_test.py
View
@@ -103,6 +103,22 @@ def test_load_save_map():
if not 'Could not create datasource' in str(e):
raise RuntimeError(str(e))
+def pixel2rgba(pixel):
+ alpha = (pixel >> 24) & 0xff
+ red = pixel & 0xff
+ green = (pixel >> 8) & 0xff
+ blue = (pixel >> 16) & 0xff
+ return 'rgba(%s,%s,%s,%s)' % (red,green,blue,alpha)
+
+def get_unique_colors(im):
+ pixels = []
+ for x in range(im.width()):
+ for y in range(im.height()):
+ pixel = im.get_pixel(x,y)
+ if pixel not in pixels:
+ pixels.append(pixel)
+ return map(pixel2rgba,pixels)
+
def test_raster_with_alpha_blends_correctly_with_background():
WIDTH = 500
HEIGHT = 500
@@ -135,7 +151,7 @@ def test_raster_with_alpha_blends_correctly_with_background():
mapnik.render(map, mim)
imdata = mim.tostring()
# All white is expected
- assert contains_word('\xff\xff\xff\xff', imdata)
+ eq_(contains_word('\xff\xff\xff\xff', imdata),True,'Image expected to contain true white, instead found %s' % get_unique_colors(mim))
def test_raster_warping():
lyrSrs = "+init=epsg:32630"
Please sign in to comment.
Something went wrong with that request. Please try again.