Use imgSize when provided
This commit is contained in:
@@ -8,6 +8,8 @@ goog.require('ol.style.IconOrigin');
|
||||
|
||||
describe('ol.style.Icon', function() {
|
||||
var size = [36, 48];
|
||||
var src = 'data:image/gif;base64,' +
|
||||
'R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs='
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
@@ -21,6 +23,19 @@ describe('ol.style.Icon', function() {
|
||||
canvas, goog.getUid(canvas), size, '').getImage()).to.eql(canvas);
|
||||
});
|
||||
|
||||
it('imgSize overrides img.width and img.height', function(done) {
|
||||
var style = new ol.style.Icon({
|
||||
src: src,
|
||||
imgSize: size
|
||||
});
|
||||
var iconImage = style.iconImage_;
|
||||
iconImage.addEventListener('change', function() {
|
||||
expect([iconImage.image_.width, iconImage.image_.height]).to.eql(size);
|
||||
done();
|
||||
});
|
||||
style.load();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#getAnchor', function() {
|
||||
|
||||
Reference in New Issue
Block a user