Add unsigned support and test code
This commit is contained in:
parent
f4132221d6
commit
829fe84baf
@ -24,6 +24,10 @@ tree.Dimension.prototype = {
|
||||
toColor: function() {
|
||||
return new tree.Color([this.value, this.value, this.value]);
|
||||
},
|
||||
round: function() {
|
||||
this.value = Math.round(this.value);
|
||||
return this;
|
||||
},
|
||||
toString: function() {
|
||||
return this.value.toString();
|
||||
},
|
||||
|
@ -173,8 +173,15 @@ tree.Reference.validValue = function(env, selector, value) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (tree.Reference.selector(selector).type == 'expression') {
|
||||
} else if (tree.Reference.selector(selector).type === 'expression') {
|
||||
return true;
|
||||
} else if (tree.Reference.selector(selector).type === 'unsigned') {
|
||||
if (value.value[0].is === 'float') {
|
||||
value.value[0].round();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (tree.Reference.selector(selector).validate) {
|
||||
var valid = false;
|
||||
|
14
test/rendering/unsigned.mml
Normal file
14
test/rendering/unsigned.mml
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"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",
|
||||
"Stylesheet": [
|
||||
"unsigned.mss"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}]
|
||||
}
|
6
test/rendering/unsigned.mss
Normal file
6
test/rendering/unsigned.mss
Normal file
@ -0,0 +1,6 @@
|
||||
#world {
|
||||
text-size:10.5;
|
||||
text-spacing:12.1;
|
||||
text-name:[FOO];
|
||||
text-face-name:'Foo';
|
||||
}
|
20
test/rendering/unsigned.result
Normal file
20
test/rendering/unsigned.result
Normal 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" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
||||
|
||||
|
||||
<Style name="world" filter-mode="first" >
|
||||
<Rule>
|
||||
<TextSymbolizer size="11" spacing="12" face-name="Foo" ><![CDATA[[FOO]]]></TextSymbolizer>
|
||||
</Rule>
|
||||
</Style>
|
||||
<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">
|
||||
<StyleName>world</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||
<Parameter name="type"><![CDATA[shape]]></Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
</Map>
|
Loading…
Reference in New Issue
Block a user