Skip to content

Commit

Permalink
fix: Dispose graphics context to avoid flakey test
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Feb 15, 2024
1 parent b1caa72 commit 7be164e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/spec/DebugSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ describe('Debug draw static', () => {
beforeAll(() => {
jasmine.addAsyncMatchers(ExcaliburAsyncMatchers);
});

it('exists', () => {
expect(ex.Debug).toBeDefined();
});

afterEach(() => {
ex.Debug.clear();
});

it('can draw a point', async () => {
const canvas = document.createElement('canvas');
canvas.width = 10;
Expand All @@ -25,6 +30,7 @@ describe('Debug draw static', () => {
context.flush();

await expectAsync(canvas).toEqualImage('src/spec/images/DebugSpec/point.png');
context.dispose();
});

it('can draw a line', async () => {
Expand All @@ -43,6 +49,7 @@ describe('Debug draw static', () => {
context.flush();

await expectAsync(canvas).toEqualImage('src/spec/images/DebugSpec/line.png');
context.dispose();
});

it('can draw lines', async () => {
Expand All @@ -61,6 +68,7 @@ describe('Debug draw static', () => {
context.flush();

await expectAsync(canvas).toEqualImage('src/spec/images/DebugSpec/lines.png');
context.dispose();
});

xit('can draw text', async () => {
Expand Down Expand Up @@ -97,6 +105,7 @@ describe('Debug draw static', () => {
context.flush();

await expectAsync(canvas).toEqualImage('src/spec/images/DebugSpec/polygon.png');
context.dispose();
});

it('can draw a circle', async () => {
Expand All @@ -115,6 +124,7 @@ describe('Debug draw static', () => {
context.flush();

await expectAsync(canvas).toEqualImage('src/spec/images/DebugSpec/circle.png');
context.dispose();
});

it('can draw bounds', async () => {
Expand All @@ -140,6 +150,7 @@ describe('Debug draw static', () => {
context.flush();

await expectAsync(canvas).toEqualImage('src/spec/images/DebugSpec/bounds.png');
context.dispose();
});

it('can draw a ray', async () => {
Expand All @@ -160,5 +171,6 @@ describe('Debug draw static', () => {
context.flush();

await expectAsync(canvas).toEqualImage('src/spec/images/DebugSpec/ray.png');
context.dispose();
});
});

0 comments on commit 7be164e

Please sign in to comment.