-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: #2886 Fixes an issue spotted by @jyoung4242 where `ScreenAppenders` did not work properly. They are now also more configurable! https://github.com/excaliburjs/Excalibur/assets/612071/9f971648-db2f-4958-bcb8-606c00c234ce ```typescript const logger = Logger.getInstance(); const screenAppender = new ScreenAppender({ engine: game, color: Color.Black, xPos: 0 }); logger.addAppender(screenAppender); setInterval(() => { logger.info('test', performance.now()); }, 100); ```
- Loading branch information
Showing
6 changed files
with
154 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as ex from '@excalibur'; | ||
import { TestUtils } from './util/TestUtils'; | ||
import { ExcaliburAsyncMatchers } from 'excalibur-jasmine'; | ||
|
||
describe('A ScreenAppender', () => { | ||
beforeAll(() => { | ||
jasmine.addAsyncMatchers(ExcaliburAsyncMatchers); | ||
}); | ||
|
||
it('exists', () => { | ||
expect(ex.ScreenAppender).toBeDefined(); | ||
}); | ||
|
||
it('can be constructed', () => { | ||
const engine = TestUtils.engine({width: 100, height: 100}); | ||
const sut = new ex.ScreenAppender({engine}); | ||
expect(sut).toBeDefined(); | ||
engine.dispose(); | ||
}); | ||
|
||
it('can be configured to log', async () => { | ||
const engine = TestUtils.engine({width: 100, height: 100}); | ||
const sut = new ex.ScreenAppender({ | ||
engine, | ||
color: ex.Color.Yellow, | ||
xPos: 0 | ||
}); | ||
|
||
sut.log(ex.LogLevel.Info, ['this is a log']); | ||
sut.log(ex.LogLevel.Info, ['this is a log']); | ||
sut.log(ex.LogLevel.Info, ['this is a log']); | ||
sut.log(ex.LogLevel.Info, ['this is a log']); | ||
sut.log(ex.LogLevel.Info, ['this is a log']); | ||
sut.log(ex.LogLevel.Info, ['this is a log']); | ||
|
||
await TestUtils.runOnWindows(async () => { | ||
await expectAsync(sut.canvas).toEqualImage('src/spec/images/ScreenAppenderSpec/screen-log.png'); | ||
}); | ||
|
||
// FIXME CI chokes on this one for some reason | ||
// await TestUtils.runOnLinux(async () => { | ||
// await expectAsync(sut.canvas).toEqualImage('src/spec/images/ScreenAppenderSpec/screen-log-linux.png'); | ||
// }); | ||
engine.dispose(); | ||
}); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters