Merge pull request #3455 from tsauerwein/webgl-loaded-icon

Fix pre-loaded icons images for WebGL
This commit is contained in:
Tobias Sauerwein
2015-04-02 20:29:29 +02:00
4 changed files with 66 additions and 9 deletions
+26
View File
@@ -109,6 +109,32 @@ describe('ol.style.Icon', function() {
expect(iconStyle.getOrigin()).to.eql([92, 20]);
});
});
describe('#getImageSize', function() {
var imgSize = [144, 192];
it('takes the real image size', function() {
// pretend that the image is already in the cache,
// this image will be used for the icon.
var cache = ol.style.IconImageCache.getInstance();
var src = 'test.png';
var iconImage = new ol.style.IconImage_(null, 'test.png', imgSize);
cache.set(src, null, iconImage);
var iconStyle = new ol.style.Icon({
src: 'test.png'
});
expect(iconStyle.getImageSize()).to.eql(imgSize);
});
it('uses the given image size', function() {
var iconStyle = new ol.style.Icon({
img: {src: 'test.png'},
imgSize: imgSize
});
expect(iconStyle.getImageSize()).to.eql(imgSize);
});
});
});
describe('ol.style.IconImageCache', function() {