Fix Snapshot Load and Save Functions

Were just pointers to the map before. Fix to be actual clones of the map.
This commit is contained in:
Unknown 2018-10-19 20:49:59 +02:00
parent 37bff59f83
commit 2ea974bbd5
2 changed files with 12 additions and 6 deletions

View file

@ -37,12 +37,14 @@ void main() {
}, skip: "can not find a way to set dirty to true first yet");
});
group("save&load", () {
test("saves the current map, can be loaded by loadSnapshot", () {
var snapshot = sut.map;
test(
"saves a copy of the map which does not change when the actual map changes",
() {
sut.saveSnapshot();
sut.map = MockGrid();
sut.mergeStateChanges({1: true, 2: true});
var snapshot = Grid.from(sut.map);
expect(sut.loadSnapshot(), equals(snapshot));
expect(sut.loadSnapshot(), isNot(equals(snapshot)));
});
});
}