Get tests reporting failures again

This commit is contained in:
Daniel Imms
2017-09-03 14:21:30 -07:00
parent 17731c3de3
commit e518ea04c5
2 changed files with 14 additions and 5 deletions
+3
View File
@@ -43,6 +43,7 @@ import { BellSound } from './utils/Sounds';
import { DEFAULT_ANSI_COLORS } from './renderer/ColorManager';
import { IMouseZoneManager } from './input/Interfaces';
import { MouseZoneManager } from './input/MouseZoneManager';
import { initialize as initializeCharAtlas } from './renderer/CharAtlas';
// Declare for RequireJS in loadAddon
declare var define: any;
@@ -562,6 +563,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.document = this.parent.ownerDocument;
this.body = <HTMLBodyElement>this.document.body;
initializeCharAtlas(this.document);
// Create main element container
this.element = this.document.createElement('div');
this.element.classList.add('terminal');
+11 -5
View File
@@ -91,12 +91,20 @@ function configEquals(a: ICharAtlasConfig, b: ICharAtlasConfig): boolean {
a.colors.foreground === b.colors.foreground;
}
let generator: CharAtlasGenerator;
export function initialize(document: Document): void {
if (!generator) {
generator = new CharAtlasGenerator(document);
}
}
class CharAtlasGenerator {
private _canvas: HTMLCanvasElement;
private _ctx: CanvasRenderingContext2D;
constructor() {
this._canvas = document.createElement('canvas');
constructor(private _document: Document) {
this._canvas = this._document.createElement('canvas');
this._ctx = this._canvas.getContext('2d');
this._ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
}
@@ -147,7 +155,7 @@ class CharAtlasGenerator {
if (!('createImageBitmap' in window)) {
// Regenerate canvas and context as they are now owned by the char atlas
const result = this._canvas;
this._canvas = document.createElement('canvas');
this._canvas = this._document.createElement('canvas');
this._ctx = this._canvas.getContext('2d');
this._ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
return result;
@@ -159,5 +167,3 @@ class CharAtlasGenerator {
return promise;
}
}
const generator = new CharAtlasGenerator();