Revert "Add getCell and setCell method to Simulation"
This reverts commit 52b440351d
.
This commit is contained in:
parent
52b440351d
commit
2e7fd7c3d3
2 changed files with 6 additions and 30 deletions
|
@ -72,10 +72,6 @@ class Simulation {
|
|||
return math.Point<int>(cx.toInt(), cy.toInt());
|
||||
}
|
||||
|
||||
bool getCell(int x, int y) => map.get(x, y);
|
||||
|
||||
void setCell(int x, int y, bool value) => map.set(x, y, value);
|
||||
|
||||
void toggleCellState(int x, int y) {
|
||||
map.set(x, y, !map.get(x, y));
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import 'package:test/test.dart';
|
|||
|
||||
class MockGrid extends Mock implements Grid<bool> {}
|
||||
|
||||
// TODO: reinstate when decoupling rendering from Simulation @Tags(const ["nobrowser"])
|
||||
|
||||
void main() {
|
||||
Simulation sut;
|
||||
setUp(() {
|
||||
|
@ -27,7 +25,7 @@ void main() {
|
|||
var oldMap = sut.map;
|
||||
sut.gridSize = Point(10, 10);
|
||||
expect(sut.map, isNot(same(oldMap)));
|
||||
});
|
||||
}, tags: "nobrowser");
|
||||
});
|
||||
group("resetMap", () {
|
||||
test("sets the internal map filled with 'false' ", () {
|
||||
|
@ -40,7 +38,7 @@ void main() {
|
|||
sut.clearMap();
|
||||
expect(sut.dirty, true);
|
||||
});
|
||||
});
|
||||
}, tags: "nobrowser");
|
||||
group("save&load", () {
|
||||
test(
|
||||
"saves a copy of the map which does not change when the actual map changes",
|
||||
|
@ -51,38 +49,20 @@ void main() {
|
|||
|
||||
expect(sut.loadSnapshot(), isNot(equals(snapshot)));
|
||||
});
|
||||
});
|
||||
group("getCellState", () {
|
||||
test("throws RangeError if outside map bounds", () {
|
||||
expect(() => sut.getCell(9, 10), throwsRangeError);
|
||||
});
|
||||
test("returns cell value", () {
|
||||
sut.map.set(1, 1, true);
|
||||
expect(sut.getCell(1, 1), true);
|
||||
});
|
||||
});
|
||||
group("setCellState", () {
|
||||
test("throws RangeError if outside map bounds", () {
|
||||
expect(() => sut.setCell(9, 10, true), throwsRangeError);
|
||||
});
|
||||
test("sets cell value", () {
|
||||
sut.setCell(1, 1, true);
|
||||
expect(sut.getCell(1, 1), true);
|
||||
});
|
||||
});
|
||||
}, tags: "nobrowser");
|
||||
group("toggleCellState", () {
|
||||
test("throws RangeError if outside the map bounds", () {
|
||||
expect(() => sut.toggleCellState(10, 9), throwsRangeError);
|
||||
});
|
||||
}, tags: const ["nobrowser"]);
|
||||
test("sets the cell to false if currently true", () {
|
||||
sut.map.set(1, 1, true);
|
||||
sut.toggleCellState(1, 1);
|
||||
expect(sut.map.get(1, 1), false);
|
||||
});
|
||||
}, tags: const ["nobrowser"]);
|
||||
test("sets the cell to true if currently false", () {
|
||||
sut.map.set(1, 1, false);
|
||||
sut.toggleCellState(1, 1);
|
||||
expect(sut.map.get(1, 1), true);
|
||||
});
|
||||
}, tags: const ["nobrowser"]);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue