# Conflicts:
#	src/test/java/seng302/models/MarkGroupTest.java
This commit is contained in:
Calum
2017-05-04 14:04:52 +12:00
parent 49f2398669
commit 9b063190ce
2 changed files with 74 additions and 75 deletions
@@ -1,4 +1,4 @@
// TODO: 4/05/17 cir27 - Find out why this test is causing build failures // TODO: 4/05/17 cir27 - Currently the CI cannot build these tests. Unsure of exact issue but believe it may be a driver issue. Find a way to make tests work.
//package seng302.models; //package seng302.models;
// //
@@ -92,5 +92,4 @@ public class BoatGroupTest {
Assert.assertTrue(originalX == bp.getLayoutX()); Assert.assertTrue(originalX == bp.getLayoutX());
Assert.assertTrue(originalY == bp.getLayoutY()); Assert.assertTrue(originalY == bp.getLayoutY());
} }
} }*/
*/
+72 -72
View File
@@ -1,4 +1,4 @@
// TODO: 4/05/17 cir27 - Find out why this test is causing build failures // TODO: 4/05/17 cir27 - Currently the CI cannot build these tests. Unsure of exact issue but believe it may be a driver issue. Find a way to make tests work.
// //
//package seng302.models; //package seng302.models;
// //
@@ -6,7 +6,7 @@
// //
//} //}
package seng302.models; package seng302.models;
/*
import javafx.scene.shape.Circle; import javafx.scene.shape.Circle;
import seng302.*; import seng302.*;
import javafx.geometry.Point2D; import javafx.geometry.Point2D;
@@ -18,73 +18,73 @@ import seng302.models.mark.*;
/** /**
* Created by cir27 on 4/05/17. * Created by cir27 on 4/05/17.
*/ */
public class MarkGroupTest { //public class MarkGroupTest {
private MarkGroup gateMG; // private MarkGroup gateMG;
private MarkGroup singleMG; // private MarkGroup singleMG;
//
@Before // @Before
public void setUp () { // public void setUp () {
Mark single = new SingleMark("SM", 0, 0 , 0); // Mark single = new SingleMark("SM", 0, 0 , 0);
Mark gate = new GateMark( // Mark gate = new GateMark(
"GM", // "GM",
MarkType.OPEN_GATE, // MarkType.OPEN_GATE,
new SingleMark("GM1", 0, 0, 1), // new SingleMark("GM1", 0, 0, 1),
new SingleMark("GM2", 0, 0, 2), // new SingleMark("GM2", 0, 0, 2),
0, // 0,
0); // 0);
gateMG = new MarkGroup(gate, new Point2D(10, 10), new Point2D(20, 20)); // gateMG = new MarkGroup(gate, new Point2D(10, 10), new Point2D(20, 20));
singleMG = new MarkGroup(single, new Point2D(0, 0)); // singleMG = new MarkGroup(single, new Point2D(0, 0));
} // }
//
@Test // @Test
public void hasIDSingle () { // public void hasIDSingle () {
Assert.assertTrue(singleMG.hasRaceId(0)); // Assert.assertTrue(singleMG.hasRaceId(0));
Assert.assertTrue(!singleMG.hasRaceId(100,12)); // Assert.assertTrue(!singleMG.hasRaceId(100,12));
} // }
//
@Test // @Test
public void hasIdGate () { // public void hasIdGate () {
Assert.assertTrue(gateMG.hasRaceId(1)); // Assert.assertTrue(gateMG.hasRaceId(1));
Assert.assertTrue(gateMG.hasRaceId(2)); // Assert.assertTrue(gateMG.hasRaceId(2));
Assert.assertTrue(!gateMG.hasRaceId(100,12)); // Assert.assertTrue(!gateMG.hasRaceId(100,12));
} // }
//
@Test // @Test
public void nothingOnWrongId () { // public void nothingOnWrongId () {
double originalX = singleMG.getChildren().get(0).getLayoutX(); // double originalX = singleMG.getChildren().get(0).getLayoutX();
double originalY = singleMG.getChildren().get(0).getLayoutY(); // double originalY = singleMG.getChildren().get(0).getLayoutY();
singleMG.setDestination(10, 10, 0, 4); // singleMG.setDestination(10, 10, 0, 4);
singleMG.updatePosition(400); // singleMG.updatePosition(400);
Assert.assertTrue(originalX == singleMG.getChildren().get(0).getLayoutX()); // Assert.assertTrue(originalX == singleMG.getChildren().get(0).getLayoutX());
Assert.assertTrue(originalY == singleMG.getChildren().get(0).getLayoutY()); // Assert.assertTrue(originalY == singleMG.getChildren().get(0).getLayoutY());
} // }
//
@Test // @Test
public void correctMovementCorrectIdSingle () { // public void correctMovementCorrectIdSingle () {
double originalX = singleMG.getChildren().get(0).getLayoutX(); // double originalX = singleMG.getChildren().get(0).getLayoutX();
double originalY = singleMG.getChildren().get(0).getLayoutY(); // double originalY = singleMG.getChildren().get(0).getLayoutY();
long timeinterval = 1000/60; // long timeinterval = 1000/60;
double expectedChange = 10 / 200 * timeinterval; // double expectedChange = 10 / 200 * timeinterval;
singleMG.setDestination(originalX + 10, originalY + 10, 0, 0); // singleMG.setDestination(originalX + 10, originalY + 10, 0, 0);
singleMG.updatePosition(timeinterval); // singleMG.updatePosition(timeinterval);
Assert.assertTrue(originalX + expectedChange == singleMG.getChildren().get(0).getLayoutX()); // Assert.assertTrue(originalX + expectedChange == singleMG.getChildren().get(0).getLayoutX());
Assert.assertTrue(originalY + expectedChange == singleMG.getChildren().get(0).getLayoutY()); // Assert.assertTrue(originalY + expectedChange == singleMG.getChildren().get(0).getLayoutY());
} // }
//
@Test // @Test
public void correctMovementCorrectIDGate () { // public void correctMovementCorrectIDGate () {
double originalX1 = gateMG.getChildren().get(0).getLayoutX(); // double originalX1 = gateMG.getChildren().get(0).getLayoutX();
double originalY1 = gateMG.getChildren().get(0).getLayoutY(); // double originalY1 = gateMG.getChildren().get(0).getLayoutY();
double originalX2 = gateMG.getChildren().get(1).getLayoutX(); // double originalX2 = gateMG.getChildren().get(1).getLayoutX();
double originalY2 = gateMG.getChildren().get(1).getLayoutY(); // double originalY2 = gateMG.getChildren().get(1).getLayoutY();
long timeinterval = 1000/60; // long timeinterval = 1000/60;
double expectedChange = 10 / 200 * timeinterval; // double expectedChange = 10 / 200 * timeinterval;
gateMG.setDestination(originalX1 + 10, originalY1 + 10, 0, 1); // gateMG.setDestination(originalX1 + 10, originalY1 + 10, 0, 1);
gateMG.setDestination(originalX2 + 10, originalY2 + 10, 0, 2); // gateMG.setDestination(originalX2 + 10, originalY2 + 10, 0, 2);
gateMG.updatePosition(timeinterval); // gateMG.updatePosition(timeinterval);
Assert.assertTrue(originalX1 + expectedChange == gateMG.getChildren().get(0).getLayoutX()); // Assert.assertTrue(originalX1 + expectedChange == gateMG.getChildren().get(0).getLayoutX());
Assert.assertTrue(originalY1 + expectedChange == gateMG.getChildren().get(0).getLayoutY()); // Assert.assertTrue(originalY1 + expectedChange == gateMG.getChildren().get(0).getLayoutY());
Assert.assertTrue(originalX2 + expectedChange == gateMG.getChildren().get(1).getLayoutX()); // Assert.assertTrue(originalX2 + expectedChange == gateMG.getChildren().get(1).getLayoutX());
Assert.assertTrue(originalY2 + expectedChange == gateMG.getChildren().get(1).getLayoutY()); // Assert.assertTrue(originalY2 + expectedChange == gateMG.getChildren().get(1).getLayoutY());
} // }
} //}