Add rendering tests

This commit is contained in:
Andreas Hocevar
2017-07-24 18:36:08 +02:00
parent 719abf7265
commit dd914ef635
6 changed files with 60 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

View File

@@ -135,6 +135,49 @@ describe('ol.render', function() {
});
it('supports lineDash styles', function(done) {
var vectorContext = ol.render.toContext(context, {size: [100, 100]});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
lineDash: [10, 5]
})
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.Polygon([
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
]));
resembleCanvas(context.canvas,
'spec/ol/expected/render-polygon-linedash.png', IMAGE_TOLERANCE, done);
});
it('supports lineDashOffset', function(done) {
var vectorContext = ol.render.toContext(context, {size: [100, 100]});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
lineDash: [10, 5],
lineDashOffset: 5
})
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.Polygon([
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
]));
resembleCanvas(context.canvas,
'spec/ol/expected/render-polygon-linedashoffset.png', IMAGE_TOLERANCE, done);
});
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

View File

@@ -119,6 +119,23 @@ describe('ol.rendering.style.RegularShape', function() {
expectResemble(map, 'spec/ol/style/expected/regularshape-canvas.png', 9.4, done);
});
it('supports lineDash', function(done) {
map = createMap('canvas');
createFeatures(new ol.style.Stroke({
lineDash: [10, 5]
}));
expectResemble(map, 'spec/ol/style/expected/regularshape-canvas-linedash.png', 5, done);
});
it('supports lineDashOffset', function(done) {
map = createMap('canvas');
createFeatures(new ol.style.Stroke({
lineDash: [10, 5],
lineDashOffset: 5
}));
expectResemble(map, 'spec/ol/style/expected/regularshape-canvas-linedashoffset.png', 5, done);
});
it('tests the WebGL renderer', function(done) {
assertWebGL();
map = createMap('webgl');