Skip to content

Commit

Permalink
added unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Mar 16, 2024
1 parent c855c44 commit 750861d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
9 changes: 9 additions & 0 deletions tests/data/FieldDataTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ class FieldDataTest implements ITest {
Assert.isTrue(field.isGameOver());
}

function testUndoNewGame() {
var field = new TestFieldData();
field.init(15, 11, ThreeColors, 12345);

field.makeBackup();
field.undo();
Assert.isTrue(field.isUnchanged());
}

function testUndo() {
var field = new TestFieldData();
field.init(15, 11, ThreeColors, 12345);
Expand Down
22 changes: 6 additions & 16 deletions uitests/game/PlayStateTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package game;
import haxeium.Actions;
import haxeium.Wait;
import haxeium.test.TestBaseAllRestarts;
import haxeium.test.TestBaseOneInstance;

class PlayStateTest extends TestBaseAllRestarts {
public function testSolve_12345() {
Expand All @@ -17,11 +16,6 @@ class PlayStateTest extends TestBaseAllRestarts {
button.click();
Sys.sleep(0.02);

function clickField(col:Int, row:Int) {
var flx = driver.findElement(ByPath(["flixel.group.FlxTypedGroup-1", 'game.FieldSprite-${col + row * 15}']));
flx.click();
Sys.sleep(0.02);
}
clickField(11, 2);
clickField(12, 3);
clickField(13, 4);
Expand Down Expand Up @@ -66,11 +60,6 @@ class PlayStateTest extends TestBaseAllRestarts {
button.click();
Sys.sleep(0.02);

function clickField(col:Int, row:Int) {
var flx = driver.findElement(ByPath(["flixel.group.FlxTypedGroup-1", 'game.FieldSprite-${col + row * 15}']));
flx.click();
Sys.sleep(0.02);
}
clickField(12, 4);
clickField(10, 4);
clickField(11, 5);
Expand Down Expand Up @@ -113,11 +102,6 @@ class PlayStateTest extends TestBaseAllRestarts {
button.click();
Sys.sleep(0.02);

function clickField(col:Int, row:Int) {
var flx = driver.findElement(ByPath(["flixel.group.FlxTypedGroup-1", 'game.FieldSprite-${col + row * 15}']));
flx.click();
Sys.sleep(0.02);
}
clickField(11, 2);
clickField(12, 3);
clickField(13, 4);
Expand Down Expand Up @@ -156,4 +140,10 @@ class PlayStateTest extends TestBaseAllRestarts {

equals("", winLossLabel.text);
}

function clickField(col:Int, row:Int) {
var flx = driver.findElement(ByPath(["flixel.group.FlxTypedGroup-1", 'game.FieldSprite-${col + row * 15}']));
flx.click();
Sys.sleep(0.02);
}
}

0 comments on commit 750861d

Please sign in to comment.