Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
update test to trigger the bug, fix #411, by not using simplified reg…
Browse files Browse the repository at this point in the history
…ex to parse floats
  • Loading branch information
nebulon42 committed Dec 26, 2016
1 parent 40e4533 commit 9be4e86
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/carto/tree/filterset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var tree = require('../tree');
var tree = require('../tree'),
_ = require('lodash');

tree.Filterset = function Filterset() {
this.filters = {};
Expand Down Expand Up @@ -100,7 +101,9 @@ tree.Filterset.prototype.addable = function(filter) {
var key = filter.key.toString(),
value = filter.val.toString();

if (value.match(/^[+-]?[0-9]+(\.[0-9]*)?$/)) value = parseFloat(value);
if (!_.isNaN(parseFloat(value))) {
value = parseFloat(value);
}

switch (filter.op) {
case '=':
Expand Down
6 changes: 5 additions & 1 deletion test/rendering/issue_411.mss
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#test {
[zoom >= 3][way_pixels > 0.00000010000][way_pixels < 0.00003600000] {
text-face-name: "Arial";
text-name: "[name]";
text-size: 10;
[zoom >= 4] {
text-size: 11;
}
text-fill: #ff0000;
text-face-name: 'Arial';
}
}
8 changes: 7 additions & 1 deletion test/rendering/issue_411.result
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@


<Style name="test" filter-mode="first">
<Rule>
<MaxScaleDenominator>50000000</MaxScaleDenominator>
<Filter>([way_pixels] > 1e-7) and ([way_pixels] < 0.000036)</Filter>
<TextSymbolizer face-name="Arial" size="11" text="[name]" fill="#ff0000"/>
</Rule>
<Rule>
<MaxScaleDenominator>100000000</MaxScaleDenominator>
<MinScaleDenominator>50000000</MinScaleDenominator>
<Filter>([way_pixels] > 1e-7) and ([way_pixels] < 0.000036)</Filter>
<TextSymbolizer face-name="Arial" size="10" text="[name]"/>
<TextSymbolizer face-name="Arial" size="10" text="[name]" fill="#ff0000"/>
</Rule>
</Style>
<Layer
Expand Down

0 comments on commit 9be4e86

Please sign in to comment.