[android] - show snapshot attribution

This commit is contained in:
tobrun
2019-01-15 12:35:48 +01:00
committed by Tobrun
parent 52bc11892c
commit 5977d7b86a
2 changed files with 23 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ public class Attribution {
private static final String OPENSTREETMAP_ABBR = "OSM";
static final String TELEMETRY = "Telemetry Settings";
static final String IMPROVE_MAP_URL = "https://www.mapbox.com/feedback/";
static final String IMPROVE_MAP_URL = "https://www.mapbox.com/map-feedback/";
static final String MAPBOX_URL = "https://www.mapbox.com/about/maps/";
static final String TELEMETRY_URL = "https://www.mapbox.com/telemetry/";

View File

@@ -15,8 +15,8 @@ import static junit.framework.Assert.assertEquals;
@Config(constants = BuildConfig.class)
public class AttributionParseTest {
private static final String STREETS_ATTRIBUTION = "<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">&copy; Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">&copy; OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/feedback/\" target=\"_blank\">Improve this map</a>\n";
private static final String SATELLITE_ATTRIBUTION = "<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">&copy; Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">&copy; OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/feedback/\" target=\"_blank\">Improve this map</a> <a href=\"https://www.digitalglobe.com/\" target=\"_blank\">&copy; DigitalGlobe</a>\n";
private static final String STREETS_ATTRIBUTION = "<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">&copy; Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">&copy; OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>\n";
private static final String SATELLITE_ATTRIBUTION = "<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">&copy; Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">&copy; OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a> <a href=\"https://www.digitalglobe.com/\" target=\"_blank\">&copy; DigitalGlobe</a>\n";
@Test
public void testParseAttributionStringSatellite() throws Exception {
@@ -39,7 +39,7 @@ public class AttributionParseTest {
assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle());
break;
case 2:
assertEquals("URL improve map should match", "https://www.mapbox.com/feedback/", attribution.getUrl());
assertEquals("URL improve map should match", "https://www.mapbox.com/map-feedback/", attribution.getUrl());
assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle());
break;
case 3:
@@ -72,7 +72,7 @@ public class AttributionParseTest {
assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle());
break;
case 2:
assertEquals("URL improve map should match", "https://www.mapbox.com/feedback/", attribution.getUrl());
assertEquals("URL improve map should match", "https://www.mapbox.com/map-feedback/", attribution.getUrl());
assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle());
break;
}
@@ -98,7 +98,7 @@ public class AttributionParseTest {
assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle());
break;
case 1:
assertEquals("URL improve map should match", "https://www.mapbox.com/feedback/", attribution.getUrl());
assertEquals("URL improve map should match", "https://www.mapbox.com/map-feedback/", attribution.getUrl());
assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle());
break;
}
@@ -126,7 +126,7 @@ public class AttributionParseTest {
assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle());
break;
case 2:
assertEquals("URL improve map should match", "https://www.mapbox.com/feedback/", attribution.getUrl());
assertEquals("URL improve map should match", "https://www.mapbox.com/map-feedback/", attribution.getUrl());
assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle());
break;
case 3:
@@ -188,7 +188,7 @@ public class AttributionParseTest {
assertEquals("Title openstreetmap should match", "OpenStreetMap", attribution.getTitle());
break;
case 2:
assertEquals("URL improve map should match", "https://www.mapbox.com/feedback/", attribution.getUrl());
assertEquals("URL improve map should match", "https://www.mapbox.com/map-feedback/", attribution.getUrl());
assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle());
break;
case 3:
@@ -307,4 +307,19 @@ public class AttributionParseTest {
attributionParser.createAttributionString(true)
);
}
@Test
public void testWithImproveThisMapString() throws Exception {
AttributionParser attributionParser = new AttributionParser.Options(RuntimeEnvironment.application)
.withAttributionData(STREETS_ATTRIBUTION, "blabla", "")
.withImproveMap(true)
.withCopyrightSign(false)
.build();
assertEquals(
"Attribution string should match",
"© Mapbox / OSM / Improve This Map",
attributionParser.createAttributionString(true)
);
}
}