Permalink
Browse files

start moving raster visual tests into place (add new,currently failin…

…g tests for raster.input)
  • Loading branch information...
1 parent 940bb98 commit 794f5e369a44beabc62fa3042bbe5ed43538ee42 Dane Springmeyer committed Sep 26, 2012
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-
-from nose.tools import *
-from utilities import execution_path
-
-import os, 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('.'))
-
-if 'gdal' in mapnik.DatasourceCache.plugin_names():
-
- def test_map_alpha_compare():
- m = mapnik.Map(600,400)
- mapnik.load_map(m,'../data/good_maps/raster-alpha.xml')
- m.zoom_all()
- actual = '/tmp/mapnik-raster-alpha.png'
- expected = 'images/support/raster-alpha.png'
- im = mapnik.Image(m.width,m.height)
- mapnik.render(m,im)
- im.save(actual)
- expected_im = mapnik.Image.open(expected)
- eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
-
- def test_map_alpha_gradient_compare():
- m = mapnik.Map(600,400)
- mapnik.load_map(m,'../data/good_maps/raster-alpha-gradient.xml')
- m.zoom_all()
- actual = '/tmp/mapnik-raster-alpha-gradient.png'
- expected = 'images/support/raster-alpha-gradient.png'
- im = mapnik.Image(m.width,m.height)
- mapnik.render(m,im)
- im.save(actual)
- expected_im = mapnik.Image.open(expected)
- eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
-
- # there should be no gray edges on raster
- # https://github.com/mapnik/mapnik/issues/1471
- def test_edge_scaling_with_nodata():
- m = mapnik.Map(600,400)
- mapnik.load_map(m,'../data/good_maps/raster-nodata-edge.xml')
- m.zoom_all()
- actual = '/tmp/mapnik-raster-nodata-edge.png'
- expected = 'images/support/raster-nodata-edge.png'
- im = mapnik.Image(m.width,m.height)
- mapnik.render(m,im)
- im.save(actual)
- expected_im = mapnik.Image.open(expected)
- eq_(im.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]
@@ -1,2 +1 @@
-*-agg.png
*-out.xml
@@ -1,3 +1,2 @@
-rm -f images/*-agg.png
rm -f xml_output/*-out.xml
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -11,7 +11,7 @@
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>white</StyleName>
<Datasource>
- <Parameter name="file">../raster/white-alpha.tiff</Parameter>
+ <Parameter name="file">../../data/raster/white-alpha.tiff</Parameter>
<Parameter name="type">gdal</Parameter>
</Datasource>
</Layer>
@@ -11,7 +11,7 @@
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>transp</StyleName>
<Datasource>
- <Parameter name="file">../raster/transp.tiff</Parameter>
+ <Parameter name="file">../../data/raster/transp.tiff</Parameter>
<Parameter name="type">gdal</Parameter>
</Datasource>
</Layer>
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE Map[]>
+<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="blue">
+
+<Style name="transp">
+ <Rule>
+ <RasterSymbolizer opacity="1" scaling="bilinear" />
+ </Rule>
+</Style>
+<Layer name="transp"
+ srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
+ <StyleName>transp</StyleName>
+ <Datasource>
+ <Parameter name="file">../../data/raster/transp.tiff</Parameter>
+ <Parameter name="type">raster</Parameter>
+ <Parameter name="extent">0,0,256,256</Parameter>
+ </Datasource>
+ </Layer>
+
+</Map>
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE Map[]>
+<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="red">
+
+<Style name="white">
+ <Rule>
+ <RasterSymbolizer opacity="1" scaling="bilinear" comp-op="src-over"/>
+ </Rule>
+</Style>
+<Layer name="white"
+ srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
+ <StyleName>white</StyleName>
+ <Datasource>
+ <Parameter name="file">../../data/raster/white-alpha.tiff</Parameter>
+ <Parameter name="type">raster</Parameter>
+ <Parameter name="extent">1001859.9561,5922814.94334,1021141.75555,5942096.74279</Parameter>
+ </Datasource>
+ </Layer>
+
+</Map>
@@ -12,7 +12,7 @@
<StyleName>style</StyleName>
<Datasource>
<!-- https://github.com/mapnik/mapnik/issues/1471 -->
- <Parameter name="file">../raster/nodata-edge.tif</Parameter>
+ <Parameter name="file">../../data/raster/nodata-edge.tif</Parameter>
<Parameter name="type">gdal</Parameter>
</Datasource>
</Layer>
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE Map[]>
+<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="#F0CCAC">
+
+<Style name="style" >
+ <Rule>
+ <RasterSymbolizer opacity="1" />
+ </Rule>
+</Style>
+<Layer name="raster"
+ srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
+ <StyleName>style</StyleName>
+ <Datasource>
+ <!-- https://github.com/mapnik/mapnik/issues/1471 -->
+ <Parameter name="file">../../data/raster/nodata-edge.tif</Parameter>
+ <Parameter name="type">raster</Parameter>
+ <Parameter name="extent">-12329035.765216826,4508650.398543958,-12328653.027947057,4508957.346255356</Parameter>
+ </Datasource>
+ </Layer>
+
+</Map>
@@ -47,6 +47,9 @@
{'name': "line-offset", 'sizes':[(900, 250)],'bbox': mapnik.Box2d(-5.192, 50.189, -5.174, 50.195)},
{'name': "tiff-alpha-gdal", 'sizes':[(600,400)]},
{'name': "tiff-alpha-raster", 'sizes':[(600,400)]},
+ {'name': "tiff-alpha-gradient-gdal", 'sizes':[(600,400)]},
+ {'name': "tiff-nodata-edge-gdal", 'sizes':[(600,400)]},
+ {'name': "tiff-nodata-edge-raster", 'sizes':[(600,400)]},
]
def render(filename, width, height, bbox, quiet=False):

0 comments on commit 794f5e3

Please sign in to comment.