Prepare for mapnik-2.2.0 support (#78)
- Tolerate change in CartoCSS error message between 0.9.3 and 0.9.5 - Expect default style to be different for mapnik-2.2.0+ target
This commit is contained in:
parent
2f74a080ee
commit
a8fef04455
@ -21,13 +21,20 @@ suite('server', function() {
|
|||||||
var redis_client = redis.createClient(global.environment.redis.port);
|
var redis_client = redis.createClient(global.environment.redis.port);
|
||||||
var sqlapi_server;
|
var sqlapi_server;
|
||||||
|
|
||||||
var default_style = semver.satisfies(mapnik.versions.mapnik, '<2.1.0')
|
var mapnik_version = global.environment.mapnik_version || mapnik.versions.mapnik;
|
||||||
?
|
var default_style;
|
||||||
|
if ( semver.satisfies(mapnik_version, '<2.1.0') ) {
|
||||||
// 2.0.0 default
|
// 2.0.0 default
|
||||||
'#<%= table %>{marker-fill: #FF6600;marker-opacity: 1;marker-width: 8;marker-line-color: white;marker-line-width: 3;marker-line-opacity: 0.9;marker-placement: point;marker-type: ellipse;marker-allow-overlap: true;}'
|
default_style = '#<%= table %>{marker-fill: #FF6600;marker-opacity: 1;marker-width: 8;marker-line-color: white;marker-line-width: 3;marker-line-opacity: 0.9;marker-placement: point;marker-type: ellipse;marker-allow-overlap: true;}';
|
||||||
:
|
}
|
||||||
|
else if ( semver.satisfies(mapnik_version, '<2.2.0') ) {
|
||||||
// 2.1.0 default
|
// 2.1.0 default
|
||||||
'#<%= table %>[mapnik-geometry-type=1] {marker-fill: #FF6600;marker-opacity: 1;marker-width: 16;marker-line-color: white;marker-line-width: 3;marker-line-opacity: 0.9;marker-placement: point;marker-type: ellipse;marker-allow-overlap: true;}#<%= table %>[mapnik-geometry-type=2] {line-color:#FF6600; line-width:1; line-opacity: 0.7;}#<%= table %>[mapnik-geometry-type=3] {polygon-fill:#FF6600; polygon-opacity: 0.7; line-opacity:1; line-color: #FFFFFF;}';
|
default_style = '#<%= table %>[mapnik-geometry-type=1] {marker-fill: #FF6600;marker-opacity: 1;marker-width: 16;marker-line-color: white;marker-line-width: 3;marker-line-opacity: 0.9;marker-placement: point;marker-type: ellipse;marker-allow-overlap: true;}#<%= table %>[mapnik-geometry-type=2] {line-color:#FF6600; line-width:1; line-opacity: 0.7;}#<%= table %>[mapnik-geometry-type=3] {polygon-fill:#FF6600; polygon-opacity: 0.7; line-opacity:1; line-color: #FFFFFF;}';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 2.2.0+ default
|
||||||
|
default_style = '#<%= table %>["mapnik::geometry_type"=1] {marker-fill: #FF6600;marker-opacity: 1;marker-width: 16;marker-line-color: white;marker-line-width: 3;marker-line-opacity: 0.9;marker-placement: point;marker-type: ellipse;marker-allow-overlap: true;}#<%= table %>["mapnik::geometry_type"=2] {line-color:#FF6600; line-width:1; line-opacity: 0.7;}#<%= table %>["mapnik::geometry_type"=3] {polygon-fill:#FF6600; polygon-opacity: 0.7; line-opacity:1; line-color: #FFFFFF;}';
|
||||||
|
}
|
||||||
|
|
||||||
// A couple of styles to use during testing
|
// A couple of styles to use during testing
|
||||||
var test_style_black_200 = "#test_table{marker-fill:black;marker-line-color:red;marker-width:10}";
|
var test_style_black_200 = "#test_table{marker-fill:black;marker-line-color:red;marker-width:10}";
|
||||||
@ -190,10 +197,11 @@ suite('server', function() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
data: querystring.stringify({style: '#my_table3{'})
|
data: querystring.stringify({style: '#my_table3{'})
|
||||||
},{
|
},{}, function(res) {
|
||||||
status: 400,
|
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
body: /Missing closing/
|
assert.ok( RegExp(/missing closing/i).test(res.body) );
|
||||||
}, function() { done(); });
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("post'ing multiple bad styles returns 400 with error array", function(done){
|
test("post'ing multiple bad styles returns 400 with error array", function(done){
|
||||||
|
Loading…
Reference in New Issue
Block a user