Add rendering tests

This commit is contained in:
Andreas Hocevar
2017-11-13 13:58:11 +01:00
parent df90f1b78c
commit 53b85a9192
3 changed files with 27 additions and 1 deletions

View File

@@ -1005,7 +1005,7 @@ ol.render.canvas.Replay.prototype.updateStrokeStyle = function(state, applyStrok
var miterLimit = state.miterLimit;
if (state.currentStrokeStyle != strokeStyle ||
state.currentLineCap != lineCap ||
!ol.array.equals(state.currentLineDash, lineDash) ||
(lineDash != state.currentLineDash && !ol.array.equals(state.currentLineDash, lineDash)) ||
state.currentLineDashOffset != lineDashOffset ||
state.currentLineJoin != lineJoin ||
state.currentLineWidth != lineWidth ||

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -403,6 +403,32 @@ describe('ol.rendering.style.Text', function() {
expectResemble(map, 'rendering/ol/style/expected/text-multipolygon.png', 4.4, done);
});
it('renders text background', function(done) {
createMap('canvas');
createFeatures();
var features = vectorSource.getFeatures();
features[0].getStyle().getText().setBackgroundFill(new ol.style.Fill({
color: 'red'
}));
features[1].getStyle().getText().setBackgroundFill(new ol.style.Fill({
color: 'red'
}));
features[1].getStyle().getText().setBackgroundStroke(new ol.style.Stroke({
color: 'blue',
width: 3
}));
features[2].getStyle().getText().setBackgroundFill(new ol.style.Fill({
color: 'red'
}));
features[2].getStyle().getText().setBackgroundStroke(new ol.style.Stroke({
color: 'blue',
width: 3
}));
features[2].getStyle().getText().setPadding([5, 10, 15, 0]);
map.getView().fit(vectorSource.getExtent());
expectResemble(map, 'rendering/ol/style/expected/text-background.png', IMAGE_TOLERANCE, done);
});
where('WebGL').it('tests the webgl renderer without rotation', function(done) {
createMap('webgl');
createFeatures();