Attempt to make font loading tests more stable

Also changes things to use setInterval() instead of setTimeout().
This commit is contained in:
Andreas Hocevar
2017-11-09 10:15:00 +01:00
parent 3a6fc7a1f2
commit 4324d49813
2 changed files with 9 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ goog.require('ol.render.canvas');
describe('ol.render.canvas', function() {
var font = document.createElement('link');
font.href = 'https://fonts.googleapis.com/css?family=Inconsolata';
font.href = 'https://fonts.googleapis.com/css?family=Abel&text=wmytzilWMYTZIL%40%23%2F%26%3F%24%2510';
font.rel = 'stylesheet';
var head = document.getElementsByTagName('head')[0];
@@ -55,7 +55,7 @@ describe('ol.render.canvas', function() {
head.appendChild(font);
var spy = sinon.spy();
ol.events.listen(ol.render.canvas.labelCache, 'clear', spy);
checkFont('12px Inconsolata');
checkFont('12px Abel');
setTimeout(function() {
ol.events.unlisten(ol.render.canvas.labelCache, 'clear', spy);
head.removeChild(font);