Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/Excalibur. 🎮 Your friendly TypeScript 2D game engine for the web 🗡️ excaliburjs.com
excalibur excaliburjs game-development game-engine game-framework gamedev games html5-canvas typescript
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748import * as ex from '@excalibur';
describe('DebugText', () => { it('exists', () => { expect(ex.DebugText); });
describe('@visual', () => { it('can write text (2DCanvas)', async () => { const canvasElement = document.createElement('canvas'); canvasElement.width = 100; canvasElement.height = 100; const ctx = new ex.ExcaliburGraphicsContext2DCanvas({ canvasElement });
const debugText = new ex.DebugText();
await debugText.load();
ctx.clear();
debugText.write(ctx, 'some text', ex.vec(0, 50));
ctx.flush();
await expect(canvasElement).toEqualImage('/src/spec/assets/images/DebugTextSpec/draw-canvas2d.png'); });
it('can write text (WebGL)', async () => { const canvasElement = document.createElement('canvas'); canvasElement.width = 100; canvasElement.height = 100; const ctx = new ex.ExcaliburGraphicsContextWebGL({ canvasElement });
const debugText = new ex.DebugText();
await debugText.load();
ctx.clear();
debugText.write(ctx, 'some text', ex.vec(0, 50));
ctx.flush();
await expect(canvasElement).toEqualImage('/src/spec/assets/images/DebugTextSpec/draw-webgl.png', 0.94); }); });});