Add test for parameter rendering.

This commit is contained in:
Young Hahn 2012-04-30 02:48:22 -04:00
parent 795f2c82d0
commit b644e9588b
3 changed files with 55 additions and 4 deletions

View File

@ -86,15 +86,18 @@ carto.Renderer.prototype.render = function render(m, callback) {
// Non URL-bound TileJSON properties. // Non URL-bound TileJSON properties.
case 'bounds': case 'bounds':
case 'center': case 'center':
case 'minzoom':
case 'maxzoom':
case 'version':
memo.push(' <Parameter name="' + k + '">' + v + '</Parameter>');
break;
// Properties that require CDATA.
case 'name': case 'name':
case 'description': case 'description':
case 'legend': case 'legend':
case 'attribution': case 'attribution':
case 'template': case 'template':
case 'minzoom': memo.push(' <Parameter name="' + k + '"><![CDATA[' + v + ']]></Parameter>');
case 'maxzoom':
case 'version':
memo.push(' <Parameter name="' + k + '">' + v + '</Parameter>');
break; break;
// Mapnik image format. // Mapnik image format.
case 'format': case 'format':

View File

@ -0,0 +1,28 @@
{
"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",
"bounds": [-180,-85,180,85],
"center": [-78,40,8],
"name": "Parameters",
"description": "Mapnik parameter test.",
"legend": "<p>This is HTML.</p>",
"attribution": "<a href='http://openstreetmap.org'>OpenStreetMap</a>",
"template": "<b>{{NAME}}</b>",
"minzoom": 0,
"maxzoom": 12,
"version": "1.0.0",
"format": "png",
"interactivity": {
"layer": "world",
"fields": ["NAME"]
},
"omitted": "Omitted property.",
"Stylesheet": [],
"Layer": [{
"name": "world",
"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",
"Datasource": {
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
"type": "shape"
}
}]
}

View File

@ -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">
<Parameters>
<Parameter name="bounds">-180,-85,180,85</Parameter>
<Parameter name="center">-78,40,8</Parameter>
<Parameter name="name"><![CDATA[Parameters]]></Parameter>
<Parameter name="description"><![CDATA[Mapnik parameter test.]]></Parameter>
<Parameter name="legend"><![CDATA[<p>This is HTML.</p>]]></Parameter>
<Parameter name="attribution"><![CDATA[<a href='http://openstreetmap.org'>OpenStreetMap</a>]]></Parameter>
<Parameter name="template"><![CDATA[<b>{{NAME}}</b>]]></Parameter>
<Parameter name="minzoom">0</Parameter>
<Parameter name="maxzoom">12</Parameter>
<Parameter name="version">1.0.0</Parameter>
<Parameter name="format">png</Parameter>
<Parameter name="interactivity_layer">world</Parameter>
<Parameter name="interactivity_fields">NAME</Parameter>
</Parameters>
</Map>