Add more text style tests
This commit is contained in:
BIN
test/rendering/ol/style/expected/text-align-offset-canvas.png
Normal file
BIN
test/rendering/ol/style/expected/text-align-offset-canvas.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
@@ -103,6 +103,94 @@ describe('ol.rendering.style.Text', function() {
|
||||
expectResemble(map, 'rendering/ol/style/expected/text-rotated-canvas.png', IMAGE_TOLERANCE, done);
|
||||
});
|
||||
|
||||
it('renders multiline text with alignment options', function(done) {
|
||||
createMap('canvas');
|
||||
var feature;
|
||||
feature = new ol.Feature(new ol.geom.Point([25, 0]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'Hello world\nleft',
|
||||
font: 'bold 14px sans-serif',
|
||||
textAlign: 'left'
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new ol.Feature(new ol.geom.Point([-25, 0]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'Hello world\nright',
|
||||
font: 'bold 14px sans-serif',
|
||||
textAlign: 'right'
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new ol.Feature(new ol.geom.Point([0, 25]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'Hello world\nbottom',
|
||||
font: 'bold 14px sans-serif',
|
||||
textBaseline: 'bottom'
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new ol.Feature(new ol.geom.Point([0, -25]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'top\nHello world',
|
||||
font: 'bold 14px sans-serif',
|
||||
textBaseline: 'top'
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
expectResemble(map, 'rendering/ol/style/expected/text-align-offset-canvas.png', 5, done);
|
||||
});
|
||||
|
||||
it('renders multiline text with positioning options', function(done) {
|
||||
createMap('canvas');
|
||||
var feature;
|
||||
feature = new ol.Feature(new ol.geom.Point([0, 0]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'Hello world\nleft',
|
||||
font: 'bold 14px sans-serif',
|
||||
textAlign: 'left',
|
||||
offsetX: 25
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new ol.Feature(new ol.geom.Point([0, 0]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'Hello world\nright',
|
||||
font: 'bold 14px sans-serif',
|
||||
textAlign: 'right',
|
||||
offsetX: -25
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new ol.Feature(new ol.geom.Point([0, 0]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'Hello world\nbottom',
|
||||
font: 'bold 14px sans-serif',
|
||||
textBaseline: 'bottom',
|
||||
offsetY: -25
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new ol.Feature(new ol.geom.Point([0, 0]));
|
||||
feature.setStyle(new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
text: 'top\nHello world',
|
||||
font: 'bold 14px sans-serif',
|
||||
textBaseline: 'top',
|
||||
offsetY: 25
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
expectResemble(map, 'rendering/ol/style/expected/text-align-offset-canvas.png', 5, done);
|
||||
});
|
||||
|
||||
where('WebGL').it('tests the webgl renderer without rotation', function(done) {
|
||||
createMap('webgl');
|
||||
createFeatures();
|
||||
|
||||
Reference in New Issue
Block a user