re-enable the standalone-mss rendering tests and fix them by avoiding empty styles and empty rules - closes #219
This commit is contained in:
parent
8846bfbbcd
commit
73e5178f1f
@ -47,7 +47,7 @@ carto.Renderer.prototype.renderMSS = function render(data, callback) {
|
||||
if (env.benchmark) console.time('Total Style generation');
|
||||
for (var k = 0, rule, style_name; k < sorted.length; k++) {
|
||||
rule = sorted[k];
|
||||
style_name = 'style-' + (rule.attachment !== '__default__' ? '-' + rule.attachment : '');
|
||||
style_name = 'style' + (rule.attachment !== '__default__' ? '-' + rule.attachment : '');
|
||||
styles.push(style_name);
|
||||
var bench_name = '\tStyle "'+style_name+'" (#'+k+') toXML';
|
||||
if (env.benchmark) console.time(bench_name);
|
||||
|
@ -81,8 +81,7 @@ function symbolizerList(sym_order) {
|
||||
}
|
||||
|
||||
tree.Definition.prototype.symbolizersToXML = function(env, symbolizers, zoom) {
|
||||
var xml = ' <Rule>\n' + zoom.toXML(env).join('') +
|
||||
this.filters.toXML(env);
|
||||
var xml = zoom.toXML(env).join('') + this.filters.toXML(env);
|
||||
|
||||
// Sort symbolizers by the index of their first property definition
|
||||
var sym_order = [], indexes = [];
|
||||
@ -143,8 +142,8 @@ tree.Definition.prototype.symbolizersToXML = function(env, symbolizers, zoom) {
|
||||
}
|
||||
}
|
||||
}
|
||||
xml += ' </Rule>\n';
|
||||
return xml;
|
||||
if (!xml) return '';
|
||||
return ' <Rule>\n' + xml + ' </Rule>\n';
|
||||
};
|
||||
|
||||
// Take a zoom range of zooms and 'i', the index of a rule in this.rules,
|
||||
|
@ -38,8 +38,9 @@ tree.Style.toXML = function(name, attachment, definitions, env) {
|
||||
if (opacity.length) {
|
||||
attrs_xml += ' opacity="' + opacity[0].value.eval(env).toString() + '" ';
|
||||
}
|
||||
|
||||
return '<Style name="' + name + '" filter-mode="first" ' + attrs_xml + '>\n' + rules.join('') + '</Style>';
|
||||
var rule_string = rules.join('');
|
||||
if (!attrs_xml && !rule_string) return '';
|
||||
return '<Style name="' + name + '" filter-mode="first" ' + attrs_xml + '>\n' + rule_string + '</Style>';
|
||||
};
|
||||
|
||||
})(require('../tree'));
|
@ -7,7 +7,7 @@ var carto = require('../lib/carto');
|
||||
var tree = require('../lib/carto/tree');
|
||||
var helper = require('./support/helper');
|
||||
|
||||
/*
|
||||
|
||||
|
||||
describe('Rendering mss', function() {
|
||||
helper.files('rendering-mss', 'mss', function(file) {
|
||||
@ -43,4 +43,3 @@ helper.files('rendering-mss', 'mss', function(file) {
|
||||
});
|
||||
});
|
||||
|
||||
*/
|
Loading…
Reference in New Issue
Block a user