35 lines
1019 B
Dart
35 lines
1019 B
Dart
import 'dart:html' as html;
|
|
import 'dart:math';
|
|
|
|
@TestOn('browser')
|
|
import 'package:rules_of_living/src/Engine.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
Engine sut;
|
|
setUp(() {
|
|
sut = Engine();
|
|
});
|
|
group("canvas", () {
|
|
test("Engine can be instantiated without canvas", () {
|
|
expect(sut, isNot(throwsNoSuchMethodError));
|
|
});
|
|
|
|
test("Engine does not throw errors when calling render directly", () {
|
|
// 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",
|
|
() {
|
|
// anonymous function necessary since throws can not use functions with args
|
|
expect(() => sut.process, isNot(throwsNoSuchMethodError));
|
|
});
|
|
|
|
test("setCanvas allows setting a canvas for an engine at any point", () {
|
|
sut.canvas = new html.CanvasElement();
|
|
expect(sut.canvas, isNotNull);
|
|
});
|
|
});
|
|
}
|