Refactored Boat class to better fit the MVC model by moving all GUI parts to BoatPolygon. Changed the way animation works so that it will work with a constantly updated set of lats and lons.

TODO - Change Mark class to no longer store XY pixel data.
TODO - Add in a timer force updates boat position if a packet has not been recieved for a while.

#story30b #story30c #implement #refactor
This commit is contained in:
Calum
2017-04-24 23:06:30 +12:00
parent b5129c5c80
commit 46037b5aea
8 changed files with 392 additions and 234 deletions
+9 -23
View File
@@ -1,8 +1,11 @@
package seng302;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import org.junit.Assert;
import org.junit.Test;
import seng302.models.Boat;
import seng302.models.BoatPolygon;
import seng302.models.Colors;
import java.util.ArrayList;
@@ -16,30 +19,13 @@ import static org.junit.Assert.assertEquals;
* Created by ryan_ on 16/03/2017.
*/
public class ColorsTest {
//@Test
@Test
public void testNextColor() {
List<Boat> boats = new ArrayList<>();
boats.add(new Boat("Team 1"));
boats.add(new Boat("Team 2"));
boats.add(new Boat("Team 3"));
boats.add(new Boat("Team 4"));
boats.add(new Boat("Team 5"));
boats.add(new Boat("Team 6"));
int count = 0;
List<Color> enumColors = new ArrayList<>();
while (count < 6) {
Color color = Colors.getColor();
enumColors.add(color);
count++;
Color expectedColors[] = {Color.RED, Color.ORANGE, Color.YELLOW, Color.GREEN, Color.BLUE, Color.PURPLE};
for (int i = 0; i<6; i++)
{
Assert.assertEquals(expectedColors[i], Colors.getColor());
}
List<Color> boatColors = new ArrayList<>();
for (Boat boat : boats) {
Color color = boat.getColor();
boatColors.add(color);
}
assertEquals(enumColors, boatColors);
}
}