Implemented marker visualisation from XML in ResizableRaceCanvas

- Replaced and deprecated Constants
- Added getMarkers to RaceDataSource interface
- Added boundary testing for source data

#story[782]
This commit is contained in:
Connor Taylor-Brown
2017-04-28 01:58:55 +12:00
parent 073102d1a3
commit 02511db2b9
9 changed files with 78 additions and 28 deletions
@@ -1,13 +1,16 @@
package seng302.Mock;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import seng302.GPSCoordinate;
import seng302.Model.Leg;
import seng302.Model.Marker;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
@@ -75,4 +78,21 @@ public class StreamedRaceTest {
};
for(int i = 0; i < legs.size(); i++) assertEquals(expectedNames[i], legs.get(i).getName());
}
/**
* raceTest.xml is not compliant with this test. Markers are positioned far out of bounds.
*/
@Test
public void markersWithinRaceBoundaries() {
GPSCoordinate topLeft = streamedCourseXMLReader.getMapTopLeft();
GPSCoordinate bottomRight = streamedCourseXMLReader.getMapBottomRight();
for(Marker marker: streamedCourseXMLReader.getMarkers()) {
GPSCoordinate centre = marker.getAverageGPSCoordinate();
assertTrue(centre.getLatitude() < bottomRight.getLatitude());
assertTrue(centre.getLatitude() > topLeft.getLatitude());
assertTrue(centre.getLongitude() > bottomRight.getLongitude());
assertTrue(centre.getLongitude() < topLeft.getLongitude());
}
}
}