From 83376f8ddd42880f212c04b355bb7a8f65f1240f Mon Sep 17 00:00:00 2001 From: Felix Obermaier Date: Tue, 25 Sep 2018 10:39:59 +0200 Subject: [PATCH] Ensure valid input to DepthSegment constructor --- .../locationtech/jts/operation/buffer/DepthSegmentTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } }