Merge pull request #4415 from ahocevar/fix-imagesize

Scale StaticImage image to imageExtent
This commit is contained in:
Andreas Hocevar
2015-11-13 13:15:46 +01:00
6 changed files with 78 additions and 23 deletions

View File

@@ -14,14 +14,32 @@ describe('ol.source.ImageStatic', function() {
describe('#getImage', function() {
it('scales image to fit imageExtent', function(done) {
var source = new ol.source.ImageStatic({
url: 'spec/ol/source/images/12-655-1583.png',
imageExtent: [
-13629027.891360067, 4539747.983913189,
-13619243.951739565, 4559315.863154193],
projection: projection
});
source.on('imageloadend', function(event) {
expect(image.getImage().width).to.be(128);
expect(image.getImage().height).to.be(256);
done();
});
var image = source.getImage(extent, resolution, pixelRatio, projection);
image.load();
});
it('triggers image load events', function(done) {
var source = new ol.source.ImageStatic({
url: 'spec/ol/source/images/12-655-1583.png',
imageExtent: [
-13629027.891360067, 4539747.983913189,
-13619243.951739565, 4549531.923533691],
projection: projection,
imageSize: [256, 256]
projection: projection
});
var imageloadstart = sinon.spy();