canvas tests for tile rendering with layer.extent

This commit is contained in:
Ian Schneider
2016-06-15 21:14:37 -06:00
parent 265068e782
commit 9d5232d9af
3 changed files with 26 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -29,7 +29,7 @@ describe('ol.rendering.layer.Tile', function() {
}
};
sources.forEach(function(source) {
sources.forEach(function(source, i) {
source.on('tileloadstart', function(event) {
tilesLoading++;
});
@@ -44,7 +44,7 @@ describe('ol.rendering.layer.Tile', function() {
var options = {
source: source
};
ol.object.assign(options, layerOptions);
ol.object.assign(options, layerOptions[i] || layerOptions);
map.addLayer(new ol.layer.Tile(options));
});
}
@@ -112,6 +112,30 @@ describe('ol.rendering.layer.Tile', function() {
IMAGE_TOLERANCE, done);
});
});
function centerExtent(map) {
var c = map.getView().calculateExtent(map.getSize());
var qw = ol.extent.getSize(c)[0] / 4;
var qh = ol.extent.getSize(c)[1] / 4;
return [c[0] + qw, c[1] + qh, c[2] - qw, c[3] - qh];
}
it('tests canvas layer extent clipping', function(done) {
map = createMap('canvas');
waitForTiles([source1, source2], [{}, {extent: centerExtent(map)}], function() {
expectResemble(map, 'spec/ol/layer/expected/2-layers-canvas-extent.png',
IMAGE_TOLERANCE, done);
});
});
it('tests canvas layer extent clipping with rotation', function(done) {
map = createMap('canvas');
map.getView().setRotation(Math.PI / 2);
waitForTiles([source1, source2], [{}, {extent: centerExtent(map)}], function() {
expectResemble(map, 'spec/ol/layer/expected/2-layers-canvas-extent-rotate.png',
IMAGE_TOLERANCE, done);
});
});
});
describe('tile layer with opacity', function() {