Allow setting a canvas for an engine at any point
This commit is contained in:
parent
4c6dff35c3
commit
66bf87d9d8
2 changed files with 33 additions and 3 deletions
|
|
@ -1,22 +1,32 @@
|
|||
import 'dart:html' as html;
|
||||
|
||||
@TestOn('browser')
|
||||
|
||||
import 'package:rules_of_living/src/Engine.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
Engine sut;
|
||||
setUp(() {
|
||||
sut = Engine();
|
||||
});
|
||||
|
||||
test("Engine can be instantiated without canvas", () {
|
||||
expect(Engine(), isNot(throwsNoSuchMethodError));
|
||||
expect(sut, 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));
|
||||
});
|
||||
|
||||
test("setCanvas allows setting a canvas for an engine at any point", () {
|
||||
sut.canvas = new html.CanvasElement();
|
||||
expect(sut.canvas, isNotNull);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue