add standalone mss rendering tests for desired empty style dropping behavior - refs #219
This commit is contained in:
parent
23d11fedc6
commit
0d294c1075
64
test/rendering-mss.test.js
Normal file
64
test/rendering-mss.test.js
Normal 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.');
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,4 @@
|
|||||||
|
#landcover {
|
||||||
|
::foo {
|
||||||
|
}
|
||||||
|
}
|
2
test/rendering-mss/should-discard-empty-style.mss
Normal file
2
test/rendering-mss/should-discard-empty-style.mss
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#landcover {
|
||||||
|
}
|
0
test/rendering-mss/should-discard-empty-style.xml
Normal file
0
test/rendering-mss/should-discard-empty-style.xml
Normal file
3
test/rendering-mss/style-level-prop-only.mss
Normal file
3
test/rendering-mss/style-level-prop-only.mss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#landcover {
|
||||||
|
opacity:.5;
|
||||||
|
}
|
2
test/rendering-mss/style-level-prop-only.xml
Normal file
2
test/rendering-mss/style-level-prop-only.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<Style name="style" filter-mode="first" opacity="0.5" >
|
||||||
|
</Style>
|
3
test/rendering-mss/style-level-prop-only2.mss
Normal file
3
test/rendering-mss/style-level-prop-only2.mss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#landcover {
|
||||||
|
comp-op:color-burn;
|
||||||
|
}
|
2
test/rendering-mss/style-level-prop-only2.xml
Normal file
2
test/rendering-mss/style-level-prop-only2.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<Style name="style" filter-mode="first" comp-op="color-burn" >
|
||||||
|
</Style>
|
3
test/rendering-mss/style-level-prop-only3.mss
Normal file
3
test/rendering-mss/style-level-prop-only3.mss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#landcover {
|
||||||
|
image-filters:invert();
|
||||||
|
}
|
2
test/rendering-mss/style-level-prop-only3.xml
Normal file
2
test/rendering-mss/style-level-prop-only3.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<Style name="style" filter-mode="first" image-filters="invert" >
|
||||||
|
</Style>
|
Loading…
Reference in New Issue
Block a user