lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkn...@apache.org
Subject lucene-solr:branch_7x: Fix simple tessellator test errors
Date Sun, 15 Jul 2018 05:04:31 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 16a9cac18 -> 1b20e6bec


Fix simple tessellator test errors


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1b20e6be
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1b20e6be
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1b20e6be

Branch: refs/heads/branch_7x
Commit: 1b20e6bec3f971cba5833e8d51cbf5c235dddb8f
Parents: 16a9cac
Author: Nicholas Knize <nknize@gmail.com>
Authored: Sat Jul 14 23:45:43 2018 -0500
Committer: Nicholas Knize <nknize@gmail.com>
Committed: Sun Jul 15 00:03:18 2018 -0500

----------------------------------------------------------------------
 .../org/apache/lucene/geo/TestTessellator.java     | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b20e6be/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java b/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java
index 494d4e5..878cf01 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java
@@ -18,24 +18,19 @@ package org.apache.lucene.geo;
 
 import org.apache.lucene.util.LuceneTestCase;
 
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
-import static org.apache.lucene.geo.GeoTestUtil.nextBox;
+import static org.apache.lucene.geo.GeoTestUtil.nextBoxNotCrossingDateline;
 
 /** Test case for the Polygon {@link Tessellator} class */
 public class TestTessellator extends LuceneTestCase {
 
+  /** test line intersection */
   public void testLinesIntersect() {
-    Rectangle rect = nextBox();
-    // quantize lat/lon of bounding box:
-    int minX = encodeLongitude(rect.minLon);
-    int maxX = encodeLongitude(rect.maxLon);
-    int minY = encodeLatitude(rect.minLat);
-    int maxY = encodeLatitude(rect.maxLat);
+    Rectangle rect = nextBoxNotCrossingDateline();
     // simple case; test intersecting diagonals
-    assertTrue(Tessellator.linesIntersect(minX, minY, maxX, maxY, maxX, minY, minX, maxY));
+    // note: we don't quantize because the tessellator operates on non quantized vertices
+    assertTrue(Tessellator.linesIntersect(rect.minLon, rect.minLat, rect.maxLon, rect.maxLat,
rect.maxLon, rect.minLat, rect.minLon, rect.maxLat));
     // test closest encoded value
-    assertFalse(Tessellator.linesIntersect(minX, maxY, maxX, maxY, minX - 1, minY, minX -
1, maxY));
+    assertFalse(Tessellator.linesIntersect(rect.minLon, rect.maxLat, rect.maxLon, rect.maxLat,
rect.minLon - 1d, rect.minLat, rect.minLon - 1, rect.maxLat));
   }
 
   public void testSimpleTessellation() throws Exception {


Mime
View raw message