Accept HTMLCanvasElement for an icon's img

This commit is contained in:
Andreas Hocevar
2015-12-04 13:40:53 +01:00
parent 952a282756
commit abb680d28f
5 changed files with 103 additions and 9 deletions

View File

@@ -9,6 +9,20 @@ goog.require('ol.style.IconOrigin');
describe('ol.style.Icon', function() {
var size = [36, 48];
describe('constructor', function() {
it('caches canvas images with a uid as src', function() {
var canvas = document.createElement('canvas');
new ol.style.Icon({
img: canvas,
imgSize: size
});
expect(ol.style.IconImage_.get(
canvas, goog.getUid(canvas), size, '').getImage()).to.eql(canvas);
});
});
describe('#getAnchor', function() {
var fractionAnchor = [0.25, 0.25];