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:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user