cellular-automata/test/src/engine_test.dart

32 lines
No EOL
941 B
Dart

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(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(1000), isNot(throwsNoSuchMethodError));
});
test("setCanvas allows setting a canvas for an engine at any point", () {
sut.canvas = new html.CanvasElement();
expect(sut.canvas, isNotNull);
});
}