Skip to content

Commit 4af77ac

Browse files
committed
Add unit test to verify the fix for boarding location linking failure
1 parent 6f00870 commit 4af77ac

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,43 @@ void testLinkStopNearPlatformVertex() {
213213
assertEquals(10, graph.getEdges().size());
214214
}
215215

216+
/**
217+
* Link an interior vertex which is very close to a visibility vertex by
218+
* calling directly addPermanentAreaVertex used in boarding location linking
219+
* A connecting edge pair is created despite of the small distance
220+
*/
221+
@Test
222+
void testAddPermanentAreaVertex() {
223+
Coordinate[] platform = {
224+
new Coordinate(10, 60.002),
225+
new Coordinate(10.004, 60.002),
226+
new Coordinate(10.004, 60),
227+
new Coordinate(10, 60),
228+
};
229+
// add one entrance to bottom left corner
230+
int[] visibilityPoints = { 3 };
231+
232+
// No stops
233+
Coordinate[] stops = {};
234+
235+
Graph graph = prepareTest(platform, visibilityPoints, stops);
236+
237+
// dig up the AreaGroup
238+
AreaGroup ag = null;
239+
var edge = graph.getEdges().stream().findFirst().get();
240+
if (edge instanceof AreaEdge ae) {
241+
ag = ae.getArea();
242+
}
243+
assertNotNull(ag);
244+
245+
var vertexFactory = new VertexFactory(graph);
246+
var v = vertexFactory.intersection("boardingLocation", 10.00000001, 60.00000001);
247+
graph.getLinker().addPermanentAreaVertex(v, ag);
248+
249+
// vertex links to the single visibility point with 2 edges
250+
assertEquals(10, graph.getEdges().size());
251+
}
252+
216253
/**
217254
* Link a stop which is inside an area and very close to its edge.
218255
* Linking snaps directly to the edge without short connecting edges

0 commit comments

Comments
 (0)