diff --git a/modules/core/src/test/java/org/locationtech/jts/operation/buffer/DepthSegmentTest.java b/modules/core/src/test/java/org/locationtech/jts/operation/buffer/DepthSegmentTest.java index 9b312bb4c9..f4f6858b1e 100644 --- a/modules/core/src/test/java/org/locationtech/jts/operation/buffer/DepthSegmentTest.java +++ b/modules/core/src/test/java/org/locationtech/jts/operation/buffer/DepthSegmentTest.java @@ -56,7 +56,11 @@ private void checkContract( } private SubgraphDepthLocater.DepthSegment depthSeg(double x0, double y0, double x1, double y1) { - return new SubgraphDepthLocater.DepthSegment(new LineSegment(x0,y0,x1,y1), 0); + LineSegment seg = new LineSegment(x0,y0,x1,y1); + // DepthSegment compareTo method assumes upward segments + if (seg.p0.y > seg.p1.y) + seg.reverse(); + return new SubgraphDepthLocater.DepthSegment(seg, 0); } }