mirror of
https://github.com/cfpwastaken/planetiler-openmaptiles.git
synced 2026-02-04 04:21:08 +00:00
fix sonar warnings in tests (#191)
This commit is contained in:
@@ -11,7 +11,7 @@ import com.onthegomap.planetiler.util.Wikidata;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class BasemapProfileTest {
|
class BasemapProfileTest {
|
||||||
|
|
||||||
private final Wikidata.WikidataTranslations wikidataTranslations = new Wikidata.WikidataTranslations();
|
private final Wikidata.WikidataTranslations wikidataTranslations = new Wikidata.WikidataTranslations();
|
||||||
private final Translations translations = Translations.defaultProvider(List.of("en", "es", "de"))
|
private final Translations translations = Translations.defaultProvider(List.of("en", "es", "de"))
|
||||||
@@ -20,7 +20,7 @@ public class BasemapProfileTest {
|
|||||||
Stats.inMemory());
|
Stats.inMemory());
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCaresAboutWikidata() {
|
void testCaresAboutWikidata() {
|
||||||
var node = new OsmElement.Node(1, 1, 1);
|
var node = new OsmElement.Node(1, 1, 1);
|
||||||
node.setTag("aeroway", "gate");
|
node.setTag("aeroway", "gate");
|
||||||
assertTrue(profile.caresAboutWikidataTranslation(node));
|
assertTrue(profile.caresAboutWikidataTranslation(node));
|
||||||
@@ -30,7 +30,7 @@ public class BasemapProfileTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoesntCareAboutWikidataForRoads() {
|
void testDoesntCareAboutWikidataForRoads() {
|
||||||
var way = new OsmElement.Way(1);
|
var way = new OsmElement.Way(1);
|
||||||
way.setTag("highway", "footway");
|
way.setTag("highway", "footway");
|
||||||
assertFalse(profile.caresAboutWikidataTranslation(way));
|
assertFalse(profile.caresAboutWikidataTranslation(way));
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import org.locationtech.jts.geom.Polygon;
|
|||||||
* Generates an entire map for the smallest openstreetmap extract available (Monaco) and asserts that expected output
|
* Generates an entire map for the smallest openstreetmap extract available (Monaco) and asserts that expected output
|
||||||
* features exist
|
* features exist
|
||||||
*/
|
*/
|
||||||
public class BasemapTest {
|
class BasemapTest {
|
||||||
|
|
||||||
@TempDir
|
@TempDir
|
||||||
static Path tmpDir;
|
static Path tmpDir;
|
||||||
@@ -67,7 +67,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMetadata() {
|
void testMetadata() {
|
||||||
Map<String, String> metadata = mbtiles.metadata().getAll();
|
Map<String, String> metadata = mbtiles.metadata().getAll();
|
||||||
assertEquals("OpenMapTiles", metadata.get("name"));
|
assertEquals("OpenMapTiles", metadata.get("name"));
|
||||||
assertEquals("0", metadata.get("minzoom"));
|
assertEquals("0", metadata.get("minzoom"));
|
||||||
@@ -82,7 +82,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ensureValidGeometries() throws Exception {
|
void ensureValidGeometries() throws Exception {
|
||||||
Set<Mbtiles.TileEntry> parsedTiles = TestUtils.getAllTiles(mbtiles);
|
Set<Mbtiles.TileEntry> parsedTiles = TestUtils.getAllTiles(mbtiles);
|
||||||
for (var tileEntry : parsedTiles) {
|
for (var tileEntry : parsedTiles) {
|
||||||
var decoded = VectorTile.decode(gunzip(tileEntry.bytes()));
|
var decoded = VectorTile.decode(gunzip(tileEntry.bytes()));
|
||||||
@@ -93,14 +93,14 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContainsOceanPolyons() {
|
void testContainsOceanPolyons() {
|
||||||
assertFeatureNear(mbtiles, "water", Map.of(
|
assertFeatureNear(mbtiles, "water", Map.of(
|
||||||
"class", "ocean"
|
"class", "ocean"
|
||||||
), 7.4484, 43.70783, 0, 14);
|
), 7.4484, 43.70783, 0, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContainsCountryName() {
|
void testContainsCountryName() {
|
||||||
assertFeatureNear(mbtiles, "place", Map.of(
|
assertFeatureNear(mbtiles, "place", Map.of(
|
||||||
"class", "country",
|
"class", "country",
|
||||||
"iso_a2", "MC",
|
"iso_a2", "MC",
|
||||||
@@ -109,7 +109,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContainsSuburb() {
|
void testContainsSuburb() {
|
||||||
assertFeatureNear(mbtiles, "place", Map.of(
|
assertFeatureNear(mbtiles, "place", Map.of(
|
||||||
"name", "Les Moneghetti",
|
"name", "Les Moneghetti",
|
||||||
"class", "suburb"
|
"class", "suburb"
|
||||||
@@ -117,14 +117,14 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContainsBuildings() {
|
void testContainsBuildings() {
|
||||||
assertFeatureNear(mbtiles, "building", Map.of(), 7.41919, 43.73401, 13, 14);
|
assertFeatureNear(mbtiles, "building", Map.of(), 7.41919, 43.73401, 13, 14);
|
||||||
assertNumFeatures("building", Map.of(), 14, 1316, Polygon.class);
|
assertNumFeatures("building", Map.of(), 14, 1316, Polygon.class);
|
||||||
assertNumFeatures("building", Map.of(), 13, 196, Polygon.class);
|
assertNumFeatures("building", Map.of(), 13, 196, Polygon.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContainsHousenumber() {
|
void testContainsHousenumber() {
|
||||||
assertFeatureNear(mbtiles, "housenumber", Map.of(
|
assertFeatureNear(mbtiles, "housenumber", Map.of(
|
||||||
"housenumber", "27"
|
"housenumber", "27"
|
||||||
), 7.42117, 43.73652, 14, 14);
|
), 7.42117, 43.73652, 14, 14);
|
||||||
@@ -132,7 +132,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBoundary() {
|
void testBoundary() {
|
||||||
assertFeatureNear(mbtiles, "boundary", Map.of(
|
assertFeatureNear(mbtiles, "boundary", Map.of(
|
||||||
"admin_level", 2L,
|
"admin_level", 2L,
|
||||||
"maritime", 1L,
|
"maritime", 1L,
|
||||||
@@ -141,7 +141,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAeroway() {
|
void testAeroway() {
|
||||||
assertNumFeatures("aeroway", Map.of(
|
assertNumFeatures("aeroway", Map.of(
|
||||||
"class", "heliport"
|
"class", "heliport"
|
||||||
), 14, 1, Polygon.class);
|
), 14, 1, Polygon.class);
|
||||||
@@ -151,7 +151,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLandcover() {
|
void testLandcover() {
|
||||||
assertNumFeatures("landcover", Map.of(
|
assertNumFeatures("landcover", Map.of(
|
||||||
"class", "grass",
|
"class", "grass",
|
||||||
"subclass", "park"
|
"subclass", "park"
|
||||||
@@ -163,7 +163,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPoi() {
|
void testPoi() {
|
||||||
assertNumFeatures("poi", Map.of(
|
assertNumFeatures("poi", Map.of(
|
||||||
"class", "restaurant",
|
"class", "restaurant",
|
||||||
"subclass", "restaurant"
|
"subclass", "restaurant"
|
||||||
@@ -175,7 +175,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLanduse() {
|
void testLanduse() {
|
||||||
assertNumFeatures("landuse", Map.of(
|
assertNumFeatures("landuse", Map.of(
|
||||||
"class", "residential"
|
"class", "residential"
|
||||||
), 14, 8, Polygon.class);
|
), 14, 8, Polygon.class);
|
||||||
@@ -185,7 +185,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransportation() {
|
void testTransportation() {
|
||||||
assertNumFeatures("transportation", Map.of(
|
assertNumFeatures("transportation", Map.of(
|
||||||
"class", "path",
|
"class", "path",
|
||||||
"subclass", "footway"
|
"subclass", "footway"
|
||||||
@@ -196,7 +196,7 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransportationName() {
|
void testTransportationName() {
|
||||||
assertNumFeatures("transportation_name", Map.of(
|
assertNumFeatures("transportation_name", Map.of(
|
||||||
"name", "Boulevard du Larvotto",
|
"name", "Boulevard du Larvotto",
|
||||||
"class", "primary"
|
"class", "primary"
|
||||||
@@ -204,14 +204,14 @@ public class BasemapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterway() {
|
void testWaterway() {
|
||||||
assertNumFeatures("waterway", Map.of(
|
assertNumFeatures("waterway", Map.of(
|
||||||
"class", "stream"
|
"class", "stream"
|
||||||
), 14, 6, LineString.class);
|
), 14, 6, LineString.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestFactory
|
@TestFactory
|
||||||
public Stream<DynamicTest> testVerifyChecks() {
|
Stream<DynamicTest> testVerifyChecks() {
|
||||||
return VerifyMonaco.verify(mbtiles).results().stream()
|
return VerifyMonaco.verify(mbtiles).results().stream()
|
||||||
.map(check -> dynamicTest(check.name(), () -> {
|
.map(check -> dynamicTest(check.name(), () -> {
|
||||||
check.error().ifPresent(Assertions::fail);
|
check.error().ifPresent(Assertions::fail);
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ import org.junit.jupiter.api.DynamicTest;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestFactory;
|
import org.junit.jupiter.api.TestFactory;
|
||||||
|
|
||||||
public class GenerateTest {
|
class GenerateTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseSimple() {
|
void testParseSimple() {
|
||||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||||
output:
|
output:
|
||||||
key: value
|
key: value
|
||||||
@@ -36,7 +36,7 @@ public class GenerateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseAnd() {
|
void testParseAnd() {
|
||||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||||
output:
|
output:
|
||||||
__AND__:
|
__AND__:
|
||||||
@@ -52,7 +52,7 @@ public class GenerateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseAndWithOthers() {
|
void testParseAndWithOthers() {
|
||||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||||
output:
|
output:
|
||||||
- key0: val0
|
- key0: val0
|
||||||
@@ -72,7 +72,7 @@ public class GenerateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseAndContainingOthers() {
|
void testParseAndContainingOthers() {
|
||||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||||
output:
|
output:
|
||||||
__AND__:
|
__AND__:
|
||||||
@@ -93,7 +93,7 @@ public class GenerateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseContainsKey() {
|
void testParseContainsKey() {
|
||||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||||
output:
|
output:
|
||||||
key1: val1
|
key1: val1
|
||||||
@@ -108,7 +108,7 @@ public class GenerateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestFactory
|
@TestFactory
|
||||||
public Stream<DynamicTest> testParseImposm3Mapping() {
|
Stream<DynamicTest> testParseImposm3Mapping() {
|
||||||
record TestCase(String name, String mapping, String require, String reject, Expression expected) {
|
record TestCase(String name, String mapping, String require, String reject, Expression expected) {
|
||||||
|
|
||||||
TestCase(String mapping, Expression expected) {
|
TestCase(String mapping, Expression expected) {
|
||||||
@@ -184,7 +184,7 @@ public class GenerateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTypeMappingTopLevelType() {
|
void testTypeMappingTopLevelType() {
|
||||||
Expression parsed = Generate
|
Expression parsed = Generate
|
||||||
.parseImposm3MappingExpression("point", parseYaml("""
|
.parseImposm3MappingExpression("point", parseYaml("""
|
||||||
key: val
|
key: val
|
||||||
@@ -196,7 +196,7 @@ public class GenerateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTypeMappings() {
|
void testTypeMappings() {
|
||||||
Map<String, JsonNode> props = new LinkedHashMap<>();
|
Map<String, JsonNode> props = new LinkedHashMap<>();
|
||||||
props.put("points", parseYaml("""
|
props.put("points", parseYaml("""
|
||||||
key: val
|
key: val
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.Map;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class AerodromeLabelTest extends AbstractLayerTest {
|
class AerodromeLabelTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setupWikidataTranslation() {
|
public void setupWikidataTranslation() {
|
||||||
@@ -13,7 +13,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntlWithIata() {
|
void testIntlWithIata() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "international",
|
"class", "international",
|
||||||
"ele", 100,
|
"ele", 100,
|
||||||
@@ -38,7 +38,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInternational() {
|
void testInternational() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "international",
|
"class", "international",
|
||||||
"_layer", "aerodrome_label",
|
"_layer", "aerodrome_label",
|
||||||
@@ -50,7 +50,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPublic() {
|
void testPublic() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "public",
|
"class", "public",
|
||||||
"_layer", "aerodrome_label",
|
"_layer", "aerodrome_label",
|
||||||
@@ -69,7 +69,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMilitary() {
|
void testMilitary() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "military",
|
"class", "military",
|
||||||
"_layer", "aerodrome_label",
|
"_layer", "aerodrome_label",
|
||||||
@@ -88,7 +88,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPrivate() {
|
void testPrivate() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "private",
|
"class", "private",
|
||||||
"_layer", "aerodrome_label",
|
"_layer", "aerodrome_label",
|
||||||
@@ -107,7 +107,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOther() {
|
void testOther() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "other",
|
"class", "other",
|
||||||
"_layer", "aerodrome_label",
|
"_layer", "aerodrome_label",
|
||||||
@@ -118,7 +118,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreNonPoints() {
|
void testIgnoreNonPoints() {
|
||||||
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
||||||
"aeroway", "aerodrome"
|
"aeroway", "aerodrome"
|
||||||
))));
|
))));
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class AerowayTest extends AbstractLayerTest {
|
class AerowayTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void aerowayGate() {
|
void aerowayGate() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "gate",
|
"class", "gate",
|
||||||
"ref", "123",
|
"ref", "123",
|
||||||
@@ -30,7 +30,7 @@ public class AerowayTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void aerowayLine() {
|
void aerowayLine() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "runway",
|
"class", "runway",
|
||||||
"ref", "123",
|
"ref", "123",
|
||||||
@@ -50,7 +50,7 @@ public class AerowayTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void aerowayPolygon() {
|
void aerowayPolygon() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "runway",
|
"class", "runway",
|
||||||
"ref", "123",
|
"ref", "123",
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import java.util.Map;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class BoundaryTest extends AbstractLayerTest {
|
class BoundaryTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNaturalEarthCountryBoundaries() {
|
void testNaturalEarthCountryBoundaries() {
|
||||||
assertCoversZoomRange(
|
assertCoversZoomRange(
|
||||||
0, 4, "boundary",
|
0, 4, "boundary",
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
@@ -124,7 +124,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNaturalEarthStateBoundaries() {
|
void testNaturalEarthStateBoundaries() {
|
||||||
assertFeatures(0, List.of(Map.of(
|
assertFeatures(0, List.of(Map.of(
|
||||||
"_layer", "boundary",
|
"_layer", "boundary",
|
||||||
"_type", "line",
|
"_type", "line",
|
||||||
@@ -184,13 +184,13 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergesDisconnectedLineFeatures() throws GeometryException {
|
void testMergesDisconnectedLineFeatures() throws GeometryException {
|
||||||
testMergesLinestrings(Map.of("admin_level", 2), Boundary.LAYER_NAME, 10, 13);
|
testMergesLinestrings(Map.of("admin_level", 2), Boundary.LAYER_NAME, 10, 13);
|
||||||
testMergesLinestrings(Map.of("admin_level", 2), Boundary.LAYER_NAME, 10, 14);
|
testMergesLinestrings(Map.of("admin_level", 2), Boundary.LAYER_NAME, 10, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmTownBoundary() {
|
void testOsmTownBoundary() {
|
||||||
var relation = new OsmElement.Relation(1);
|
var relation = new OsmElement.Relation(1);
|
||||||
relation.setTag("type", "boundary");
|
relation.setTag("type", "boundary");
|
||||||
relation.setTag("admin_level", "10");
|
relation.setTag("admin_level", "10");
|
||||||
@@ -213,7 +213,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmBoundaryLevelTwoAndAHalf() {
|
void testOsmBoundaryLevelTwoAndAHalf() {
|
||||||
var relation = new OsmElement.Relation(1);
|
var relation = new OsmElement.Relation(1);
|
||||||
relation.setTag("type", "boundary");
|
relation.setTag("type", "boundary");
|
||||||
relation.setTag("admin_level", "2.5");
|
relation.setTag("admin_level", "2.5");
|
||||||
@@ -236,7 +236,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmBoundaryTakesMinAdminLevel() {
|
void testOsmBoundaryTakesMinAdminLevel() {
|
||||||
var relation1 = new OsmElement.Relation(1);
|
var relation1 = new OsmElement.Relation(1);
|
||||||
relation1.setTag("type", "boundary");
|
relation1.setTag("type", "boundary");
|
||||||
relation1.setTag("admin_level", "10");
|
relation1.setTag("admin_level", "10");
|
||||||
@@ -263,7 +263,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmBoundarySetsMaritimeFromWay() {
|
void testOsmBoundarySetsMaritimeFromWay() {
|
||||||
var relation1 = new OsmElement.Relation(1);
|
var relation1 = new OsmElement.Relation(1);
|
||||||
relation1.setTag("type", "boundary");
|
relation1.setTag("type", "boundary");
|
||||||
relation1.setTag("admin_level", "10");
|
relation1.setTag("admin_level", "10");
|
||||||
@@ -296,7 +296,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoresProtectedAreas() {
|
void testIgnoresProtectedAreas() {
|
||||||
var relation1 = new OsmElement.Relation(1);
|
var relation1 = new OsmElement.Relation(1);
|
||||||
relation1.setTag("type", "boundary");
|
relation1.setTag("type", "boundary");
|
||||||
relation1.setTag("admin_level", "10");
|
relation1.setTag("admin_level", "10");
|
||||||
@@ -306,7 +306,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoresProtectedAdminLevelOver10() {
|
void testIgnoresProtectedAdminLevelOver10() {
|
||||||
var relation1 = new OsmElement.Relation(1);
|
var relation1 = new OsmElement.Relation(1);
|
||||||
relation1.setTag("type", "boundary");
|
relation1.setTag("type", "boundary");
|
||||||
relation1.setTag("admin_level", "11");
|
relation1.setTag("admin_level", "11");
|
||||||
@@ -316,7 +316,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmBoundaryDisputed() {
|
void testOsmBoundaryDisputed() {
|
||||||
var relation = new OsmElement.Relation(1);
|
var relation = new OsmElement.Relation(1);
|
||||||
relation.setTag("type", "boundary");
|
relation.setTag("type", "boundary");
|
||||||
relation.setTag("admin_level", "5");
|
relation.setTag("admin_level", "5");
|
||||||
@@ -340,7 +340,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmBoundaryDisputedFromWay() {
|
void testOsmBoundaryDisputedFromWay() {
|
||||||
var relation = new OsmElement.Relation(1);
|
var relation = new OsmElement.Relation(1);
|
||||||
relation.setTag("type", "boundary");
|
relation.setTag("type", "boundary");
|
||||||
relation.setTag("admin_level", "5");
|
relation.setTag("admin_level", "5");
|
||||||
@@ -380,7 +380,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCountryBoundaryEmittedIfNoName() {
|
void testCountryBoundaryEmittedIfNoName() {
|
||||||
var relation = new OsmElement.Relation(1);
|
var relation = new OsmElement.Relation(1);
|
||||||
relation.setTag("type", "boundary");
|
relation.setTag("type", "boundary");
|
||||||
relation.setTag("admin_level", "2");
|
relation.setTag("admin_level", "2");
|
||||||
@@ -400,7 +400,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCountryLeftRightName() {
|
void testCountryLeftRightName() {
|
||||||
var country1 = new OsmElement.Relation(1);
|
var country1 = new OsmElement.Relation(1);
|
||||||
country1.setTag("type", "boundary");
|
country1.setTag("type", "boundary");
|
||||||
country1.setTag("admin_level", "2");
|
country1.setTag("admin_level", "2");
|
||||||
@@ -504,7 +504,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCountryBoundaryNotClosed() {
|
void testCountryBoundaryNotClosed() {
|
||||||
var country1 = new OsmElement.Relation(1);
|
var country1 = new OsmElement.Relation(1);
|
||||||
country1.setTag("type", "boundary");
|
country1.setTag("type", "boundary");
|
||||||
country1.setTag("admin_level", "2");
|
country1.setTag("admin_level", "2");
|
||||||
@@ -536,7 +536,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedCountry() throws GeometryException {
|
void testNestedCountry() throws GeometryException {
|
||||||
var country1 = new OsmElement.Relation(1);
|
var country1 = new OsmElement.Relation(1);
|
||||||
country1.setTag("type", "boundary");
|
country1.setTag("type", "boundary");
|
||||||
country1.setTag("admin_level", "2");
|
country1.setTag("admin_level", "2");
|
||||||
@@ -574,7 +574,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDontLabelBadPolygon() {
|
void testDontLabelBadPolygon() {
|
||||||
var country1 = new OsmElement.Relation(1);
|
var country1 = new OsmElement.Relation(1);
|
||||||
country1.setTag("type", "boundary");
|
country1.setTag("type", "boundary");
|
||||||
country1.setTag("admin_level", "2");
|
country1.setTag("admin_level", "2");
|
||||||
@@ -600,7 +600,7 @@ public class BoundaryTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreBadPolygonAndLabelGoodPart() throws GeometryException {
|
void testIgnoreBadPolygonAndLabelGoodPart() throws GeometryException {
|
||||||
var country1 = new OsmElement.Relation(1);
|
var country1 = new OsmElement.Relation(1);
|
||||||
country1.setTag("type", "boundary");
|
country1.setTag("type", "boundary");
|
||||||
country1.setTag("admin_level", "2");
|
country1.setTag("admin_level", "2");
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class BuildingTest extends AbstractLayerTest {
|
class BuildingTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBuilding() {
|
void testBuilding() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"colour", "<null>",
|
"colour", "<null>",
|
||||||
"hide_3d", "<null>",
|
"hide_3d", "<null>",
|
||||||
@@ -42,7 +42,7 @@ public class BuildingTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreUndergroundBuilding() {
|
void testIgnoreUndergroundBuilding() {
|
||||||
assertFeatures(14, List.of(), process(polygonFeature(Map.of(
|
assertFeatures(14, List.of(), process(polygonFeature(Map.of(
|
||||||
"building", "yes",
|
"building", "yes",
|
||||||
"location", "underground"
|
"location", "underground"
|
||||||
@@ -50,7 +50,7 @@ public class BuildingTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAirportBuildings() {
|
void testAirportBuildings() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "building",
|
"_layer", "building",
|
||||||
"_type", "polygon"
|
"_type", "polygon"
|
||||||
@@ -66,7 +66,7 @@ public class BuildingTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRenderHeights() {
|
void testRenderHeights() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"render_height", "<null>",
|
"render_height", "<null>",
|
||||||
"render_min_height", "<null>"
|
"render_min_height", "<null>"
|
||||||
@@ -103,7 +103,7 @@ public class BuildingTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOutlineHides3d() {
|
void testOutlineHides3d() {
|
||||||
var relation = new OsmElement.Relation(1);
|
var relation = new OsmElement.Relation(1);
|
||||||
relation.setTag("type", "building");
|
relation.setTag("type", "building");
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ public class BuildingTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergePolygonsZ13() throws GeometryException {
|
void testMergePolygonsZ13() throws GeometryException {
|
||||||
var poly1 = new VectorTile.Feature(
|
var poly1 = new VectorTile.Feature(
|
||||||
Building.LAYER_NAME,
|
Building.LAYER_NAME,
|
||||||
1,
|
1,
|
||||||
@@ -153,7 +153,7 @@ public class BuildingTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testColor() {
|
void testColor() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"colour", "#ff0000"
|
"colour", "#ff0000"
|
||||||
)), process(polygonFeature(Map.of(
|
)), process(polygonFeature(Map.of(
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class HousenumberTest extends AbstractLayerTest {
|
class HousenumberTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHousenumber() {
|
void testHousenumber() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"_layer", "housenumber",
|
"_layer", "housenumber",
|
||||||
"_type", "point",
|
"_type", "point",
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class LandcoverTest extends AbstractLayerTest {
|
class LandcoverTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNaturalEarthGlaciers() {
|
void testNaturalEarthGlaciers() {
|
||||||
var glacier1 = process(SimpleFeature.create(
|
var glacier1 = process(SimpleFeature.create(
|
||||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||||
Map.of(),
|
Map.of(),
|
||||||
@@ -64,7 +64,7 @@ public class LandcoverTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNaturalEarthAntarcticIceShelves() {
|
void testNaturalEarthAntarcticIceShelves() {
|
||||||
var ice1 = process(SimpleFeature.create(
|
var ice1 = process(SimpleFeature.create(
|
||||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||||
Map.of(),
|
Map.of(),
|
||||||
@@ -98,7 +98,7 @@ public class LandcoverTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmLandcover() {
|
void testOsmLandcover() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "landcover",
|
"_layer", "landcover",
|
||||||
"subclass", "wood",
|
"subclass", "wood",
|
||||||
@@ -136,7 +136,7 @@ public class LandcoverTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergeForestsBuNumPointsZ9to13() throws GeometryException {
|
void testMergeForestsBuNumPointsZ9to13() throws GeometryException {
|
||||||
Map<String, Object> map = Map.of("subclass", "wood");
|
Map<String, Object> map = Map.of("subclass", "wood");
|
||||||
|
|
||||||
assertMerges(List.of(map, map, map, map, map, map), List.of(
|
assertMerges(List.of(map, map, map, map, map, map), List.of(
|
||||||
@@ -171,7 +171,7 @@ public class LandcoverTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergeNonForestsBelowZ9() throws GeometryException {
|
void testMergeNonForestsBelowZ9() throws GeometryException {
|
||||||
Map<String, Object> map = Map.of("subclass", "dune");
|
Map<String, Object> map = Map.of("subclass", "dune");
|
||||||
|
|
||||||
assertMerges(List.of(map, map), List.of(
|
assertMerges(List.of(map, map), List.of(
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class LanduseTest extends AbstractLayerTest {
|
class LanduseTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNaturalEarthUrbanAreas() {
|
void testNaturalEarthUrbanAreas() {
|
||||||
assertFeatures(0, List.of(Map.of(
|
assertFeatures(0, List.of(Map.of(
|
||||||
"_layer", "landuse",
|
"_layer", "landuse",
|
||||||
"class", "residential",
|
"class", "residential",
|
||||||
@@ -34,7 +34,7 @@ public class LanduseTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmLanduse() {
|
void testOsmLanduse() {
|
||||||
assertFeatures(13, List.of(
|
assertFeatures(13, List.of(
|
||||||
Map.of("_layer", "poi"),
|
Map.of("_layer", "poi"),
|
||||||
Map.of(
|
Map.of(
|
||||||
@@ -59,7 +59,7 @@ public class LanduseTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGraveYardBecomesCemetery() {
|
void testGraveYardBecomesCemetery() {
|
||||||
assertFeatures(14, List.of(
|
assertFeatures(14, List.of(
|
||||||
Map.of("_layer", "poi"),
|
Map.of("_layer", "poi"),
|
||||||
Map.of(
|
Map.of(
|
||||||
@@ -71,7 +71,7 @@ public class LanduseTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOsmLanduseLowerZoom() {
|
void testOsmLanduseLowerZoom() {
|
||||||
assertFeatures(6, List.of(Map.of(
|
assertFeatures(6, List.of(Map.of(
|
||||||
"_layer", "landuse",
|
"_layer", "landuse",
|
||||||
"class", "suburb",
|
"class", "suburb",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.util.Map;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class MountainPeakTest extends AbstractLayerTest {
|
class MountainPeakTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setupWikidataTranslation() {
|
public void setupWikidataTranslation() {
|
||||||
@@ -24,7 +24,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHappyPath() {
|
void testHappyPath() {
|
||||||
var peak = process(pointFeature(Map.of(
|
var peak = process(pointFeature(Map.of(
|
||||||
"natural", "peak",
|
"natural", "peak",
|
||||||
"name", "test",
|
"name", "test",
|
||||||
@@ -51,7 +51,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLabelGrid() {
|
void testLabelGrid() {
|
||||||
var peak = process(pointFeature(Map.of(
|
var peak = process(pointFeature(Map.of(
|
||||||
"natural", "peak",
|
"natural", "peak",
|
||||||
"ele", "100"
|
"ele", "100"
|
||||||
@@ -66,7 +66,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testVolcano() {
|
void testVolcano() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "volcano"
|
"class", "volcano"
|
||||||
)), process(pointFeature(Map.of(
|
)), process(pointFeature(Map.of(
|
||||||
@@ -76,7 +76,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSaddle() {
|
void testSaddle() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "saddle"
|
"class", "saddle"
|
||||||
)), process(pointFeature(Map.of(
|
)), process(pointFeature(Map.of(
|
||||||
@@ -87,14 +87,14 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoElevation() {
|
void testNoElevation() {
|
||||||
assertFeatures(14, List.of(), process(pointFeature(Map.of(
|
assertFeatures(14, List.of(), process(pointFeature(Map.of(
|
||||||
"natural", "volcano"
|
"natural", "volcano"
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBogusElevation() {
|
void testBogusElevation() {
|
||||||
assertFeatures(14, List.of(), process(pointFeature(Map.of(
|
assertFeatures(14, List.of(), process(pointFeature(Map.of(
|
||||||
"natural", "volcano",
|
"natural", "volcano",
|
||||||
"ele", "11000"
|
"ele", "11000"
|
||||||
@@ -102,7 +102,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnorePeakLines() {
|
void testIgnorePeakLines() {
|
||||||
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
||||||
"natural", "peak",
|
"natural", "peak",
|
||||||
"name", "name",
|
"name", "name",
|
||||||
@@ -111,7 +111,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMountainLinestring() {
|
void testMountainLinestring() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "ridge",
|
"class", "ridge",
|
||||||
"name", "Ridge",
|
"name", "Ridge",
|
||||||
@@ -128,7 +128,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomaryFt() {
|
void testCustomaryFt() {
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
rectangle(0, 0.1),
|
rectangle(0, 0.1),
|
||||||
Map.of("iso_a2", "US"),
|
Map.of("iso_a2", "US"),
|
||||||
@@ -180,7 +180,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSortKey() {
|
void testSortKey() {
|
||||||
assertAscending(
|
assertAscending(
|
||||||
getSortKey(Map.of(
|
getSortKey(Map.of(
|
||||||
"natural", "peak",
|
"natural", "peak",
|
||||||
@@ -201,7 +201,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMountainPeakPostProcessing() throws GeometryException {
|
void testMountainPeakPostProcessing() throws GeometryException {
|
||||||
assertEquals(List.of(), profile.postProcessLayerFeatures(MountainPeak.LAYER_NAME, 13, List.of()));
|
assertEquals(List.of(), profile.postProcessLayerFeatures(MountainPeak.LAYER_NAME, 13, List.of()));
|
||||||
|
|
||||||
assertEquals(List.of(pointFeature(
|
assertEquals(List.of(pointFeature(
|
||||||
@@ -248,7 +248,7 @@ public class MountainPeakTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMountainPeakPostProcessingLimitsFeaturesOutsideZoom() throws GeometryException {
|
void testMountainPeakPostProcessingLimitsFeaturesOutsideZoom() throws GeometryException {
|
||||||
assertEquals(Lists.newArrayList(
|
assertEquals(Lists.newArrayList(
|
||||||
new VectorTile.Feature(
|
new VectorTile.Feature(
|
||||||
MountainPeak.LAYER_NAME,
|
MountainPeak.LAYER_NAME,
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class ParkTest extends AbstractLayerTest {
|
class ParkTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNationalPark() {
|
void testNationalPark() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "park",
|
"_layer", "park",
|
||||||
"_type", "polygon",
|
"_type", "polygon",
|
||||||
@@ -46,7 +46,7 @@ public class ParkTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSmallerPark() {
|
void testSmallerPark() {
|
||||||
double z11area = Math.pow((GeoUtils.metersToPixelAtEquator(0, Math.sqrt(70_000)) / 256d), 2) * Math.pow(2, 20 - 11);
|
double z11area = Math.pow((GeoUtils.metersToPixelAtEquator(0, Math.sqrt(70_000)) / 256d), 2) * Math.pow(2, 20 - 11);
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "park",
|
"_layer", "park",
|
||||||
@@ -85,7 +85,7 @@ public class ParkTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSortKeys() {
|
void testSortKeys() {
|
||||||
assertAscending(
|
assertAscending(
|
||||||
getLabelSortKey(1, Map.of(
|
getLabelSortKey(1, Map.of(
|
||||||
"boundary", "national_park",
|
"boundary", "national_park",
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class PlaceTest extends AbstractLayerTest {
|
class PlaceTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContinent() {
|
void testContinent() {
|
||||||
wikidataTranslations.put(49, "es", "América del Norte y América Central");
|
wikidataTranslations.put(49, "es", "América del Norte y América Central");
|
||||||
assertFeatures(0, List.of(Map.of(
|
assertFeatures(0, List.of(Map.of(
|
||||||
"_layer", "place",
|
"_layer", "place",
|
||||||
@@ -44,7 +44,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCountry() {
|
void testCountry() {
|
||||||
wikidataTranslations.put(30, "es", "Estados Unidos");
|
wikidataTranslations.put(30, "es", "Estados Unidos");
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
rectangle(0, 0.25),
|
rectangle(0, 0.25),
|
||||||
@@ -112,7 +112,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testState() {
|
void testState() {
|
||||||
wikidataTranslations.put(771, "es", "Massachusetts es");
|
wikidataTranslations.put(771, "es", "Massachusetts es");
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
rectangle(0, 0.25),
|
rectangle(0, 0.25),
|
||||||
@@ -195,7 +195,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProvince() {
|
void testProvince() {
|
||||||
wikidataTranslations.put(95027, "es", "provincia de Lugo");
|
wikidataTranslations.put(95027, "es", "provincia de Lugo");
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
rectangle(0, 0.25),
|
rectangle(0, 0.25),
|
||||||
@@ -233,7 +233,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIslandPoint() {
|
void testIslandPoint() {
|
||||||
assertFeatures(0, List.of(Map.of(
|
assertFeatures(0, List.of(Map.of(
|
||||||
"_layer", "place",
|
"_layer", "place",
|
||||||
"class", "island",
|
"class", "island",
|
||||||
@@ -253,7 +253,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIslandPolygon() {
|
void testIslandPolygon() {
|
||||||
assertFeatures(0, List.of(Map.of(
|
assertFeatures(0, List.of(Map.of(
|
||||||
"_layer", "place",
|
"_layer", "place",
|
||||||
"class", "island",
|
"class", "island",
|
||||||
@@ -290,7 +290,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPlaceSortKeyRanking() {
|
void testPlaceSortKeyRanking() {
|
||||||
int[] sortKeys = new int[]{
|
int[] sortKeys = new int[]{
|
||||||
// max
|
// max
|
||||||
getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||||
@@ -324,7 +324,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCountryCapital() {
|
void testCountryCapital() {
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
newPoint(0, 0),
|
newPoint(0, 0),
|
||||||
Map.of(
|
Map.of(
|
||||||
@@ -358,7 +358,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStateCapital() {
|
void testStateCapital() {
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
newPoint(0, 0),
|
newPoint(0, 0),
|
||||||
Map.of(
|
Map.of(
|
||||||
@@ -434,7 +434,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCityWithoutNaturalEarthMatch() {
|
void testCityWithoutNaturalEarthMatch() {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "place",
|
"_layer", "place",
|
||||||
"class", "city",
|
"class", "city",
|
||||||
@@ -474,7 +474,7 @@ public class PlaceTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCitySetRankFromGridrank() throws GeometryException {
|
void testCitySetRankFromGridrank() throws GeometryException {
|
||||||
var layerName = Place.LAYER_NAME;
|
var layerName = Place.LAYER_NAME;
|
||||||
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
public class PoiTest extends AbstractLayerTest {
|
class PoiTest extends AbstractLayerTest {
|
||||||
|
|
||||||
private SourceFeature feature(boolean area, Map<String, Object> tags) {
|
private SourceFeature feature(boolean area, Map<String, Object> tags) {
|
||||||
return area ? polygonFeature(tags) : pointFeature(tags);
|
return area ? polygonFeature(tags) : pointFeature(tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFenwayPark() {
|
void testFenwayPark() {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "stadium",
|
"class", "stadium",
|
||||||
@@ -34,7 +34,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = {false, true})
|
@ValueSource(booleans = {false, true})
|
||||||
public void testFunicularHalt(boolean area) {
|
void testFunicularHalt(boolean area) {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "railway",
|
"class", "railway",
|
||||||
@@ -50,7 +50,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = {false, true})
|
@ValueSource(booleans = {false, true})
|
||||||
public void testSubway(boolean area) {
|
void testSubway(boolean area) {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "railway",
|
"class", "railway",
|
||||||
@@ -66,7 +66,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = {false, true})
|
@ValueSource(booleans = {false, true})
|
||||||
public void testPlaceOfWorshipFromReligionTag(boolean area) {
|
void testPlaceOfWorshipFromReligionTag(boolean area) {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "place_of_worship",
|
"class", "place_of_worship",
|
||||||
@@ -81,7 +81,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPitchFromSportTag() {
|
void testPitchFromSportTag() {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "pitch",
|
"class", "pitch",
|
||||||
@@ -96,7 +96,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = {false, true})
|
@ValueSource(booleans = {false, true})
|
||||||
public void testInformation(boolean area) {
|
void testInformation(boolean area) {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "information",
|
"class", "information",
|
||||||
@@ -117,7 +117,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = {false, true})
|
@ValueSource(booleans = {false, true})
|
||||||
public void testFerryTerminal(boolean area) {
|
void testFerryTerminal(boolean area) {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "ferry_terminal",
|
"class", "ferry_terminal",
|
||||||
@@ -135,7 +135,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGridRank() throws GeometryException {
|
void testGridRank() throws GeometryException {
|
||||||
var layerName = Poi.LAYER_NAME;
|
var layerName = Poi.LAYER_NAME;
|
||||||
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmbassy() {
|
void testEmbassy() {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "diplomatic",
|
"class", "diplomatic",
|
||||||
@@ -196,7 +196,7 @@ public class PoiTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLocksmith() {
|
void testLocksmith() {
|
||||||
assertFeatures(7, List.of(Map.of(
|
assertFeatures(7, List.of(Map.of(
|
||||||
"_layer", "poi",
|
"_layer", "poi",
|
||||||
"class", "shop",
|
"class", "shop",
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ import java.util.Map;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class TransportationTest extends AbstractLayerTest {
|
class TransportationTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamedFootway() {
|
void testNamedFootway() {
|
||||||
FeatureCollector result = process(lineFeature(Map.of(
|
FeatureCollector result = process(lineFeature(Map.of(
|
||||||
"name", "Lagoon Path",
|
"name", "Lagoon Path",
|
||||||
"surface", "asphalt",
|
"surface", "asphalt",
|
||||||
@@ -78,7 +78,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportantPath() {
|
void testImportantPath() {
|
||||||
var rel = new OsmElement.Relation(1);
|
var rel = new OsmElement.Relation(1);
|
||||||
|
|
||||||
rel.setTag("colour", "white");
|
rel.setTag("colour", "white");
|
||||||
@@ -128,7 +128,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnnamedPath() {
|
void testUnnamedPath() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "path",
|
"class", "path",
|
||||||
@@ -143,7 +143,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPrivatePath() {
|
void testPrivatePath() {
|
||||||
assertFeatures(9, List.of(Map.of(
|
assertFeatures(9, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "path",
|
"class", "path",
|
||||||
@@ -171,7 +171,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExpressway() {
|
void testExpressway() {
|
||||||
assertFeatures(8, List.of(Map.of(
|
assertFeatures(8, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "motorway",
|
"class", "motorway",
|
||||||
@@ -199,7 +199,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToll() {
|
void testToll() {
|
||||||
assertFeatures(9, List.of(Map.of(
|
assertFeatures(9, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "motorway",
|
"class", "motorway",
|
||||||
@@ -226,7 +226,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIndoorTunnelSteps() {
|
void testIndoorTunnelSteps() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "path",
|
"class", "path",
|
||||||
@@ -244,7 +244,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInterstateMotorway() {
|
void testInterstateMotorway() {
|
||||||
var rel = new OsmElement.Relation(1);
|
var rel = new OsmElement.Relation(1);
|
||||||
rel.setTag("type", "route");
|
rel.setTag("type", "route");
|
||||||
rel.setTag("route", "road");
|
rel.setTag("route", "road");
|
||||||
@@ -340,7 +340,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRouteWithoutNetworkType() {
|
void testRouteWithoutNetworkType() {
|
||||||
var rel1 = new OsmElement.Relation(1);
|
var rel1 = new OsmElement.Relation(1);
|
||||||
rel1.setTag("type", "route");
|
rel1.setTag("type", "route");
|
||||||
rel1.setTag("route", "road");
|
rel1.setTag("route", "road");
|
||||||
@@ -383,7 +383,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMinorRouteRef() {
|
void testMinorRouteRef() {
|
||||||
var rel1 = new OsmElement.Relation(1);
|
var rel1 = new OsmElement.Relation(1);
|
||||||
rel1.setTag("type", "route");
|
rel1.setTag("type", "route");
|
||||||
rel1.setTag("route", "road");
|
rel1.setTag("route", "road");
|
||||||
@@ -423,7 +423,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPolishHighwayIssue165() {
|
void testPolishHighwayIssue165() {
|
||||||
var rel1 = new OsmElement.Relation(1);
|
var rel1 = new OsmElement.Relation(1);
|
||||||
rel1.setTag("type", "route");
|
rel1.setTag("type", "route");
|
||||||
rel1.setTag("route", "road");
|
rel1.setTag("route", "road");
|
||||||
@@ -463,7 +463,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMotorwayJunction() {
|
void testMotorwayJunction() {
|
||||||
var otherNode1 = new OsmElement.Node(1, 1, 1);
|
var otherNode1 = new OsmElement.Node(1, 1, 1);
|
||||||
var junctionNode = new OsmElement.Node(2, 1, 2);
|
var junctionNode = new OsmElement.Node(2, 1, 2);
|
||||||
var otherNode2 = new OsmElement.Node(3, 1, 3);
|
var otherNode2 = new OsmElement.Node(3, 1, 3);
|
||||||
@@ -512,7 +512,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInterstateMotorwayWithoutWayInfo() {
|
void testInterstateMotorwayWithoutWayInfo() {
|
||||||
var rel = new OsmElement.Relation(1);
|
var rel = new OsmElement.Relation(1);
|
||||||
rel.setTag("type", "route");
|
rel.setTag("type", "route");
|
||||||
rel.setTag("route", "road");
|
rel.setTag("route", "road");
|
||||||
@@ -543,7 +543,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPrimaryRoadConstruction() {
|
void testPrimaryRoadConstruction() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "primary_construction",
|
"class", "primary_construction",
|
||||||
@@ -568,7 +568,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBridgeConstruction() {
|
void testBridgeConstruction() {
|
||||||
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
||||||
"highway", "construction",
|
"highway", "construction",
|
||||||
"construction", "bridge",
|
"construction", "bridge",
|
||||||
@@ -589,7 +589,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreManMadeWhenNotBridgeOrPier() {
|
void testIgnoreManMadeWhenNotBridgeOrPier() {
|
||||||
// https://github.com/onthegomap/planetiler/issues/69
|
// https://github.com/onthegomap/planetiler/issues/69
|
||||||
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
assertFeatures(14, List.of(), process(lineFeature(Map.of(
|
||||||
"man_made", "storage_tank",
|
"man_made", "storage_tank",
|
||||||
@@ -607,7 +607,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRaceway() {
|
void testRaceway() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "raceway",
|
"class", "raceway",
|
||||||
@@ -628,7 +628,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDriveway() {
|
void testDriveway() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "service",
|
"class", "service",
|
||||||
@@ -641,7 +641,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMountainBikeTrail() {
|
void testMountainBikeTrail() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "path",
|
"class", "path",
|
||||||
@@ -666,7 +666,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamedTrack() {
|
void testNamedTrack() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "track",
|
"class", "track",
|
||||||
@@ -687,7 +687,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnnamedTrack() {
|
void testUnnamedTrack() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "track",
|
"class", "track",
|
||||||
@@ -702,7 +702,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBusway() {
|
void testBusway() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "busway",
|
"class", "busway",
|
||||||
@@ -743,7 +743,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUSAndStateHighway() {
|
void testUSAndStateHighway() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "primary",
|
"class", "primary",
|
||||||
@@ -803,7 +803,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUsStateHighway() {
|
void testUsStateHighway() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "primary"
|
"class", "primary"
|
||||||
@@ -827,7 +827,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompoundRef() {
|
void testCompoundRef() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "primary",
|
"class", "primary",
|
||||||
@@ -851,7 +851,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransCanadaHighway() {
|
void testTransCanadaHighway() {
|
||||||
var rel = new OsmElement.Relation(1);
|
var rel = new OsmElement.Relation(1);
|
||||||
rel.setTag("type", "route");
|
rel.setTag("type", "route");
|
||||||
rel.setTag("route", "road");
|
rel.setTag("route", "road");
|
||||||
@@ -887,7 +887,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGreatBritainHighway() {
|
void testGreatBritainHighway() {
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
rectangle(0, 0.1),
|
rectangle(0, 0.1),
|
||||||
Map.of("iso_a2", "GB"),
|
Map.of("iso_a2", "GB"),
|
||||||
@@ -950,17 +950,17 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergesDisconnectedRoadFeatures() throws GeometryException {
|
void testMergesDisconnectedRoadFeatures() throws GeometryException {
|
||||||
testMergesLinestrings(Map.of("class", "motorway"), Transportation.LAYER_NAME, 10, 14);
|
testMergesLinestrings(Map.of("class", "motorway"), Transportation.LAYER_NAME, 10, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergesDisconnectedRoadNameFeatures() throws GeometryException {
|
void testMergesDisconnectedRoadNameFeatures() throws GeometryException {
|
||||||
testMergesLinestrings(Map.of("class", "motorway"), TransportationName.LAYER_NAME, 10, 14);
|
testMergesLinestrings(Map.of("class", "motorway"), TransportationName.LAYER_NAME, 10, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLightRail() {
|
void testLightRail() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "transit",
|
"class", "transit",
|
||||||
@@ -982,7 +982,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSubway() {
|
void testSubway() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "transit",
|
"class", "transit",
|
||||||
@@ -1005,7 +1005,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRail() {
|
void testRail() {
|
||||||
assertFeatures(8, List.of(Map.of(
|
assertFeatures(8, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "rail",
|
"class", "rail",
|
||||||
@@ -1047,7 +1047,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNarrowGauge() {
|
void testNarrowGauge() {
|
||||||
assertFeatures(10, List.of(Map.of(
|
assertFeatures(10, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "rail",
|
"class", "rail",
|
||||||
@@ -1062,7 +1062,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAerialway() {
|
void testAerialway() {
|
||||||
assertFeatures(12, List.of(Map.of(
|
assertFeatures(12, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "aerialway",
|
"class", "aerialway",
|
||||||
@@ -1092,7 +1092,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFerry() {
|
void testFerry() {
|
||||||
assertFeatures(10, List.of(Map.of(
|
assertFeatures(10, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "ferry",
|
"class", "ferry",
|
||||||
@@ -1126,7 +1126,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPiers() {
|
void testPiers() {
|
||||||
// area
|
// area
|
||||||
assertFeatures(10, List.of(Map.of(
|
assertFeatures(10, List.of(Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
@@ -1151,7 +1151,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPedestrianArea() {
|
void testPedestrianArea() {
|
||||||
Map<String, Object> pedestrianArea = Map.of(
|
Map<String, Object> pedestrianArea = Map.of(
|
||||||
"_layer", "transportation",
|
"_layer", "transportation",
|
||||||
"class", "path",
|
"class", "path",
|
||||||
@@ -1204,7 +1204,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSortKeys() {
|
void testSortKeys() {
|
||||||
assertDescending(
|
assertDescending(
|
||||||
getWaySortKey(Map.of("highway", "footway", "layer", "2")),
|
getWaySortKey(Map.of("highway", "footway", "layer", "2")),
|
||||||
getWaySortKey(Map.of("highway", "motorway", "bridge", "yes")),
|
getWaySortKey(Map.of("highway", "motorway", "bridge", "yes")),
|
||||||
@@ -1224,7 +1224,7 @@ public class TransportationTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransportationNameLayerRequiresTransportationLayer() {
|
void testTransportationNameLayerRequiresTransportationLayer() {
|
||||||
var profile = new BasemapProfile(translations, PlanetilerConfig.from(Arguments.of(
|
var profile = new BasemapProfile(translations, PlanetilerConfig.from(Arguments.of(
|
||||||
"only_layers", "transportation_name"
|
"only_layers", "transportation_name"
|
||||||
)), Stats.inMemory());
|
)), Stats.inMemory());
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ import java.util.Map;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
public class WaterNameTest extends AbstractLayerTest {
|
class WaterNameTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterNamePoint() {
|
void testWaterNamePoint() {
|
||||||
assertFeatures(11, List.of(Map.of(
|
assertFeatures(11, List.of(Map.of(
|
||||||
"_layer", "water"
|
"_layer", "water"
|
||||||
), Map.of(
|
), Map.of(
|
||||||
@@ -54,7 +54,7 @@ public class WaterNameTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterNameLakeline() {
|
void testWaterNameLakeline() {
|
||||||
assertFeatures(11, List.of(), process(SimpleFeature.create(
|
assertFeatures(11, List.of(), process(SimpleFeature.create(
|
||||||
newLineString(0, 0, 1, 1),
|
newLineString(0, 0, 1, 1),
|
||||||
new HashMap<>(Map.<String, Object>of(
|
new HashMap<>(Map.<String, Object>of(
|
||||||
@@ -91,7 +91,7 @@ public class WaterNameTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterNameMultipleLakelines() {
|
void testWaterNameMultipleLakelines() {
|
||||||
assertFeatures(11, List.of(), process(SimpleFeature.create(
|
assertFeatures(11, List.of(), process(SimpleFeature.create(
|
||||||
newLineString(0, 0, 1, 1),
|
newLineString(0, 0, 1, 1),
|
||||||
new HashMap<>(Map.<String, Object>of(
|
new HashMap<>(Map.<String, Object>of(
|
||||||
@@ -141,7 +141,7 @@ public class WaterNameTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMarinePoint() {
|
void testMarinePoint() {
|
||||||
assertFeatures(11, List.of(), process(SimpleFeature.create(
|
assertFeatures(11, List.of(), process(SimpleFeature.create(
|
||||||
newLineString(0, 0, 1, 1),
|
newLineString(0, 0, 1, 1),
|
||||||
new HashMap<>(Map.<String, Object>of(
|
new HashMap<>(Map.<String, Object>of(
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class WaterTest extends AbstractLayerTest {
|
class WaterTest extends AbstractLayerTest {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterNaturalEarth() {
|
void testWaterNaturalEarth() {
|
||||||
assertFeatures(0, List.of(Map.of(
|
assertFeatures(0, List.of(Map.of(
|
||||||
"class", "lake",
|
"class", "lake",
|
||||||
"intermittent", "<null>",
|
"intermittent", "<null>",
|
||||||
@@ -71,7 +71,7 @@ public class WaterTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterOsmWaterPolygon() {
|
void testWaterOsmWaterPolygon() {
|
||||||
assertFeatures(0, List.of(Map.of(
|
assertFeatures(0, List.of(Map.of(
|
||||||
"class", "ocean",
|
"class", "ocean",
|
||||||
"intermittent", "<null>",
|
"intermittent", "<null>",
|
||||||
@@ -89,7 +89,7 @@ public class WaterTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWater() {
|
void testWater() {
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "lake",
|
"class", "lake",
|
||||||
"_layer", "water",
|
"_layer", "water",
|
||||||
@@ -153,7 +153,7 @@ public class WaterTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRiverbank() {
|
void testRiverbank() {
|
||||||
assertFeatures(11, List.of(Map.of(
|
assertFeatures(11, List.of(Map.of(
|
||||||
"class", "river",
|
"class", "river",
|
||||||
"_layer", "water",
|
"_layer", "water",
|
||||||
@@ -164,7 +164,7 @@ public class WaterTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRiverk() {
|
void testRiverk() {
|
||||||
assertFeatures(11, List.of(Map.of(
|
assertFeatures(11, List.of(Map.of(
|
||||||
"class", "river",
|
"class", "river",
|
||||||
"_layer", "water",
|
"_layer", "water",
|
||||||
@@ -175,7 +175,7 @@ public class WaterTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSpring() {
|
void testSpring() {
|
||||||
assertFeatures(11, List.of(Map.of(
|
assertFeatures(11, List.of(Map.of(
|
||||||
"class", "lake",
|
"class", "lake",
|
||||||
"_layer", "water",
|
"_layer", "water",
|
||||||
@@ -186,7 +186,7 @@ public class WaterTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOceanZoomLevels() {
|
void testOceanZoomLevels() {
|
||||||
assertCoversZoomRange(0, 14, "water",
|
assertCoversZoomRange(0, 14, "water",
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
rectangle(0, 10),
|
rectangle(0, 10),
|
||||||
@@ -220,7 +220,7 @@ public class WaterTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLakeZoomLevels() {
|
void testLakeZoomLevels() {
|
||||||
assertCoversZoomRange(0, 14, "water",
|
assertCoversZoomRange(0, 14, "water",
|
||||||
process(SimpleFeature.create(
|
process(SimpleFeature.create(
|
||||||
rectangle(0, 10),
|
rectangle(0, 10),
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
public class WaterwayTest extends AbstractLayerTest {
|
class WaterwayTest extends AbstractLayerTest {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = {false, true})
|
@ValueSource(booleans = {false, true})
|
||||||
public void testOsmWaterwayRelation(boolean isLongEnough) throws GeometryException {
|
void testOsmWaterwayRelation(boolean isLongEnough) throws GeometryException {
|
||||||
var rel = new OsmElement.Relation(1);
|
var rel = new OsmElement.Relation(1);
|
||||||
rel.setTag("name", "River Relation");
|
rel.setTag("name", "River Relation");
|
||||||
rel.setTag("name:es", "ES name");
|
rel.setTag("name:es", "ES name");
|
||||||
@@ -83,7 +83,7 @@ public class WaterwayTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterwayImportantRiverProcess() {
|
void testWaterwayImportantRiverProcess() {
|
||||||
var charlesRiver = process(lineFeature(Map.of(
|
var charlesRiver = process(lineFeature(Map.of(
|
||||||
"waterway", "river",
|
"waterway", "river",
|
||||||
"name", "charles river",
|
"name", "charles river",
|
||||||
@@ -119,7 +119,7 @@ public class WaterwayTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterwayImportantRiverPostProcess() throws GeometryException {
|
void testWaterwayImportantRiverPostProcess() throws GeometryException {
|
||||||
var line1 = new VectorTile.Feature(
|
var line1 = new VectorTile.Feature(
|
||||||
Waterway.LAYER_NAME,
|
Waterway.LAYER_NAME,
|
||||||
1,
|
1,
|
||||||
@@ -157,7 +157,7 @@ public class WaterwayTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterwaySmaller() {
|
void testWaterwaySmaller() {
|
||||||
// river with no name is not important
|
// river with no name is not important
|
||||||
assertFeatures(14, List.of(Map.of(
|
assertFeatures(14, List.of(Map.of(
|
||||||
"class", "river",
|
"class", "river",
|
||||||
@@ -193,7 +193,7 @@ public class WaterwayTest extends AbstractLayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWaterwayNaturalEarth() {
|
void testWaterwayNaturalEarth() {
|
||||||
assertFeatures(3, List.of(Map.of(
|
assertFeatures(3, List.of(Map.of(
|
||||||
"class", "river",
|
"class", "river",
|
||||||
"name", "<null>",
|
"name", "<null>",
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.CsvSource;
|
import org.junit.jupiter.params.provider.CsvSource;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
public class LanguageUtilsTest {
|
class LanguageUtilsTest {
|
||||||
|
|
||||||
private final Wikidata.WikidataTranslations wikidataTranslations = new Wikidata.WikidataTranslations();
|
private final Wikidata.WikidataTranslations wikidataTranslations = new Wikidata.WikidataTranslations();
|
||||||
private final Translations translations = Translations.defaultProvider(List.of("en", "es", "de"))
|
private final Translations translations = Translations.defaultProvider(List.of("en", "es", "de"))
|
||||||
.addTranslationProvider(wikidataTranslations);
|
.addTranslationProvider(wikidataTranslations);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleExample() {
|
void testSimpleExample() {
|
||||||
assertSubmap(Map.of(
|
assertSubmap(Map.of(
|
||||||
"name", "name",
|
"name", "name",
|
||||||
"name_en", "english name",
|
"name_en", "english name",
|
||||||
@@ -68,7 +68,7 @@ public class LanguageUtilsTest {
|
|||||||
"日本, false",
|
"日本, false",
|
||||||
"abc本123, false",
|
"abc本123, false",
|
||||||
})
|
})
|
||||||
public void testIsLatin(String in, boolean isLatin) {
|
void testIsLatin(String in, boolean isLatin) {
|
||||||
if (!isLatin) {
|
if (!isLatin) {
|
||||||
assertFalse(containsOnlyLatinCharacters(in));
|
assertFalse(containsOnlyLatinCharacters(in));
|
||||||
} else {
|
} else {
|
||||||
@@ -89,7 +89,7 @@ public class LanguageUtilsTest {
|
|||||||
"Japan - 日本~+ , 日本~+",
|
"Japan - 日本~+ , 日本~+",
|
||||||
"Japan / 日本 / Japan , 日本",
|
"Japan / 日本 / Japan , 日本",
|
||||||
}, nullValues = "null")
|
}, nullValues = "null")
|
||||||
public void testRemoveNonLatin(String in, String out) {
|
void testRemoveNonLatin(String in, String out) {
|
||||||
assertEquals(out, LanguageUtils.getNames(Map.of(
|
assertEquals(out, LanguageUtils.getNames(Map.of(
|
||||||
"name", in
|
"name", in
|
||||||
), translations).get("name:nonlatin"));
|
), translations).get("name:nonlatin"));
|
||||||
@@ -134,7 +134,7 @@ public class LanguageUtilsTest {
|
|||||||
"name:gcf",
|
"name:gcf",
|
||||||
"name:gsw",
|
"name:gsw",
|
||||||
})
|
})
|
||||||
public void testLatinFallbacks(String key) {
|
void testLatinFallbacks(String key) {
|
||||||
assertEquals("a", LanguageUtils.getNames(Map.of(
|
assertEquals("a", LanguageUtils.getNames(Map.of(
|
||||||
key, "a"
|
key, "a"
|
||||||
), translations).get("name:latin"));
|
), translations).get("name:latin"));
|
||||||
@@ -164,7 +164,7 @@ public class LanguageUtilsTest {
|
|||||||
"name:etymology:left",
|
"name:etymology:left",
|
||||||
"name:genitive",
|
"name:genitive",
|
||||||
})
|
})
|
||||||
public void testNoLatinFallback(String key) {
|
void testNoLatinFallback(String key) {
|
||||||
assertSubmap(Map.of(
|
assertSubmap(Map.of(
|
||||||
"name", "Branch Hill–Loveland Road",
|
"name", "Branch Hill–Loveland Road",
|
||||||
"name_en", "Branch Hill–Loveland Road",
|
"name_en", "Branch Hill–Loveland Road",
|
||||||
@@ -193,7 +193,7 @@ public class LanguageUtilsTest {
|
|||||||
"Αλφαβητικός Κατάλογος, Alphabētikós Katálogos",
|
"Αλφαβητικός Κατάλογος, Alphabētikós Katálogos",
|
||||||
"биологическом, biologičeskom",
|
"биологическом, biologičeskom",
|
||||||
})
|
})
|
||||||
public void testTransliterate(String in, String out) {
|
void testTransliterate(String in, String out) {
|
||||||
assertEquals(out, LanguageUtils.getNames(Map.of(
|
assertEquals(out, LanguageUtils.getNames(Map.of(
|
||||||
"name", in
|
"name", in
|
||||||
), translations).get("name:latin"));
|
), translations).get("name:latin"));
|
||||||
@@ -204,7 +204,7 @@ public class LanguageUtilsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUseWikidata() {
|
void testUseWikidata() {
|
||||||
wikidataTranslations.put(123, "es", "es name");
|
wikidataTranslations.put(123, "es", "es name");
|
||||||
assertSubmap(Map.of(
|
assertSubmap(Map.of(
|
||||||
"name:es", "es name"
|
"name:es", "es name"
|
||||||
@@ -215,7 +215,7 @@ public class LanguageUtilsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUseOsm() {
|
void testUseOsm() {
|
||||||
assertSubmap(Map.of(
|
assertSubmap(Map.of(
|
||||||
"name:es", "es name osm"
|
"name:es", "es name osm"
|
||||||
), LanguageUtils.getNames(Map.of(
|
), LanguageUtils.getNames(Map.of(
|
||||||
@@ -226,7 +226,7 @@ public class LanguageUtilsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPreferWikidata() {
|
void testPreferWikidata() {
|
||||||
wikidataTranslations.put(123, "es", "wd es name");
|
wikidataTranslations.put(123, "es", "wd es name");
|
||||||
assertSubmap(Map.of(
|
assertSubmap(Map.of(
|
||||||
"name:es", "wd es name",
|
"name:es", "wd es name",
|
||||||
@@ -240,7 +240,7 @@ public class LanguageUtilsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDontUseTranslationsWhenNotSpecified() {
|
void testDontUseTranslationsWhenNotSpecified() {
|
||||||
var result = LanguageUtils.getNamesWithoutTranslations(Map.of(
|
var result = LanguageUtils.getNamesWithoutTranslations(Map.of(
|
||||||
"name", "name",
|
"name", "name",
|
||||||
"wikidata", "Q123",
|
"wikidata", "Q123",
|
||||||
@@ -253,7 +253,7 @@ public class LanguageUtilsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreLanguages() {
|
void testIgnoreLanguages() {
|
||||||
wikidataTranslations.put(123, "ja", "ja name wd");
|
wikidataTranslations.put(123, "ja", "ja name wd");
|
||||||
var result = LanguageUtils.getNamesWithoutTranslations(Map.of(
|
var result = LanguageUtils.getNamesWithoutTranslations(Map.of(
|
||||||
"name", "name",
|
"name", "name",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.junit.jupiter.api.AfterEach;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class VerifyMonacoTest {
|
class VerifyMonacoTest {
|
||||||
|
|
||||||
private Mbtiles mbtiles;
|
private Mbtiles mbtiles;
|
||||||
|
|
||||||
@@ -29,18 +29,18 @@ public class VerifyMonacoTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyFileInvalid() {
|
void testEmptyFileInvalid() {
|
||||||
assertInvalid(mbtiles);
|
assertInvalid(mbtiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyTablesInvalid() {
|
void testEmptyTablesInvalid() {
|
||||||
mbtiles.createTables().addTileIndex();
|
mbtiles.createTables().addTileIndex();
|
||||||
assertInvalid(mbtiles);
|
assertInvalid(mbtiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStilInvalidWithOneTile() throws IOException {
|
void testStilInvalidWithOneTile() throws IOException {
|
||||||
mbtiles.createTables().addTileIndex();
|
mbtiles.createTables().addTileIndex();
|
||||||
mbtiles.metadata().setName("name");
|
mbtiles.metadata().setName("name");
|
||||||
try (var writer = mbtiles.newBatchedTileWriter()) {
|
try (var writer = mbtiles.newBatchedTileWriter()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user