Add Canvas nullcheck to render function
This commit is contained in:
parent
572406b963
commit
4c6dff35c3
3 changed files with 19 additions and 9 deletions
|
|
@ -1,12 +1,22 @@
|
|||
@TestOn('browser')
|
||||
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:rules_of_living/src/Engine.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test("Engine can be instantiated without canvas", () {
|
||||
expect(Engine(), isNot(throwsA(anything)));
|
||||
expect(Engine(), isNot(throwsNoSuchMethodError));
|
||||
});
|
||||
|
||||
test("Engine does not throw errors when calling render directly", () {
|
||||
Engine sut = new Engine();
|
||||
// anonymous function necessary since throws can not use functions with args
|
||||
expect(() => sut.render(), isNot(throwsNoSuchMethodError));
|
||||
});
|
||||
|
||||
test("Engine does not throw errors when processing without attached canvas", () {
|
||||
Engine sut = new Engine();
|
||||
// anonymous function necessary since throws can not use functions with args
|
||||
expect(() => sut.process(1000), isNot(throwsNoSuchMethodError));
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue