Merge pull request #4415 from ahocevar/fix-imagesize
Scale StaticImage image to imageExtent
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user