add standalone mss rendering tests for desired empty style dropping behavior - refs #219

This commit is contained in:
Dane Springmeyer 2012-12-18 18:25:13 -08:00
parent 23d11fedc6
commit 0d294c1075
11 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,64 @@
var path = require('path'),
assert = require('assert'),
fs = require('fs');
var existsSync = require('fs').existsSync || require('path').existsSync;
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) {
it('should render mss ' + path.basename(file) + ' correctly', function(done) {
var completed = false;
var renderResult;
var mss = helper.mss(file);
new carto.Renderer({
paths: [ path.dirname(file) ],
data_dir: path.join(__dirname, '../data'),
local_data_dir: path.join(__dirname, 'rendering'),
filename: file
}).renderMSS(mss, function (err, output) {
if (err) {
if (Array.isArray(err)){
err.forEach(carto.writeError);
done();
} else {
throw err;
done();
}
} else {
var expected = file.replace(path.extname(file),'')+'.xml';
if (!existsSync(expected)) {
fs.writeFileSync(expected,output);
}
var expected_data = fs.readFileSync(expected).toString();
assert.equal(output,expected_data);
done();
/*
helper.compareToXMLFile(result, output, function(err) {
completed = true;
if (err) {
console.warn(
helper.stylize("Failure", 'red') + ': ' +
helper.stylize(file, 'underline') +
' differs from expected result.');
helper.showDifferences(err);
throw '';
done();
} else { done(); }
});
*/
}
});
// beforeExit(function() {
// if (!completed && renderResult) {
// console.warn(helper.stylize('renderer produced:', 'bold'));
// console.warn(renderResult);
// }
// assert.ok(completed, 'Rendering finished.');
// });
});
});
});

View File

@ -0,0 +1,4 @@
#landcover {
::foo {
}
}

View File

@ -0,0 +1,2 @@
#landcover {
}

View File

@ -0,0 +1,3 @@
#landcover {
opacity:.5;
}

View File

@ -0,0 +1,2 @@
<Style name="style" filter-mode="first" opacity="0.5" >
</Style>

View File

@ -0,0 +1,3 @@
#landcover {
comp-op:color-burn;
}

View File

@ -0,0 +1,2 @@
<Style name="style" filter-mode="first" comp-op="color-burn" >
</Style>

View File

@ -0,0 +1,3 @@
#landcover {
image-filters:invert();
}

View File

@ -0,0 +1,2 @@
<Style name="style" filter-mode="first" image-filters="invert" >
</Style>