summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/AndroidManifest.xml4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json5331
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt15
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationApplication.kt10
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt11
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt186
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt40
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt45
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt29
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt29
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt32
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt30
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt29
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt29
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt36
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt1663
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt609
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt38
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt79
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt40
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt27
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt516
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java42
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapGestureDetectorTest.kt193
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java477
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java111
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt421
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt33
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt400
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt85
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt57
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java50
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java78
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java39
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java113
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java28
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs32
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java138
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java63
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java46
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java42
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java11
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java260
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraTest.java307
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt35
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java148
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java65
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt155
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt163
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt31
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java217
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java67
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java60
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt104
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt124
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java41
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java74
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt59
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt116
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt59
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/string/UppperLowerCaseTest.java47
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java141
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java453
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt69
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java786
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java340
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java326
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java189
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java215
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java223
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt75
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java172
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java493
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java240
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java370
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java27
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java59
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java1313
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs199
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs132
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/SnapshotterIdlingResource.java38
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestConstants.java12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestingAsyncUtils.kt18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/utils/FontUtilsTest.java41
86 files changed, 0 insertions, 19374 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index a9dd564e46..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:tools="http://schemas.android.com/tools" package="${applicationId}">
- <uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18"/>
-</manifest> \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json
deleted file mode 100644
index 5ab289344a..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json
+++ /dev/null
@@ -1,5331 +0,0 @@
-{
- "version": 8,
- "name": "mapbox-gl-native-test-style",
- "metadata": {
- "mapbox:autocomposite": true,
- "mapbox:type": "default",
- "mapbox:origin": "streets-v10",
- "mapbox:groups": {
- "1444934828655.3389": {"name": "Aeroways", "collapsed": true},
- "1444933322393.2852": {
- "name": "POI labels (scalerank 1)",
- "collapsed": true
- },
- "1444855786460.0557": {"name": "Roads", "collapsed": true},
- "1444933575858.6992": {
- "name": "Highway shields",
- "collapsed": true
- },
- "1444934295202.7542": {
- "name": "Admin boundaries",
- "collapsed": true
- },
- "1444856151690.9143": {"name": "State labels", "collapsed": true},
- "1444933721429.3076": {"name": "Road labels", "collapsed": true},
- "1444933358918.2366": {
- "name": "POI labels (scalerank 2)",
- "collapsed": true
- },
- "1444933808272.805": {"name": "Water labels", "collapsed": true},
- "1444933372896.5967": {
- "name": "POI labels (scalerank 3)",
- "collapsed": true
- },
- "1444855799204.86": {"name": "Bridges", "collapsed": true},
- "1444856087950.3635": {"name": "Marine labels", "collapsed": true},
- "1456969573402.7817": {"name": "Hillshading", "collapsed": true},
- "1444862510685.128": {"name": "City labels", "collapsed": true},
- "1444855769305.6016": {"name": "Tunnels", "collapsed": true},
- "1456970288113.8113": {"name": "Landcover", "collapsed": true},
- "1444856144497.7825": {"name": "Country labels", "collapsed": true},
- "1444933456003.5437": {
- "name": "POI labels (scalerank 4)",
- "collapsed": true
- }
- },
- "mapbox:sdk-support": {
- "js": "0.49.0",
- "android": "6.5.0",
- "ios": "4.4.0"
- }
- },
- "center": [0.0, 0.0],
- "zoom": 0,
- "bearing": 0,
- "pitch": 0,
- "sources": {
- "composite": {
- "url": "mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7",
- "type": "vector"
- }
- },
- "sprite": "mapbox://sprites/lukaspaczos/cjnkdt02b0b2p2ss40skwpvs1",
- "glyphs": "mapbox://fonts/lukaspaczos/{fontstack}/{range}.pbf",
- "layers": [
- {
- "id": "background",
- "type": "background",
- "layout": {},
- "paint": {
- "background-color": {
- "base": 1,
- "stops": [
- [11, "hsl(35, 32%, 91%)"],
- [13, "hsl(35, 12%, 89%)"]
- ]
- }
- }
- },
- {
- "id": "landcover_snow",
- "type": "fill",
- "metadata": {"mapbox:group": "1456970288113.8113"},
- "source": "composite",
- "source-layer": "landcover",
- "filter": ["==", "class", "snow"],
- "layout": {},
- "paint": {
- "fill-color": "hsl(0, 0%, 100%)",
- "fill-opacity": 0.2,
- "fill-antialias": false
- }
- },
- {
- "id": "landcover_wood",
- "type": "fill",
- "metadata": {"mapbox:group": "1456970288113.8113"},
- "source": "composite",
- "source-layer": "landcover",
- "maxzoom": 14,
- "filter": ["==", "class", "wood"],
- "layout": {},
- "paint": {
- "fill-color": "hsl(75, 62%, 81%)",
- "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "landcover_scrub",
- "type": "fill",
- "metadata": {"mapbox:group": "1456970288113.8113"},
- "source": "composite",
- "source-layer": "landcover",
- "maxzoom": 14,
- "filter": ["==", "class", "scrub"],
- "layout": {},
- "paint": {
- "fill-color": "hsl(75, 62%, 81%)",
- "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "landcover_grass",
- "type": "fill",
- "metadata": {"mapbox:group": "1456970288113.8113"},
- "source": "composite",
- "source-layer": "landcover",
- "maxzoom": 14,
- "filter": ["==", "class", "grass"],
- "layout": {},
- "paint": {
- "fill-color": "hsl(75, 62%, 81%)",
- "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "landcover_crop",
- "type": "fill",
- "metadata": {"mapbox:group": "1456970288113.8113"},
- "source": "composite",
- "source-layer": "landcover",
- "maxzoom": 14,
- "filter": ["==", "class", "crop"],
- "layout": {},
- "paint": {
- "fill-color": "hsl(75, 62%, 81%)",
- "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "national_park",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse_overlay",
- "filter": ["==", "class", "national_park"],
- "layout": {},
- "paint": {
- "fill-color": "hsl(100, 58%, 76%)",
- "fill-opacity": {"base": 1, "stops": [[5, 0], [6, 0.5]]}
- }
- },
- {
- "id": "hospital",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse",
- "filter": ["==", "class", "hospital"],
- "layout": {},
- "paint": {
- "fill-color": {
- "base": 1,
- "stops": [
- [15.5, "hsl(340, 37%, 87%)"],
- [16, "hsl(340, 63%, 89%)"]
- ]
- }
- }
- },
- {
- "id": "school",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse",
- "filter": ["==", "class", "school"],
- "layout": {},
- "paint": {
- "fill-color": {
- "base": 1,
- "stops": [
- [15.5, "hsl(50, 47%, 81%)"],
- [16, "hsl(50, 63%, 84%)"]
- ]
- }
- }
- },
- {
- "id": "park",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse",
- "filter": ["==", "class", "park"],
- "layout": {},
- "paint": {
- "fill-color": "hsl(100, 58%, 76%)",
- "fill-opacity": {"base": 1, "stops": [[5, 0], [6, 1]]}
- }
- },
- {
- "id": "pitch",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse",
- "filter": ["==", "class", "pitch"],
- "layout": {},
- "paint": {"fill-color": "hsl(100, 57%, 72%)"}
- },
- {
- "id": "pitch-line",
- "type": "line",
- "source": "composite",
- "source-layer": "landuse",
- "minzoom": 15,
- "filter": ["==", "class", "pitch"],
- "layout": {"line-join": "miter"},
- "paint": {"line-color": "hsl(75, 57%, 84%)"}
- },
- {
- "id": "cemetery",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse",
- "filter": ["==", "class", "cemetery"],
- "layout": {},
- "paint": {"fill-color": "hsl(75, 37%, 81%)"}
- },
- {
- "id": "industrial",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse",
- "filter": ["==", "class", "industrial"],
- "layout": {},
- "paint": {
- "fill-color": {
- "base": 1,
- "stops": [
- [15.5, "hsl(230, 15%, 86%)"],
- [16, "hsl(230, 29%, 89%)"]
- ]
- }
- }
- },
- {
- "id": "sand",
- "type": "fill",
- "source": "composite",
- "source-layer": "landuse",
- "filter": ["==", "class", "sand"],
- "layout": {},
- "paint": {"fill-color": "hsl(60, 46%, 87%)"}
- },
- {
- "id": "hillshade_highlight_bright",
- "type": "fill",
- "metadata": {"mapbox:group": "1456969573402.7817"},
- "source": "composite",
- "source-layer": "hillshade",
- "maxzoom": 16,
- "filter": ["==", "level", 94],
- "layout": {},
- "paint": {
- "fill-color": "hsl(0, 0%, 100%)",
- "fill-opacity": {"stops": [[14, 0.12], [16, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "hillshade_highlight_med",
- "type": "fill",
- "metadata": {"mapbox:group": "1456969573402.7817"},
- "source": "composite",
- "source-layer": "hillshade",
- "maxzoom": 16,
- "filter": ["==", "level", 90],
- "layout": {},
- "paint": {
- "fill-color": "hsl(0, 0%, 100%)",
- "fill-opacity": {"stops": [[14, 0.12], [16, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "hillshade_shadow_faint",
- "type": "fill",
- "metadata": {"mapbox:group": "1456969573402.7817"},
- "source": "composite",
- "source-layer": "hillshade",
- "maxzoom": 16,
- "filter": ["==", "level", 89],
- "layout": {},
- "paint": {
- "fill-color": "hsl(56, 59%, 22%)",
- "fill-opacity": {"stops": [[14, 0.05], [16, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "hillshade_shadow_med",
- "type": "fill",
- "metadata": {"mapbox:group": "1456969573402.7817"},
- "source": "composite",
- "source-layer": "hillshade",
- "maxzoom": 16,
- "filter": ["==", "level", 78],
- "layout": {},
- "paint": {
- "fill-color": "hsl(56, 59%, 22%)",
- "fill-opacity": {"stops": [[14, 0.05], [16, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "hillshade_shadow_dark",
- "type": "fill",
- "metadata": {"mapbox:group": "1456969573402.7817"},
- "source": "composite",
- "source-layer": "hillshade",
- "maxzoom": 16,
- "filter": ["==", "level", 67],
- "layout": {},
- "paint": {
- "fill-color": "hsl(56, 59%, 22%)",
- "fill-opacity": {"stops": [[14, 0.06], [16, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "hillshade_shadow_extreme",
- "type": "fill",
- "metadata": {"mapbox:group": "1456969573402.7817"},
- "source": "composite",
- "source-layer": "hillshade",
- "maxzoom": 16,
- "filter": ["==", "level", 56],
- "layout": {},
- "paint": {
- "fill-color": "hsl(56, 59%, 22%)",
- "fill-opacity": {"stops": [[14, 0.06], [16, 0]]},
- "fill-antialias": false
- }
- },
- {
- "id": "waterway-river-canal",
- "type": "line",
- "source": "composite",
- "source-layer": "waterway",
- "minzoom": 8,
- "filter": ["in", "class", "canal", "river"],
- "layout": {
- "line-cap": {"base": 1, "stops": [[0, "butt"], [11, "round"]]},
- "line-join": "round"
- },
- "paint": {
- "line-color": "hsl(205, 87%, 76%)",
- "line-width": {"base": 1.3, "stops": [[8.5, 0.1], [20, 8]]},
- "line-opacity": {"base": 1, "stops": [[8, 0], [8.5, 1]]}
- }
- },
- {
- "id": "waterway-small",
- "type": "line",
- "source": "composite",
- "source-layer": "waterway",
- "minzoom": 13,
- "filter": ["!in", "class", "canal", "river"],
- "layout": {"line-join": "round", "line-cap": "round"},
- "paint": {
- "line-color": "hsl(205, 87%, 76%)",
- "line-width": {"base": 1.35, "stops": [[13.5, 0.1], [20, 3]]},
- "line-opacity": {"base": 1, "stops": [[13, 0], [13.5, 1]]}
- }
- },
- {
- "id": "water-shadow",
- "type": "fill",
- "source": "composite",
- "source-layer": "water",
- "layout": {},
- "paint": {
- "fill-color": "hsl(215, 84%, 69%)",
- "fill-translate": {
- "base": 1.2,
- "stops": [[7, [0, 0]], [16, [-1, -1]]]
- },
- "fill-translate-anchor": "viewport",
- "fill-opacity": 1
- }
- },
- {
- "id": "water",
- "type": "fill",
- "source": "composite",
- "source-layer": "water",
- "layout": {},
- "paint": {"fill-color": "hsl(196, 80%, 70%)"}
- },
- {
- "id": "barrier_line-land-polygon",
- "type": "fill",
- "source": "composite",
- "source-layer": "barrier_line",
- "filter": [
- "all",
- ["==", "$type", "Polygon"],
- ["==", "class", "land"]
- ],
- "layout": {},
- "paint": {"fill-color": "hsl(35, 12%, 89%)"}
- },
- {
- "id": "barrier_line-land-line",
- "type": "line",
- "source": "composite",
- "source-layer": "barrier_line",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["==", "class", "land"]
- ],
- "layout": {"line-cap": "round"},
- "paint": {
- "line-width": {"base": 1.99, "stops": [[14, 0.75], [20, 40]]},
- "line-color": "hsl(35, 12%, 89%)"
- }
- },
- {
- "id": "aeroway-polygon",
- "type": "fill",
- "metadata": {"mapbox:group": "1444934828655.3389"},
- "source": "composite",
- "source-layer": "aeroway",
- "minzoom": 11,
- "filter": [
- "all",
- ["!=", "type", "apron"],
- ["==", "$type", "Polygon"]
- ],
- "layout": {},
- "paint": {
- "fill-color": {
- "base": 1,
- "stops": [
- [15, "hsl(230, 23%, 82%)"],
- [16, "hsl(230, 37%, 84%)"]
- ]
- },
- "fill-opacity": {"base": 1, "stops": [[11, 0], [11.5, 1]]}
- }
- },
- {
- "id": "aeroway-runway",
- "type": "line",
- "metadata": {"mapbox:group": "1444934828655.3389"},
- "source": "composite",
- "source-layer": "aeroway",
- "minzoom": 9,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["==", "type", "runway"]
- ],
- "layout": {},
- "paint": {
- "line-color": {
- "base": 1,
- "stops": [
- [15, "hsl(230, 23%, 82%)"],
- [16, "hsl(230, 37%, 84%)"]
- ]
- },
- "line-width": {"base": 1.5, "stops": [[9, 1], [18, 80]]}
- }
- },
- {
- "id": "aeroway-taxiway",
- "type": "line",
- "metadata": {"mapbox:group": "1444934828655.3389"},
- "source": "composite",
- "source-layer": "aeroway",
- "minzoom": 9,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["==", "type", "taxiway"]
- ],
- "layout": {},
- "paint": {
- "line-color": {
- "base": 1,
- "stops": [
- [15, "hsl(230, 23%, 82%)"],
- [16, "hsl(230, 37%, 84%)"]
- ]
- },
- "line-width": {"base": 1.5, "stops": [[10, 0.5], [18, 20]]}
- }
- },
- {
- "id": "building-line",
- "type": "line",
- "source": "composite",
- "source-layer": "building",
- "minzoom": 15,
- "filter": [
- "all",
- ["!=", "type", "building:part"],
- ["==", "underground", "false"]
- ],
- "layout": {},
- "paint": {
- "line-color": "hsl(35, 6%, 79%)",
- "line-width": {"base": 1.5, "stops": [[15, 0.75], [20, 3]]},
- "line-opacity": {"base": 1, "stops": [[15.5, 0], [16, 1]]}
- }
- },
- {
- "id": "building",
- "type": "fill",
- "source": "composite",
- "source-layer": "building",
- "minzoom": 15,
- "filter": [
- "all",
- ["!=", "type", "building:part"],
- ["==", "underground", "false"]
- ],
- "layout": {},
- "paint": {
- "fill-color": {
- "base": 1,
- "stops": [
- [15, "hsl(35, 11%, 88%)"],
- [16, "hsl(35, 8%, 85%)"]
- ]
- },
- "fill-opacity": {"base": 1, "stops": [[15.5, 0], [16, 1]]},
- "fill-outline-color": "hsl(35, 6%, 79%)"
- }
- },
- {
- "id": "tunnel-street-low",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {
- "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]]
- }
- }
- },
- {
- "id": "tunnel-street_limited-low",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {
- "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]]
- }
- }
- },
- {
- "id": "tunnel-service-link-track-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["==", "structure", "tunnel"],
- ["in", "class", "link", "service", "track"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 19%, 75%)",
- "line-gap-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]},
- "line-dasharray": [3, 3]
- }
- },
- {
- "id": "tunnel-street_limited-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 19%, 75%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[13, 0], [14, 2], [18, 18]]
- },
- "line-dasharray": [3, 3],
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "tunnel-street-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 19%, 75%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[13, 0], [14, 2], [18, 18]]
- },
- "line-dasharray": [3, 3],
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "tunnel-secondary-tertiary-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "tunnel"],
- ["in", "class", "secondary", "tertiary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.2, "stops": [[10, 0.75], [18, 2]]},
- "line-dasharray": [3, 3],
- "line-gap-width": {
- "base": 1.5,
- "stops": [[8.5, 0.5], [10, 0.75], [18, 26]]
- },
- "line-color": "hsl(230, 19%, 75%)"
- }
- },
- {
- "id": "tunnel-primary-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "primary"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-dasharray": [3, 3],
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(230, 19%, 75%)"
- }
- },
- {
- "id": "tunnel-trunk_link-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "tunnel"],
- ["==", "type", "trunk_link"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-dasharray": [3, 3]
- }
- },
- {
- "id": "tunnel-motorway_link-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway_link"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-dasharray": [3, 3]
- }
- },
- {
- "id": "tunnel-trunk-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "structure", "tunnel"], ["==", "type", "trunk"]]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-opacity": 1,
- "line-dasharray": [3, 3]
- }
- },
- {
- "id": "tunnel-motorway-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-opacity": 1,
- "line-dasharray": [3, 3]
- }
- },
- {
- "id": "tunnel-construction",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "construction"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-join": "miter"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(230, 24%, 87%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]},
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [0.4, 0.8]],
- [15, [0.3, 0.6]],
- [16, [0.2, 0.3]],
- [17, [0.2, 0.25]],
- [18, [0.15, 0.15]]
- ]
- }
- }
- },
- {
- "id": "tunnel-path",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "steps"],
- ["==", "class", "path"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]},
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [1, 0]],
- [15, [1.75, 1]],
- [16, [1, 0.75]],
- [17, [1, 0.5]]
- ]
- },
- "line-color": "hsl(35, 26%, 95%)",
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]}
- }
- },
- {
- "id": "tunnel-steps",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "structure", "tunnel"], ["==", "type", "steps"]]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[15, 1], [16, 1.6], [18, 6]]
- },
- "line-color": "hsl(35, 26%, 95%)",
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [1, 0]],
- [15, [1.75, 1]],
- [16, [1, 0.75]],
- [17, [0.3, 0.3]]
- ]
- },
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]}
- }
- },
- {
- "id": "tunnel-trunk_link",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "tunnel"],
- ["==", "type", "trunk_link"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(46, 77%, 78%)",
- "line-opacity": 1,
- "line-dasharray": [1, 0]
- }
- },
- {
- "id": "tunnel-motorway_link",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway_link"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(26, 100%, 78%)",
- "line-opacity": 1,
- "line-dasharray": [1, 0]
- }
- },
- {
- "id": "tunnel-pedestrian",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "pedestrian"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": 1,
- "line-dasharray": {
- "base": 1,
- "stops": [[14, [1, 0]], [15, [1.5, 0.4]], [16, [1, 0.2]]]
- }
- }
- },
- {
- "id": "tunnel-service-link-track",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["==", "structure", "tunnel"],
- ["in", "class", "link", "service", "track"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-dasharray": [1, 0]
- }
- },
- {
- "id": "tunnel-street_limited",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(35, 14%, 93%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "tunnel-street",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "tunnel-secondary-tertiary",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "tunnel"],
- ["in", "class", "secondary", "tertiary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[8.5, 0.5], [10, 0.75], [18, 26]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": 1,
- "line-dasharray": [1, 0],
- "line-blur": 0
- }
- },
- {
- "id": "tunnel-primary",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "primary"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": 1,
- "line-dasharray": [1, 0],
- "line-blur": 0
- }
- },
- {
- "id": "tunnel-oneway-arrows-blue-minor",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["==", "oneway", "true"],
- ["==", "structure", "tunnel"],
- [
- "in",
- "class",
- "link",
- "path",
- "pedestrian",
- "service",
- "track"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [[17, "oneway-small"], [18, "oneway-large"]]
- },
- "symbol-spacing": 200,
- "icon-padding": 2
- },
- "paint": {}
- },
- {
- "id": "tunnel-oneway-arrows-blue-major",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 15,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["==", "oneway", "true"],
- ["==", "structure", "tunnel"],
- [
- "in",
- "class",
- "primary",
- "secondary",
- "street",
- "street_limited",
- "tertiary"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [[16, "oneway-small"], [17, "oneway-large"]]
- },
- "symbol-spacing": 200,
- "icon-padding": 2
- },
- "paint": {}
- },
- {
- "id": "tunnel-trunk",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "class", "trunk"], ["==", "structure", "tunnel"]]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(46, 77%, 78%)"
- }
- },
- {
- "id": "tunnel-motorway",
- "type": "line",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway"],
- ["==", "structure", "tunnel"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-dasharray": [1, 0],
- "line-opacity": 1,
- "line-color": "hsl(26, 100%, 78%)",
- "line-blur": 0
- }
- },
- {
- "id": "tunnel-oneway-arrows-white",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855769305.6016"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- [
- "!in",
- "type",
- "primary_link",
- "secondary_link",
- "tertiary_link"
- ],
- ["==", "oneway", "true"],
- ["==", "structure", "tunnel"],
- [
- "in",
- "class",
- "link",
- "motorway",
- "motorway_link",
- "trunk"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [
- [16, "oneway-white-small"],
- [17, "oneway-white-large"]
- ]
- },
- "symbol-spacing": 200,
- "icon-padding": 2
- },
- "paint": {}
- },
- {
- "id": "ferry",
- "type": "line",
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["==", "type", "ferry"]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-color": {
- "base": 1,
- "stops": [
- [15, "hsl(205, 73%, 63%)"],
- [17, "hsl(230, 73%, 63%)"]
- ]
- },
- "line-opacity": 1,
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]},
- "line-dasharray": {
- "base": 1,
- "stops": [[12, [1, 0]], [13, [12, 4]]]
- }
- }
- },
- {
- "id": "ferry_auto",
- "type": "line",
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["==", "type", "ferry_auto"]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-color": {
- "base": 1,
- "stops": [
- [15, "hsl(205, 73%, 63%)"],
- [17, "hsl(230, 73%, 63%)"]
- ]
- },
- "line-opacity": 1,
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]}
- }
- },
- {
- "id": "road-path-bg",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["!in", "type", "crossing", "sidewalk", "steps"],
- ["==", "class", "path"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[15, 2], [18, 7]]},
- "line-dasharray": [1, 0],
- "line-color": "hsl(230, 17%, 82%)",
- "line-blur": 0,
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 0.75]]}
- }
- },
- {
- "id": "road-steps-bg",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "type", "steps"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[15, 2], [17, 4.6], [18, 7]]
- },
- "line-color": "hsl(230, 17%, 82%)",
- "line-dasharray": [1, 0],
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 0.75]]}
- }
- },
- {
- "id": "road-sidewalk-bg",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "type", "crossing", "sidewalk"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[15, 2], [18, 7]]},
- "line-dasharray": [1, 0],
- "line-color": "hsl(230, 17%, 82%)",
- "line-blur": 0,
- "line-opacity": {"base": 1, "stops": [[16, 0], [16.25, 0.75]]}
- }
- },
- {
- "id": "turning-features-outline",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 15,
- "filter": [
- "all",
- ["==", "$type", "Point"],
- ["in", "class", "turning_circle", "turning_loop"]
- ],
- "layout": {
- "icon-image": "turning-circle-outline",
- "icon-size": {
- "base": 1.5,
- "stops": [[14, 0.122], [18, 0.969], [20, 1]]
- },
- "icon-allow-overlap": true,
- "icon-ignore-placement": true,
- "icon-padding": 0,
- "icon-rotation-alignment": "map"
- },
- "paint": {}
- },
- {
- "id": "road-pedestrian-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 12,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "pedestrian"],
- ["==", "structure", "none"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 2], [18, 14.5]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": 0,
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "road-street-low",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "class", "street"], ["==", "structure", "none"]]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {
- "stops": [[11, 0], [11.25, 1], [14, 1], [14.01, 0]]
- }
- }
- },
- {
- "id": "road-street_limited-low",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "none"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {
- "stops": [[11, 0], [11.25, 1], [14, 1], [14.01, 0]]
- }
- }
- },
- {
- "id": "road-service-link-track-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "class", "link", "service", "track"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}
- }
- },
- {
- "id": "road-street_limited-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "none"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[13, 0], [14, 2], [18, 18]]
- },
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "road-street-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "class", "street"], ["==", "structure", "none"]]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[13, 0], [14, 2], [18, 18]]
- },
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "road-secondary-tertiary-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "class", "secondary", "tertiary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.2, "stops": [[10, 0.75], [18, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[8.5, 0.5], [10, 0.75], [18, 26]]
- },
- "line-opacity": {"base": 1, "stops": [[9.99, 0], [10, 1]]}
- }
- },
- {
- "id": "road-primary-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "primary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-opacity": {"base": 1, "stops": [[9.99, 0], [10, 1]]}
- }
- },
- {
- "id": "road-motorway_link-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 10,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "motorway_link"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]}
- }
- },
- {
- "id": "road-trunk_link-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "type", "trunk_link"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]}
- }
- },
- {
- "id": "road-trunk-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "trunk"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-opacity": {"base": 1, "stops": [[6, 0], [6.1, 1]]}
- }
- },
- {
- "id": "road-motorway-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "motorway"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}
- }
- },
- {
- "id": "road-construction",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "construction"],
- ["==", "structure", "none"]
- ]
- ],
- "layout": {"line-join": "miter"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(230, 24%, 87%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]},
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [0.4, 0.8]],
- [15, [0.3, 0.6]],
- [16, [0.2, 0.3]],
- [17, [0.2, 0.25]],
- [18, [0.15, 0.15]]
- ]
- }
- }
- },
- {
- "id": "road-sidewalks",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "type", "crossing", "sidewalk"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [1, 0]],
- [15, [1.75, 1]],
- [16, [1, 0.75]],
- [17, [1, 0.5]]
- ]
- },
- "line-opacity": {"base": 1, "stops": [[16, 0], [16.25, 1]]}
- }
- },
- {
- "id": "road-path",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["!in", "type", "crossing", "sidewalk", "steps"],
- ["==", "class", "path"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [1, 0]],
- [15, [1.75, 1]],
- [16, [1, 0.75]],
- [17, [1, 0.5]]
- ]
- },
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]}
- }
- },
- {
- "id": "road-steps",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "type", "steps"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[15, 1], [16, 1.6], [18, 6]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [1, 0]],
- [15, [1.75, 1]],
- [16, [1, 0.75]],
- [17, [0.3, 0.3]]
- ]
- },
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]}
- }
- },
- {
- "id": "road-trunk_link",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "type", "trunk_link"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(46, 85%, 67%)",
- "line-opacity": 1
- }
- },
- {
- "id": "road-motorway_link",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 10,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "motorway_link"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(26, 100%, 68%)",
- "line-opacity": 1
- }
- },
- {
- "id": "road-pedestrian",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 12,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "pedestrian"],
- ["==", "structure", "none"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": 1,
- "line-dasharray": {
- "base": 1,
- "stops": [[14, [1, 0]], [15, [1.5, 0.4]], [16, [1, 0.2]]]
- }
- }
- },
- {
- "id": "road-pedestrian-polygon-fill",
- "type": "fill",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 12,
- "filter": [
- "all",
- ["==", "$type", "Polygon"],
- [
- "all",
- ["==", "structure", "none"],
- ["in", "class", "path", "pedestrian"]
- ]
- ],
- "layout": {},
- "paint": {
- "fill-color": {
- "base": 1,
- "stops": [
- [16, "hsl(230, 16%, 94%)"],
- [16.25, "hsl(230, 50%, 98%)"]
- ]
- },
- "fill-outline-color": "hsl(230, 26%, 88%)",
- "fill-opacity": 1
- }
- },
- {
- "id": "road-pedestrian-polygon-pattern",
- "type": "fill",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 12,
- "filter": [
- "all",
- ["==", "$type", "Polygon"],
- [
- "all",
- ["==", "structure", "none"],
- ["in", "class", "path", "pedestrian"]
- ]
- ],
- "layout": {},
- "paint": {
- "fill-color": "hsl(0, 0%, 100%)",
- "fill-outline-color": "hsl(35, 10%, 83%)",
- "fill-pattern": "pedestrian-polygon",
- "fill-opacity": {"base": 1, "stops": [[16, 0], [16.25, 1]]}
- }
- },
- {
- "id": "road-polygon",
- "type": "fill",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 12,
- "filter": [
- "all",
- ["==", "$type", "Polygon"],
- [
- "all",
- ["!in", "class", "motorway", "path", "pedestrian", "trunk"],
- ["!in", "structure", "bridge", "tunnel"]
- ]
- ],
- "layout": {},
- "paint": {
- "fill-color": "hsl(0, 0%, 100%)",
- "fill-outline-color": "#d6d9e6"
- }
- },
- {
- "id": "road-service-link-track",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "class", "link", "service", "track"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]},
- "line-color": "hsl(0, 0%, 100%)"
- }
- },
- {
- "id": "road-street_limited",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "none"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(35, 14%, 93%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "road-street",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "class", "street"], ["==", "structure", "none"]]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "road-secondary-tertiary",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "class", "secondary", "tertiary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[8.5, 0.5], [10, 0.75], [18, 26]]
- },
- "line-color": {
- "base": 1,
- "stops": [[5, "hsl(35, 32%, 91%)"], [8, "hsl(0, 0%, 100%)"]]
- },
- "line-opacity": {"base": 1.2, "stops": [[5, 0], [5.5, 1]]}
- }
- },
- {
- "id": "road-primary",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "primary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": {
- "base": 1,
- "stops": [[5, "hsl(35, 32%, 91%)"], [7, "hsl(0, 0%, 100%)"]]
- },
- "line-opacity": 1
- }
- },
- {
- "id": "road-oneway-arrows-blue-minor",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "oneway", "true"],
- [
- "in",
- "class",
- "link",
- "path",
- "pedestrian",
- "service",
- "track"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [[17, "oneway-small"], [18, "oneway-large"]]
- },
- "icon-rotation-alignment": "map",
- "icon-padding": 2,
- "symbol-spacing": 200
- },
- "paint": {}
- },
- {
- "id": "road-oneway-arrows-blue-major",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 15,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "oneway", "true"],
- [
- "in",
- "class",
- "primary",
- "secondary",
- "street",
- "street_limited",
- "tertiary"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [[16, "oneway-small"], [17, "oneway-large"]]
- },
- "icon-rotation-alignment": "map",
- "icon-padding": 2,
- "symbol-spacing": 200
- },
- "paint": {}
- },
- {
- "id": "road-trunk",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "trunk"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": {
- "base": 1,
- "stops": [
- [6, "hsl(0, 0%, 100%)"],
- [6.1, "hsl(46, 80%, 60%)"],
- [9, "hsl(46, 85%, 67%)"]
- ]
- }
- }
- },
- {
- "id": "road-motorway",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["==", "class", "motorway"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": {
- "base": 1,
- "stops": [
- [8, "hsl(26, 87%, 62%)"],
- [9, "hsl(26, 100%, 68%)"]
- ]
- }
- }
- },
- {
- "id": "road-rail",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "class", "major_rail", "minor_rail"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-color": {
- "stops": [
- [13, "hsl(50, 17%, 82%)"],
- [16, "hsl(230, 10%, 74%)"]
- ]
- },
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]}
- }
- },
- {
- "id": "road-rail-tracks",
- "type": "line",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- ["in", "class", "major_rail", "minor_rail"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-color": {
- "stops": [
- [13, "hsl(50, 17%, 82%)"],
- [16, "hsl(230, 10%, 74%)"]
- ]
- },
- "line-width": {"base": 1.5, "stops": [[14, 4], [20, 8]]},
- "line-dasharray": [0.1, 15],
- "line-opacity": {"base": 1, "stops": [[13.75, 0], [14, 1]]}
- }
- },
- {
- "id": "level-crossings",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "Point"],
- ["==", "class", "level_crossing"]
- ],
- "layout": {
- "icon-size": 1,
- "icon-image": "level-crossing",
- "icon-allow-overlap": true
- },
- "paint": {}
- },
- {
- "id": "road-oneway-arrows-white",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "structure", "bridge", "tunnel"],
- [
- "!in",
- "type",
- "primary_link",
- "secondary_link",
- "tertiary_link"
- ],
- ["==", "oneway", "true"],
- [
- "in",
- "class",
- "link",
- "motorway",
- "motorway_link",
- "trunk"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [
- [16, "oneway-white-small"],
- [17, "oneway-white-large"]
- ]
- },
- "icon-padding": 2,
- "symbol-spacing": 200
- },
- "paint": {}
- },
- {
- "id": "turning-features",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855786460.0557"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 15,
- "filter": [
- "all",
- ["==", "$type", "Point"],
- ["in", "class", "turning_circle", "turning_loop"]
- ],
- "layout": {
- "icon-image": "turning-circle",
- "icon-size": {"base": 1.5, "stops": [[14, 0.095], [18, 1]]},
- "icon-allow-overlap": true,
- "icon-ignore-placement": true,
- "icon-padding": 0,
- "icon-rotation-alignment": "map"
- },
- "paint": {}
- },
- {
- "id": "bridge-path-bg",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "steps"],
- ["==", "class", "path"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[15, 2], [18, 7]]},
- "line-dasharray": [1, 0],
- "line-color": "hsl(230, 17%, 82%)",
- "line-blur": 0,
- "line-opacity": {"base": 1, "stops": [[15, 0], [15.25, 1]]}
- }
- },
- {
- "id": "bridge-steps-bg",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "structure", "bridge"], ["==", "type", "steps"]]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[15, 2], [17, 4.6], [18, 7]]
- },
- "line-color": "hsl(230, 17%, 82%)",
- "line-dasharray": [1, 0],
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 0.75]]}
- }
- },
- {
- "id": "bridge-pedestrian-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "pedestrian"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 2], [18, 14.5]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": 0,
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "bridge-street-low",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {
- "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]]
- }
- }
- },
- {
- "id": "bridge-street_limited-low",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {
- "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]]
- }
- }
- },
- {
- "id": "bridge-service-link-track-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["==", "structure", "bridge"],
- ["in", "class", "link", "service", "track"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}
- }
- },
- {
- "id": "bridge-street_limited-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[13, 0], [14, 2], [18, 18]]
- }
- }
- },
- {
- "id": "bridge-street-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]},
- "line-gap-width": {
- "base": 1.5,
- "stops": [[13, 0], [14, 2], [18, 18]]
- }
- }
- },
- {
- "id": "bridge-secondary-tertiary-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "bridge"],
- ["in", "class", "secondary", "tertiary"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.2, "stops": [[10, 0.75], [18, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[8.5, 0.5], [10, 0.75], [18, 26]]
- },
- "line-translate": [0, 0]
- }
- },
- {
- "id": "bridge-primary-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "primary"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(230, 24%, 87%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-translate": [0, 0]
- }
- },
- {
- "id": "bridge-trunk_link-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "structure", "bridge"],
- ["==", "type", "trunk_link"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]}
- }
- },
- {
- "id": "bridge-motorway_link-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "class", "motorway_link"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-opacity": 1
- }
- },
- {
- "id": "bridge-trunk-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "class", "trunk"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}
- }
- },
- {
- "id": "bridge-motorway-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "class", "motorway"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}
- }
- },
- {
- "id": "bridge-construction",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "construction"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "miter"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(230, 24%, 87%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]},
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [0.4, 0.8]],
- [15, [0.3, 0.6]],
- [16, [0.2, 0.3]],
- [17, [0.2, 0.25]],
- [18, [0.15, 0.15]]
- ]
- }
- }
- },
- {
- "id": "bridge-path",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "steps"],
- ["==", "class", "path"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [1, 0]],
- [15, [1.75, 1]],
- [16, [1, 0.75]],
- [17, [1, 0.5]]
- ]
- },
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]}
- }
- },
- {
- "id": "bridge-steps",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["all", ["==", "structure", "bridge"], ["==", "type", "steps"]]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[15, 1], [16, 1.6], [18, 6]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-dasharray": {
- "base": 1,
- "stops": [
- [14, [1, 0]],
- [15, [1.75, 1]],
- [16, [1, 0.75]],
- [17, [0.3, 0.3]]
- ]
- },
- "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]}
- }
- },
- {
- "id": "bridge-trunk_link",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "structure", "bridge"],
- ["==", "type", "trunk_link"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(46, 85%, 67%)"
- }
- },
- {
- "id": "bridge-motorway_link",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "class", "motorway_link"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(26, 100%, 68%)"
- }
- },
- {
- "id": "bridge-pedestrian",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "pedestrian"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": 1,
- "line-dasharray": {
- "base": 1,
- "stops": [[14, [1, 0]], [15, [1.5, 0.4]], [16, [1, 0.2]]]
- }
- }
- },
- {
- "id": "bridge-service-link-track",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 14,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!=", "type", "trunk_link"],
- ["==", "structure", "bridge"],
- ["in", "class", "link", "service", "track"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]},
- "line-color": "hsl(0, 0%, 100%)"
- }
- },
- {
- "id": "bridge-street_limited",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street_limited"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(35, 14%, 93%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "bridge-street",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "street"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12.5, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}
- }
- },
- {
- "id": "bridge-secondary-tertiary",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "bridge"],
- ["in", "type", "secondary", "tertiary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[8.5, 0.5], [10, 0.75], [18, 26]]
- },
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": {"base": 1.2, "stops": [[5, 0], [5.5, 1]]}
- }
- },
- {
- "id": "bridge-primary",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "bridge"],
- ["==", "type", "primary"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-opacity": 1
- }
- },
- {
- "id": "bridge-oneway-arrows-blue-minor",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "oneway", "true"],
- ["==", "structure", "bridge"],
- [
- "in",
- "class",
- "link",
- "path",
- "pedestrian",
- "service",
- "track"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [[17, "oneway-small"], [18, "oneway-large"]]
- },
- "symbol-spacing": 200,
- "icon-rotation-alignment": "map",
- "icon-padding": 2
- },
- "paint": {}
- },
- {
- "id": "bridge-oneway-arrows-blue-major",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 15,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "oneway", "true"],
- ["==", "structure", "bridge"],
- [
- "in",
- "class",
- "primary",
- "secondary",
- "street",
- "street_limited",
- "tertiary"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [[16, "oneway-small"], [17, "oneway-large"]]
- },
- "symbol-spacing": 200,
- "icon-rotation-alignment": "map",
- "icon-padding": 2
- },
- "paint": {}
- },
- {
- "id": "bridge-trunk",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "class", "trunk"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(46, 85%, 67%)"
- }
- },
- {
- "id": "bridge-motorway",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["!in", "layer", 2, 3, 4, 5],
- ["==", "class", "motorway"],
- ["==", "structure", "bridge"]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(26, 100%, 68%)"
- }
- },
- {
- "id": "bridge-rail",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "bridge"],
- ["in", "class", "major_rail", "minor_rail"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-color": {
- "stops": [
- [13, "hsl(50, 17%, 82%)"],
- [16, "hsl(230, 10%, 74%)"]
- ]
- },
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]}
- }
- },
- {
- "id": "bridge-rail-tracks",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "bridge"],
- ["in", "class", "major_rail", "minor_rail"]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-color": {
- "stops": [
- [13, "hsl(50, 17%, 82%)"],
- [16, "hsl(230, 10%, 74%)"]
- ]
- },
- "line-width": {"base": 1.5, "stops": [[14, 4], [20, 8]]},
- "line-dasharray": [0.1, 15],
- "line-opacity": {"base": 1, "stops": [[13.75, 0], [20, 1]]}
- }
- },
- {
- "id": "bridge-trunk_link-2-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "bridge"],
- ["==", "type", "trunk_link"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]}
- }
- },
- {
- "id": "bridge-motorway_link-2-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway_link"],
- ["==", "structure", "bridge"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-opacity": 1
- }
- },
- {
- "id": "bridge-trunk-2-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "trunk"],
- ["==", "structure", "bridge"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}
- }
- },
- {
- "id": "bridge-motorway-2-case",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway"],
- ["==", "structure", "bridge"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]},
- "line-color": "hsl(0, 0%, 100%)",
- "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}
- }
- },
- {
- "id": "bridge-trunk_link-2",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "structure", "bridge"],
- ["==", "type", "trunk_link"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(46, 85%, 67%)"
- }
- },
- {
- "id": "bridge-motorway_link-2",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway_link"],
- ["==", "structure", "bridge"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {
- "base": 1.5,
- "stops": [[12, 0.5], [14, 2], [18, 18]]
- },
- "line-color": "hsl(26, 100%, 68%)"
- }
- },
- {
- "id": "bridge-trunk-2",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "trunk"],
- ["==", "structure", "bridge"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(46, 85%, 67%)"
- }
- },
- {
- "id": "bridge-motorway-2",
- "type": "line",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- ["==", "class", "motorway"],
- ["==", "structure", "bridge"],
- [">=", "layer", 2]
- ]
- ],
- "layout": {"line-cap": "round", "line-join": "round"},
- "paint": {
- "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]},
- "line-color": "hsl(26, 100%, 68%)"
- }
- },
- {
- "id": "bridge-oneway-arrows-white",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444855799204.86"},
- "source": "composite",
- "source-layer": "road",
- "minzoom": 16,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "all",
- [
- "!in",
- "type",
- "primary_link",
- "secondary_link",
- "tertiary_link"
- ],
- ["==", "oneway", "true"],
- ["==", "structure", "bridge"],
- [
- "in",
- "class",
- "link",
- "motorway",
- "motorway_link",
- "trunk"
- ]
- ]
- ],
- "layout": {
- "symbol-placement": "line",
- "icon-image": {
- "base": 1,
- "stops": [
- [16, "oneway-white-small"],
- [17, "oneway-white-large"]
- ]
- },
- "symbol-spacing": 200,
- "icon-padding": 2
- },
- "paint": {}
- },
- {
- "id": "aerialway",
- "type": "line",
- "source": "composite",
- "source-layer": "road",
- "minzoom": 13,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["==", "class", "aerialway"]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-color": "hsl(230, 10%, 74%)",
- "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]}
- }
- },
- {
- "id": "admin-3-4-boundaries-bg",
- "type": "line",
- "metadata": {"mapbox:group": "1444934295202.7542"},
- "source": "composite",
- "source-layer": "admin",
- "filter": ["all", ["==", "maritime", 0], [">=", "admin_level", 3]],
- "layout": {"line-join": "bevel"},
- "paint": {
- "line-color": {
- "base": 1,
- "stops": [
- [8, "hsl(35, 12%, 89%)"],
- [16, "hsl(230, 49%, 90%)"]
- ]
- },
- "line-width": {"base": 1, "stops": [[7, 3.75], [12, 5.5]]},
- "line-opacity": {"base": 1, "stops": [[7, 0], [8, 0.75]]},
- "line-dasharray": [1, 0],
- "line-translate": [0, 0],
- "line-blur": {"base": 1, "stops": [[3, 0], [8, 3]]}
- }
- },
- {
- "id": "admin-2-boundaries-bg",
- "type": "line",
- "metadata": {"mapbox:group": "1444934295202.7542"},
- "source": "composite",
- "source-layer": "admin",
- "minzoom": 1,
- "filter": ["all", ["==", "admin_level", 2], ["==", "maritime", 0]],
- "layout": {"line-join": "miter"},
- "paint": {
- "line-width": {"base": 1, "stops": [[3, 3.5], [10, 8]]},
- "line-color": {
- "base": 1,
- "stops": [
- [6, "hsl(35, 12%, 89%)"],
- [8, "hsl(230, 49%, 90%)"]
- ]
- },
- "line-opacity": {"base": 1, "stops": [[3, 0], [4, 0.5]]},
- "line-translate": [0, 0],
- "line-blur": {"base": 1, "stops": [[3, 0], [10, 2]]}
- }
- },
- {
- "id": "admin-3-4-boundaries",
- "type": "line",
- "metadata": {"mapbox:group": "1444934295202.7542"},
- "source": "composite",
- "source-layer": "admin",
- "filter": ["all", ["==", "maritime", 0], [">=", "admin_level", 3]],
- "layout": {"line-join": "round", "line-cap": "round"},
- "paint": {
- "line-dasharray": {
- "base": 1,
- "stops": [[6, [2, 0]], [7, [2, 2, 6, 2]]]
- },
- "line-width": {"base": 1, "stops": [[7, 0.75], [12, 1.5]]},
- "line-opacity": {"base": 1, "stops": [[2, 0], [3, 1]]},
- "line-color": {
- "base": 1,
- "stops": [
- [3, "hsl(230, 14%, 77%)"],
- [7, "hsl(230, 8%, 62%)"]
- ]
- }
- }
- },
- {
- "id": "admin-2-boundaries",
- "type": "line",
- "metadata": {"mapbox:group": "1444934295202.7542"},
- "source": "composite",
- "source-layer": "admin",
- "minzoom": 1,
- "filter": [
- "all",
- ["==", "admin_level", 2],
- ["==", "disputed", 0],
- ["==", "maritime", 0]
- ],
- "layout": {"line-join": "round", "line-cap": "round"},
- "paint": {
- "line-color": "hsl(230, 8%, 51%)",
- "line-width": {"base": 1, "stops": [[3, 0.5], [10, 2]]}
- }
- },
- {
- "id": "admin-2-boundaries-dispute",
- "type": "line",
- "metadata": {"mapbox:group": "1444934295202.7542"},
- "source": "composite",
- "source-layer": "admin",
- "minzoom": 1,
- "filter": [
- "all",
- ["==", "admin_level", 2],
- ["==", "disputed", 1],
- ["==", "maritime", 0]
- ],
- "layout": {"line-join": "round"},
- "paint": {
- "line-dasharray": [1.5, 1.5],
- "line-color": "hsl(230, 8%, 51%)",
- "line-width": {"base": 1, "stops": [[3, 0.5], [10, 2]]}
- }
- },
- {
- "id": "housenum-label",
- "type": "symbol",
- "source": "composite",
- "source-layer": "housenum_label",
- "minzoom": 17,
- "layout": {
- "text-field": "{house_num}",
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 4,
- "text-max-width": 7,
- "text-size": 9.5
- },
- "paint": {
- "text-color": "hsl(35, 2%, 69%)",
- "text-halo-color": "hsl(35, 8%, 85%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0
- }
- },
- {
- "id": "waterway-label",
- "type": "symbol",
- "source": "composite",
- "source-layer": "waterway_label",
- "minzoom": 12,
- "filter": ["in", "class", "canal", "river"],
- "layout": {
- "text-field": "{name_en}",
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "symbol-placement": "line",
- "text-pitch-alignment": "viewport",
- "text-max-angle": 30,
- "text-size": {"base": 1, "stops": [[13, 12], [18, 16]]}
- },
- "paint": {
- "text-halo-width": 0.5,
- "text-halo-color": "hsl(196, 80%, 70%)",
- "text-color": "hsl(230, 48%, 44%)",
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-scalerank4-l15",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933456003.5437"},
- "source": "composite",
- "source-layer": "poi_label",
- "minzoom": 17,
- "filter": [
- "all",
- [
- "!in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ],
- ["==", "scalerank", 4],
- [">=", "localrank", 15]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]},
- "icon-image": "{maki}-11",
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(26, 25%, 32%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-scalerank4-l1",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933456003.5437"},
- "source": "composite",
- "source-layer": "poi_label",
- "minzoom": 15,
- "filter": [
- "all",
- [
- "!in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ],
- ["<=", "localrank", 14],
- ["==", "scalerank", 4]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]},
- "icon-image": "{maki}-11",
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 1,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(26, 25%, 32%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-parks_scalerank4",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933456003.5437"},
- "source": "composite",
- "source-layer": "poi_label",
- "minzoom": 15,
- "filter": [
- "all",
- ["==", "scalerank", 4],
- [
- "in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]},
- "icon-image": "{maki}-11",
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 1,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(100, 100%, 20%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-scalerank3",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933372896.5967"},
- "source": "composite",
- "source-layer": "poi_label",
- "filter": [
- "all",
- [
- "!in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ],
- ["==", "scalerank", 3]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]},
- "icon-image": "{maki}-11",
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 1,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(26, 25%, 32%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-parks-scalerank3",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933372896.5967"},
- "source": "composite",
- "source-layer": "poi_label",
- "filter": [
- "all",
- ["==", "scalerank", 3],
- [
- "in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]},
- "icon-image": "{maki}-11",
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(100, 100%, 20%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "road-label-small",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933721429.3076"},
- "source": "composite",
- "source-layer": "road_label",
- "minzoom": 15,
- "filter": [
- "all",
- [
- "!in",
- "class",
- "golf",
- "link",
- "motorway",
- "pedestrian",
- "primary",
- "secondary",
- "street",
- "street_limited",
- "tertiary",
- "trunk"
- ],
- ["==", "$type", "LineString"]
- ],
- "layout": {
- "text-size": {"base": 1, "stops": [[15, 10], [20, 13]]},
- "text-max-angle": 30,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "symbol-placement": "line",
- "text-padding": 1,
- "text-rotation-alignment": "map",
- "text-pitch-alignment": "viewport",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1.25,
- "text-halo-blur": 1
- }
- },
- {
- "id": "road-label-medium",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933721429.3076"},
- "source": "composite",
- "source-layer": "road_label",
- "minzoom": 11,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [
- "in",
- "class",
- "link",
- "pedestrian",
- "street",
- "street_limited"
- ]
- ],
- "layout": {
- "text-size": {"base": 1, "stops": [[11, 10], [20, 14]]},
- "text-max-angle": 30,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "symbol-placement": "line",
- "text-padding": 1,
- "text-rotation-alignment": "map",
- "text-pitch-alignment": "viewport",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1
- }
- },
- {
- "id": "road-label-large",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933721429.3076"},
- "source": "composite",
- "source-layer": "road_label",
- "filter": [
- "in",
- "class",
- "motorway",
- "primary",
- "secondary",
- "tertiary",
- "trunk"
- ],
- "layout": {
- "text-size": {"base": 1, "stops": [[9, 10], [20, 16]]},
- "text-max-angle": 30,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "symbol-placement": "line",
- "text-padding": 1,
- "text-rotation-alignment": "map",
- "text-pitch-alignment": "viewport",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsla(0, 0%, 100%, 0.75)",
- "text-halo-width": 1,
- "text-halo-blur": 1
- }
- },
- {
- "id": "road-shields-black",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933575858.6992"},
- "source": "composite",
- "source-layer": "road_label",
- "filter": [
- "all",
- [
- "!in",
- "shield",
- "at-expressway",
- "at-motorway",
- "at-state-b",
- "bg-motorway",
- "bg-national",
- "ch-main",
- "ch-motorway",
- "cz-motorway",
- "cz-road",
- "de-motorway",
- "e-road",
- "fi-main",
- "gr-motorway",
- "gr-national",
- "hr-motorway",
- "hr-state",
- "hu-main",
- "hu-motorway",
- "nz-state",
- "pl-expressway",
- "pl-motorway",
- "pl-national",
- "ro-county",
- "ro-motorway",
- "ro-national",
- "rs-motorway",
- "rs-state-1b",
- "se-main",
- "si-expressway",
- "si-motorway",
- "sk-highway",
- "sk-road",
- "us-interstate",
- "us-interstate-business",
- "us-interstate-duplex",
- "us-interstate-truck",
- "za-metropolitan",
- "za-national",
- "za-provincial",
- "za-regional"
- ],
- ["<=", "reflen", 6]
- ],
- "layout": {
- "text-size": 9,
- "icon-image": "{shield}-{reflen}",
- "icon-rotation-alignment": "viewport",
- "text-max-angle": 38,
- "symbol-spacing": {"base": 1, "stops": [[11, 150], [14, 200]]},
- "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"],
- "symbol-placement": {
- "base": 1,
- "stops": [[10, "point"], [11, "line"]]
- },
- "text-padding": 2,
- "text-rotation-alignment": "viewport",
- "text-field": "{ref}",
- "text-letter-spacing": 0.05,
- "icon-padding": 2
- },
- "paint": {
- "text-color": "hsl(0, 0%, 7%)",
- "icon-halo-color": "rgba(0, 0, 0, 1)",
- "icon-halo-width": 1,
- "text-opacity": 1,
- "icon-color": "white",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0
- }
- },
- {
- "id": "road-shields-white",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933575858.6992"},
- "source": "composite",
- "source-layer": "road_label",
- "filter": [
- "all",
- ["<=", "reflen", 6],
- [
- "in",
- "shield",
- "at-expressway",
- "at-motorway",
- "at-state-b",
- "bg-motorway",
- "bg-national",
- "ch-main",
- "ch-motorway",
- "cz-motorway",
- "cz-road",
- "de-motorway",
- "e-road",
- "fi-main",
- "gr-motorway",
- "gr-national",
- "hr-motorway",
- "hr-state",
- "hu-main",
- "hu-motorway",
- "nz-state",
- "pl-expressway",
- "pl-motorway",
- "pl-national",
- "ro-county",
- "ro-motorway",
- "ro-national",
- "rs-motorway",
- "rs-state-1b",
- "se-main",
- "si-expressway",
- "si-motorway",
- "sk-highway",
- "sk-road",
- "us-interstate",
- "us-interstate-business",
- "us-interstate-duplex",
- "us-interstate-truck",
- "za-metropolitan",
- "za-national",
- "za-provincial",
- "za-regional"
- ]
- ],
- "layout": {
- "text-size": 9,
- "icon-image": "{shield}-{reflen}",
- "icon-rotation-alignment": "viewport",
- "text-max-angle": 38,
- "symbol-spacing": {"base": 1, "stops": [[11, 150], [14, 200]]},
- "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"],
- "symbol-placement": {
- "base": 1,
- "stops": [[10, "point"], [11, "line"]]
- },
- "text-padding": 2,
- "text-rotation-alignment": "viewport",
- "text-field": "{ref}",
- "text-letter-spacing": 0.05,
- "icon-padding": 2
- },
- "paint": {
- "text-color": "hsl(0, 0%, 100%)",
- "icon-halo-color": "rgba(0, 0, 0, 1)",
- "icon-halo-width": 1,
- "text-opacity": 1,
- "icon-color": "white",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0
- }
- },
- {
- "id": "motorway-junction",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933575858.6992"},
- "source": "composite",
- "source-layer": "motorway_junction",
- "minzoom": 14,
- "filter": ["all", ["<=", "reflen", 9], [">", "reflen", 0]],
- "layout": {
- "text-field": "{ref}",
- "text-size": 9,
- "icon-image": "motorway-exit-{reflen}",
- "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"]
- },
- "paint": {
- "text-color": "hsl(0, 0%, 100%)",
- "text-translate": [0, 0]
- }
- },
- {
- "id": "poi-scalerank2",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933358918.2366"},
- "source": "composite",
- "source-layer": "poi_label",
- "filter": [
- "all",
- [
- "!in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ],
- ["==", "scalerank", 2]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[14, 11], [20, 14]]},
- "icon-image": {"stops": [[14, "{maki}-11"], [15, "{maki}-15"]]},
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(26, 25%, 32%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-parks-scalerank2",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933358918.2366"},
- "source": "composite",
- "source-layer": "poi_label",
- "filter": [
- "all",
- ["==", "scalerank", 2],
- [
- "in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[14, 11], [20, 14]]},
- "icon-image": {"stops": [[14, "{maki}-11"], [15, "{maki}-15"]]},
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(100, 100%, 20%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "rail-label",
- "type": "symbol",
- "source": "composite",
- "source-layer": "rail_station_label",
- "minzoom": 12,
- "filter": ["!=", "maki", "entrance"],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]},
- "icon-image": "{network}",
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-offset": [0, 0.85],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": {
- "base": 1,
- "stops": [[0, ""], [13, "{name_en}"]]
- },
- "text-letter-spacing": 0.01,
- "icon-padding": 0,
- "text-max-width": 7
- },
- "paint": {
- "text-color": "hsl(230, 48%, 44%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "icon-halo-width": 4,
- "icon-halo-color": "#fff",
- "text-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]},
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "water-label-sm",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933808272.805"},
- "source": "composite",
- "source-layer": "water_label",
- "minzoom": 15,
- "filter": ["<=", "area", 10000],
- "layout": {
- "text-field": "{name_en}",
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "text-max-width": 7,
- "text-size": {"base": 1, "stops": [[16, 13], [20, 16]]}
- },
- "paint": {"text-color": "hsl(230, 48%, 44%)"}
- },
- {
- "id": "water-label",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933808272.805"},
- "source": "composite",
- "source-layer": "water_label",
- "minzoom": 5,
- "filter": [">", "area", 10000],
- "layout": {
- "text-field": "{name_en}",
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "text-max-width": 7,
- "text-size": {"base": 1, "stops": [[13, 13], [18, 18]]}
- },
- "paint": {"text-color": "hsl(230, 48%, 44%)"}
- },
- {
- "id": "place-residential",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "maxzoom": 18,
- "filter": [
- "all",
- ["all", ["<=", "localrank", 10], ["==", "type", "residential"]],
- ["in", "$type", "LineString", "Point", "Polygon"]
- ],
- "layout": {
- "text-line-height": 1.2,
- "text-size": {"base": 1, "stops": [[10, 11], [18, 14]]},
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0],
- "text-rotation-alignment": "viewport",
- "text-field": "{name_en}",
- "text-max-width": 7
- },
- "paint": {
- "text-color": "hsl(26, 25%, 32%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-parks-scalerank1",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933322393.2852"},
- "source": "composite",
- "source-layer": "poi_label",
- "filter": [
- "all",
- ["<=", "scalerank", 1],
- [
- "in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[10, 11], [18, 14]]},
- "icon-image": {"stops": [[13, "{maki}-11"], [14, "{maki}-15"]]},
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(100, 100%, 20%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "poi-scalerank1",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444933322393.2852"},
- "source": "composite",
- "source-layer": "poi_label",
- "filter": [
- "all",
- [
- "!in",
- "maki",
- "campsite",
- "cemetery",
- "dog-park",
- "garden",
- "golf",
- "park",
- "picnic-site",
- "playground",
- "zoo"
- ],
- ["<=", "scalerank", 1]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[10, 11], [18, 14]]},
- "icon-image": {"stops": [[13, "{maki}-11"], [14, "{maki}-15"]]},
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0.65],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(26, 25%, 32%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "airport-label",
- "type": "symbol",
- "source": "composite",
- "source-layer": "airport_label",
- "minzoom": 9,
- "filter": ["<=", "scalerank", 2],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[10, 12], [18, 18]]},
- "icon-image": {"stops": [[12, "{maki}-11"], [13, "{maki}-15"]]},
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0.75],
- "text-rotation-alignment": "viewport",
- "text-anchor": "top",
- "text-field": {"stops": [[11, "{ref}"], [12, "{name_en}"]]},
- "text-letter-spacing": 0.01,
- "text-max-width": 9
- },
- "paint": {
- "text-color": "hsl(230, 48%, 44%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 0.5,
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "place-islet-archipelago-aboriginal",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "maxzoom": 16,
- "filter": [
- "in",
- "type",
- "aboriginal_lands",
- "archipelago",
- "islet"
- ],
- "layout": {
- "text-line-height": 1.2,
- "text-size": {"base": 1, "stops": [[10, 11], [18, 16]]},
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0],
- "text-rotation-alignment": "viewport",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 8
- },
- "paint": {
- "text-color": "hsl(230, 29%, 35%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1
- }
- },
- {
- "id": "place-neighbourhood",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "minzoom": 10,
- "maxzoom": 16,
- "filter": ["==", "type", "neighbourhood"],
- "layout": {
- "text-field": "{name_en}",
- "text-transform": "uppercase",
- "text-letter-spacing": 0.1,
- "text-max-width": 7,
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 3,
- "text-size": {"base": 1, "stops": [[12, 11], [16, 16]]}
- },
- "paint": {
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1,
- "text-color": "hsl(230, 29%, 35%)",
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "place-suburb",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "minzoom": 10,
- "maxzoom": 16,
- "filter": ["==", "type", "suburb"],
- "layout": {
- "text-field": "{name_en}",
- "text-transform": "uppercase",
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "text-letter-spacing": 0.15,
- "text-max-width": 7,
- "text-padding": 3,
- "text-size": {"base": 1, "stops": [[11, 11], [15, 18]]}
- },
- "paint": {
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1,
- "text-color": "hsl(230, 29%, 35%)",
- "text-halo-blur": 0.5
- }
- },
- {
- "id": "place-hamlet",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "minzoom": 10,
- "maxzoom": 16,
- "filter": ["==", "type", "hamlet"],
- "layout": {
- "text-field": "{name_en}",
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 1, "stops": [[12, 11.5], [15, 16]]}
- },
- "paint": {
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1.25,
- "text-color": "hsl(0, 0%, 0%)"
- }
- },
- {
- "id": "place-village",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "minzoom": 8,
- "maxzoom": 15,
- "filter": ["==", "type", "village"],
- "layout": {
- "text-field": "{name_en}",
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "text-max-width": 7,
- "text-size": {"base": 1, "stops": [[10, 11.5], [16, 18]]}
- },
- "paint": {
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1.25,
- "text-color": "hsl(0, 0%, 0%)"
- }
- },
- {
- "id": "place-town",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "minzoom": 6,
- "maxzoom": 15,
- "filter": ["==", "type", "town"],
- "layout": {
- "icon-image": "dot-9",
- "text-font": {
- "base": 1,
- "stops": [
- [
- 11,
- ["DIN Offc Pro Regular", "Arial Unicode MS Regular"]
- ],
- [
- 12,
- ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]
- ]
- ]
- },
- "text-offset": {
- "base": 1,
- "stops": [[7, [0, -0.15]], [8, [0, 0]]]
- },
- "text-anchor": {
- "base": 1,
- "stops": [[7, "bottom"], [8, "center"]]
- },
- "text-field": "{name_en}",
- "text-max-width": 7,
- "text-size": {"base": 1, "stops": [[7, 11.5], [15, 20]]}
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1.25,
- "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]}
- }
- },
- {
- "id": "place-island",
- "type": "symbol",
- "source": "composite",
- "source-layer": "place_label",
- "maxzoom": 16,
- "filter": ["==", "type", "island"],
- "layout": {
- "text-line-height": 1.2,
- "text-size": {"base": 1, "stops": [[10, 11], [18, 16]]},
- "text-max-angle": 38,
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Regular",
- "Arial Unicode MS Regular"
- ],
- "text-padding": 2,
- "text-offset": [0, 0],
- "text-rotation-alignment": "viewport",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.01,
- "text-max-width": 7
- },
- "paint": {
- "text-color": "hsl(230, 29%, 35%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1
- }
- },
- {
- "id": "place-city-sm",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444862510685.128"},
- "source": "composite",
- "source-layer": "place_label",
- "maxzoom": 14,
- "filter": [
- "all",
- ["!in", "scalerank", 0, 1, 2, 3, 4, 5],
- ["==", "type", "city"]
- ],
- "layout": {
- "text-size": {"base": 1, "stops": [[6, 12], [14, 22]]},
- "icon-image": "dot-9",
- "text-font": {
- "base": 1,
- "stops": [
- [
- 7,
- ["DIN Offc Pro Regular", "Arial Unicode MS Regular"]
- ],
- [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]]
- ]
- },
- "text-offset": {
- "base": 1,
- "stops": [[7.99, [0, -0.2]], [8, [0, 0]]]
- },
- "text-anchor": {
- "base": 1,
- "stops": [[7, "bottom"], [8, "center"]]
- },
- "text-field": "{name_en}",
- "text-max-width": 7
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1.25,
- "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]}
- }
- },
- {
- "id": "place-city-md-s",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444862510685.128"},
- "source": "composite",
- "source-layer": "place_label",
- "maxzoom": 14,
- "filter": [
- "all",
- ["==", "type", "city"],
- ["in", "ldir", "E", "S", "SE", "SW"],
- ["in", "scalerank", 3, 4, 5]
- ],
- "layout": {
- "text-field": "{name_en}",
- "icon-image": "dot-10",
- "text-anchor": {
- "base": 1,
- "stops": [[7, "top"], [8, "center"]]
- },
- "text-offset": {
- "base": 1,
- "stops": [[7.99, [0, 0.1]], [8, [0, 0]]]
- },
- "text-font": {
- "base": 1,
- "stops": [
- [
- 7,
- ["DIN Offc Pro Regular", "Arial Unicode MS Regular"]
- ],
- [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]]
- ]
- },
- "text-size": {"base": 0.9, "stops": [[5, 12], [12, 22]]}
- },
- "paint": {
- "text-halo-width": 1,
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-blur": 1,
- "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]}
- }
- },
- {
- "id": "place-city-md-n",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444862510685.128"},
- "source": "composite",
- "source-layer": "place_label",
- "maxzoom": 14,
- "filter": [
- "all",
- ["==", "type", "city"],
- ["in", "ldir", "N", "NE", "NW", "W"],
- ["in", "scalerank", 3, 4, 5]
- ],
- "layout": {
- "icon-image": "dot-10",
- "text-font": {
- "base": 1,
- "stops": [
- [
- 7,
- ["DIN Offc Pro Regular", "Arial Unicode MS Regular"]
- ],
- [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]]
- ]
- },
- "text-offset": {
- "base": 1,
- "stops": [[7.99, [0, -0.25]], [8, [0, 0]]]
- },
- "text-anchor": {
- "base": 1,
- "stops": [[7, "bottom"], [8, "center"]]
- },
- "text-field": "{name_en}",
- "text-max-width": 7,
- "text-size": {"base": 0.9, "stops": [[5, 12], [12, 22]]}
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1,
- "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]},
- "text-halo-blur": 1
- }
- },
- {
- "id": "place-city-lg-s",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444862510685.128"},
- "source": "composite",
- "source-layer": "place_label",
- "minzoom": 1,
- "maxzoom": 14,
- "filter": [
- "all",
- ["<=", "scalerank", 2],
- ["==", "type", "city"],
- ["in", "ldir", "E", "S", "SE", "SW"]
- ],
- "layout": {
- "icon-image": "dot-11",
- "text-font": {
- "base": 1,
- "stops": [
- [
- 7,
- ["DIN Offc Pro Regular", "Arial Unicode MS Regular"]
- ],
- [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]]
- ]
- },
- "text-offset": {
- "base": 1,
- "stops": [[7.99, [0, 0.15]], [8, [0, 0]]]
- },
- "text-anchor": {
- "base": 1,
- "stops": [[7, "top"], [8, "center"]]
- },
- "text-field": "{name_en}",
- "text-max-width": 7,
- "text-size": {"base": 0.9, "stops": [[4, 12], [10, 22]]}
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1,
- "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]},
- "text-halo-blur": 1
- }
- },
- {
- "id": "place-city-lg-n",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444862510685.128"},
- "source": "composite",
- "source-layer": "place_label",
- "minzoom": 1,
- "maxzoom": 14,
- "filter": [
- "all",
- ["<=", "scalerank", 2],
- ["==", "type", "city"],
- ["in", "ldir", "N", "NE", "NW", "W"]
- ],
- "layout": {
- "icon-image": "dot-11",
- "text-font": {
- "base": 1,
- "stops": [
- [
- 7,
- ["DIN Offc Pro Regular", "Arial Unicode MS Regular"]
- ],
- [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]]
- ]
- },
- "text-offset": {
- "base": 1,
- "stops": [[7.99, [0, -0.25]], [8, [0, 0]]]
- },
- "text-anchor": {
- "base": 1,
- "stops": [[7, "bottom"], [8, "center"]]
- },
- "text-field": "{name_en}",
- "text-max-width": 7,
- "text-size": {"base": 0.9, "stops": [[4, 12], [10, 22]]}
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-opacity": 1,
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1,
- "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]},
- "text-halo-blur": 1
- }
- },
- {
- "id": "marine-label-sm-ln",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856087950.3635"},
- "source": "composite",
- "source-layer": "marine_label",
- "minzoom": 3,
- "maxzoom": 10,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- [">=", "labelrank", 4]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1, "stops": [[3, 12], [6, 16]]},
- "symbol-spacing": {"base": 1, "stops": [[4, 100], [6, 400]]},
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "symbol-placement": "line",
- "text-pitch-alignment": "viewport",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.1,
- "text-max-width": 5
- },
- "paint": {"text-color": "hsl(205, 83%, 88%)"}
- },
- {
- "id": "marine-label-sm-pt",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856087950.3635"},
- "source": "composite",
- "source-layer": "marine_label",
- "minzoom": 3,
- "maxzoom": 10,
- "filter": ["all", ["==", "$type", "Point"], [">=", "labelrank", 4]],
- "layout": {
- "text-field": "{name_en}",
- "text-max-width": 5,
- "text-letter-spacing": 0.1,
- "text-line-height": 1.5,
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 1, "stops": [[3, 12], [6, 16]]}
- },
- "paint": {"text-color": "hsl(205, 83%, 88%)"}
- },
- {
- "id": "marine-label-md-ln",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856087950.3635"},
- "source": "composite",
- "source-layer": "marine_label",
- "minzoom": 2,
- "maxzoom": 8,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["in", "labelrank", 2, 3]
- ],
- "layout": {
- "text-line-height": 1.1,
- "text-size": {"base": 1.1, "stops": [[2, 12], [5, 20]]},
- "symbol-spacing": 250,
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "symbol-placement": "line",
- "text-pitch-alignment": "viewport",
- "text-field": "{name_en}",
- "text-letter-spacing": 0.15,
- "text-max-width": 5
- },
- "paint": {"text-color": "hsl(205, 83%, 88%)"}
- },
- {
- "id": "marine-label-md-pt",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856087950.3635"},
- "source": "composite",
- "source-layer": "marine_label",
- "minzoom": 2,
- "maxzoom": 8,
- "filter": [
- "all",
- ["==", "$type", "Point"],
- ["in", "labelrank", 2, 3]
- ],
- "layout": {
- "text-field": "{name_en}",
- "text-max-width": 5,
- "text-letter-spacing": 0.15,
- "text-line-height": 1.5,
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 1.1, "stops": [[2, 14], [5, 20]]}
- },
- "paint": {"text-color": "hsl(205, 83%, 88%)"}
- },
- {
- "id": "marine-label-lg-ln",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856087950.3635"},
- "source": "composite",
- "source-layer": "marine_label",
- "minzoom": 1,
- "maxzoom": 4,
- "filter": [
- "all",
- ["==", "$type", "LineString"],
- ["==", "labelrank", 1]
- ],
- "layout": {
- "text-field": "{name_en}",
- "text-max-width": 4,
- "text-letter-spacing": 0.25,
- "text-line-height": 1.1,
- "symbol-placement": "line",
- "text-pitch-alignment": "viewport",
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 1, "stops": [[1, 14], [4, 30]]}
- },
- "paint": {"text-color": "hsl(205, 83%, 88%)"}
- },
- {
- "id": "marine-label-lg-pt",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856087950.3635"},
- "source": "composite",
- "source-layer": "marine_label",
- "minzoom": 1,
- "maxzoom": 4,
- "filter": ["all", ["==", "$type", "Point"], ["==", "labelrank", 1]],
- "layout": {
- "text-field": "{name_en}",
- "text-max-width": 4,
- "text-letter-spacing": 0.25,
- "text-line-height": 1.5,
- "text-font": [
- "DIN Offc Pro Italic",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 1, "stops": [[1, 14], [4, 30]]}
- },
- "paint": {"text-color": "hsl(205, 83%, 88%)"}
- },
- {
- "id": "state-label-sm",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856151690.9143"},
- "source": "composite",
- "source-layer": "state_label",
- "minzoom": 3,
- "maxzoom": 9,
- "filter": ["<", "area", 20000],
- "layout": {
- "text-size": {"base": 1, "stops": [[6, 10], [9, 14]]},
- "text-transform": "uppercase",
- "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"],
- "text-field": {
- "base": 1,
- "stops": [[0, "{abbr}"], [6, "{name_en}"]]
- },
- "text-letter-spacing": 0.15,
- "text-max-width": 5
- },
- "paint": {
- "text-opacity": 1,
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1
- }
- },
- {
- "id": "state-label-md",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856151690.9143"},
- "source": "composite",
- "source-layer": "state_label",
- "minzoom": 3,
- "maxzoom": 8,
- "filter": ["all", ["<", "area", 80000], [">=", "area", 20000]],
- "layout": {
- "text-size": {"base": 1, "stops": [[5, 10], [8, 16]]},
- "text-transform": "uppercase",
- "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"],
- "text-field": {
- "base": 1,
- "stops": [[0, "{abbr}"], [5, "{name_en}"]]
- },
- "text-letter-spacing": 0.15,
- "text-max-width": 6
- },
- "paint": {
- "text-opacity": 1,
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1
- }
- },
- {
- "id": "state-label-lg",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856151690.9143"},
- "source": "composite",
- "source-layer": "state_label",
- "minzoom": 3,
- "maxzoom": 7,
- "filter": [">=", "area", 80000],
- "layout": {
- "text-size": {"base": 1, "stops": [[4, 10], [7, 18]]},
- "text-transform": "uppercase",
- "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"],
- "text-padding": 1,
- "text-field": {
- "base": 1,
- "stops": [[0, "{abbr}"], [4, "{name_en}"]]
- },
- "text-letter-spacing": 0.15,
- "text-max-width": 6
- },
- "paint": {
- "text-opacity": 1,
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": "hsl(0, 0%, 100%)",
- "text-halo-width": 1
- }
- },
- {
- "id": "country-label-sm",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856144497.7825"},
- "source": "composite",
- "source-layer": "country_label",
- "minzoom": 1,
- "maxzoom": 10,
- "filter": [">=", "scalerank", 5],
- "layout": {
- "text-field": "{name_en}",
- "text-max-width": 6,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 0.9, "stops": [[5, 14], [9, 22]]}
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": {
- "base": 1,
- "stops": [
- [2, "rgba(255,255,255,0.75)"],
- [3, "hsl(0, 0%, 100%)"]
- ]
- },
- "text-halo-width": 1.25
- }
- },
- {
- "id": "country-label-md",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856144497.7825"},
- "source": "composite",
- "source-layer": "country_label",
- "minzoom": 1,
- "maxzoom": 8,
- "filter": ["in", "scalerank", 3, 4],
- "layout": {
- "text-field": {
- "base": 1,
- "stops": [[0, "{code}"], [2, "{name_en}"]]
- },
- "text-max-width": 6,
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 1, "stops": [[3, 10], [8, 24]]}
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": {
- "base": 1,
- "stops": [
- [2, "rgba(255,255,255,0.75)"],
- [3, "hsl(0, 0%, 100%)"]
- ]
- },
- "text-halo-width": 1.25
- }
- },
- {
- "id": "country-label-lg",
- "type": "symbol",
- "metadata": {"mapbox:group": "1444856144497.7825"},
- "source": "composite",
- "source-layer": "country_label",
- "minzoom": 1,
- "maxzoom": 7,
- "filter": ["in", "scalerank", 1, 2],
- "layout": {
- "text-field": "{name_en}",
- "text-max-width": {"base": 1, "stops": [[0, 5], [3, 6]]},
- "text-font": [
- "DIN Offc Pro Medium",
- "Arial Unicode MS Regular"
- ],
- "text-size": {"base": 1, "stops": [[1, 10], [6, 24]]}
- },
- "paint": {
- "text-color": "hsl(0, 0%, 0%)",
- "text-halo-color": {
- "base": 1,
- "stops": [
- [2, "rgba(255,255,255,0.75)"],
- [3, "hsl(0, 0%, 100%)"]
- ]
- },
- "text-halo-width": 1.25
- }
- }
- ],
- "created": "2018-10-22T14:13:43.210Z",
- "id": "cjnkdt02b0b2p2ss40skwpvs1",
- "modified": "2018-10-22T14:14:35.211Z",
- "owner": "lukaspaczos",
- "visibility": "public",
- "draft": false
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt
deleted file mode 100644
index 16eb3d1f1a..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.mapbox.mapboxsdk
-
-import com.microsoft.appcenter.espresso.Factory
-import org.junit.After
-import org.junit.Rule
-
-abstract class AppCenter {
- @get:Rule
- var reportHelper = Factory.getReportHelper()!!
-
- @After
- open fun afterTest() {
- reportHelper.label(javaClass.simpleName)
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationApplication.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationApplication.kt
deleted file mode 100644
index ea48bdc00f..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationApplication.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.mapbox.mapboxsdk
-
-import com.mapbox.mapboxsdk.testapp.MapboxApplication
-
-class InstrumentationApplication : MapboxApplication() {
- override fun initializeLeakCanary(): Boolean {
- // do not initialize leak canary during instrumentation tests
- return true
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt
deleted file mode 100644
index 5c275df078..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.mapbox.mapboxsdk
-
-import android.app.Application
-import android.content.Context
-import android.support.test.runner.AndroidJUnitRunner
-
-class InstrumentationRunner : AndroidJUnitRunner() {
- override fun newApplication(cl: ClassLoader?, className: String?, context: Context?): Application {
- return super.newApplication(cl, InstrumentationApplication::class.java.name, context)
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt
deleted file mode 100644
index f840e970d1..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt
+++ /dev/null
@@ -1,186 +0,0 @@
-package com.mapbox.mapboxsdk.camera
-
-import android.graphics.PointF
-import android.support.test.annotation.UiThreadTest
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.geometry.LatLngBounds
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest
-import com.mapbox.mapboxsdk.testapp.activity.espresso.DeviceIndependentTestActivity
-import org.junit.Assert
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertTrue
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class CameraUpdateFactoryTest : BaseTest() {
-
- override fun getActivityClass(): Class<*> {
- return DeviceIndependentTestActivity::class.java
- }
-
- @Test
- @UiThreadTest
- fun testLatLngBoundsUntiltedUnrotated() {
- mapboxMap.cameraPosition = CameraPosition.Builder()
- .target(LatLng(60.0, 24.0))
- .bearing(0.0)
- .tilt(0.0)
- .build()
-
- val bounds: LatLngBounds = LatLngBounds.Builder()
- .include(LatLng(62.0, 26.0))
- .include(LatLng(58.0, 22.0))
- .build()
-
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0))
-
- val cameraPosition = mapboxMap.cameraPosition
- assertEquals("latitude should match:", 60.0, cameraPosition.target.latitude, 0.1)
- assertEquals("longitude should match:", 24.0, cameraPosition.target.longitude, 0.1)
- assertEquals("bearing should match:", 0.0, cameraPosition.bearing, 0.1)
- assertEquals("zoom should match", 5.5, cameraPosition.zoom, 0.1)
- assertEquals("tilt should match:", 0.0, cameraPosition.tilt, 0.1)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngBoundsTilted() {
- mapboxMap.cameraPosition = CameraPosition.Builder()
- .target(LatLng(60.0, 24.0))
- .bearing(0.0)
- .tilt(45.0)
- .build()
-
- val bounds: LatLngBounds = LatLngBounds.Builder()
- .include(LatLng(62.0, 26.0))
- .include(LatLng(58.0, 22.0))
- .build()
-
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0))
-
- val cameraPosition = mapboxMap.cameraPosition
- assertEquals("latitude should match:", 60.0, cameraPosition.target.latitude, 0.1)
- assertEquals("longitude should match:", 24.0, cameraPosition.target.longitude, 0.1)
- assertEquals("bearing should match:", 0.0, cameraPosition.bearing, 0.1)
- assertEquals("zoom should match", 6.0, cameraPosition.zoom, 0.1)
- assertEquals("tilt should match:", 45.0, cameraPosition.tilt, 0.1)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngBoundsRotated() {
- mapboxMap.cameraPosition = CameraPosition.Builder()
- .target(LatLng(60.0, 24.0))
- .bearing(30.0)
- .tilt(0.0)
- .build()
-
- val bounds: LatLngBounds = LatLngBounds.Builder()
- .include(LatLng(62.0, 26.0))
- .include(LatLng(58.0, 22.0))
- .build()
-
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0))
-
- val cameraPosition = mapboxMap.cameraPosition
- assertEquals("latitude should match:", 60.0, cameraPosition.target.latitude, 0.1)
- assertEquals("longitude should match:", 24.0, cameraPosition.target.longitude, 0.1)
- assertEquals("bearing should match:", 30.0, cameraPosition.bearing, 0.1)
- assertEquals("zoom should match", 5.3, cameraPosition.zoom, 0.1)
- assertEquals("tilt should match:", 0.0, cameraPosition.tilt, 0.1)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngBoundsTiltedRotated() {
- mapboxMap.cameraPosition = CameraPosition.Builder()
- .target(LatLng(60.0, 24.0))
- .bearing(30.0)
- .tilt(45.0)
- .build()
-
- val bounds: LatLngBounds = LatLngBounds.Builder()
- .include(LatLng(62.0, 26.0))
- .include(LatLng(58.0, 22.0))
- .build()
-
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0))
-
- val cameraPosition = mapboxMap.cameraPosition
- assertEquals("latitude should match:", 60.0, cameraPosition.target.latitude, 0.1)
- assertEquals("longitude should match:", 24.0, cameraPosition.target.longitude, 0.1)
- assertEquals("bearing should match:", 30.0, cameraPosition.bearing, 0.1)
- assertEquals("zoom should match", 5.6, cameraPosition.zoom, 0.1)
- assertEquals("tilt should match:", 45.0, cameraPosition.tilt, 0.1)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngBoundsWithProvidedTiltAndRotation() {
- mapboxMap.cameraPosition = CameraPosition.Builder()
- .target(LatLng(60.0, 24.0))
- .bearing(0.0)
- .tilt(0.0)
- .build()
-
- val bounds: LatLngBounds = LatLngBounds.Builder()
- .include(LatLng(62.0, 26.0))
- .include(LatLng(58.0, 22.0))
- .build()
-
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 30.0, 40.0, 0))
-
- val cameraPosition = mapboxMap.cameraPosition
- assertEquals("latitude should match:", 60.0, cameraPosition.target.latitude, 0.1)
- assertEquals("longitude should match:", 24.0, cameraPosition.target.longitude, 0.1)
- assertEquals("bearing should match:", 30.0, cameraPosition.bearing, 0.1)
- assertEquals("zoom should match", 5.6, cameraPosition.zoom, 0.1)
- assertEquals("tilt should match:", 40.0, cameraPosition.tilt, 0.1)
- }
-
- @Test
- @UiThreadTest
- fun withPadding_cameraInvalidated_paddingPersisting() {
- val initialCameraPosition = mapboxMap.cameraPosition
- val initialPoint = mapboxMap.projection.toScreenLocation(initialCameraPosition.target)
-
- val bottomPadding = mapView.height / 4
- val leftPadding = mapView.width / 4
- val padding = doubleArrayOf(leftPadding.toDouble(), 0.0, 0.0, bottomPadding.toDouble())
- mapboxMap.moveCamera(CameraUpdateFactory.paddingTo(leftPadding.toDouble(), 0.0, 0.0, bottomPadding.toDouble()))
-
- Assert.assertArrayEquals(intArrayOf(leftPadding, 0, 0, bottomPadding), mapboxMap.padding)
-
- val resultingCameraPosition = mapboxMap.cameraPosition
- assertEquals(initialCameraPosition.target, resultingCameraPosition.target)
- assertEquals(
- PointF(initialPoint.x + leftPadding / 2, initialPoint.y - bottomPadding / 2),
- mapboxMap.projection.toScreenLocation(resultingCameraPosition.target)
- )
- Assert.assertArrayEquals(padding, resultingCameraPosition.padding, 0.0001)
- }
-
- @Test
- @UiThreadTest
- fun withLatLngPadding_cameraInvalidated_paddingPersisting() {
- val expectedTarget = LatLng(2.0, 2.0)
-
- val topPadding = mapView.height / 4
- val rightPadding = mapView.width / 4
- val padding = doubleArrayOf(0.0, topPadding.toDouble(), rightPadding.toDouble(), 0.0)
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngPadding(expectedTarget, 0.0, topPadding.toDouble(), rightPadding.toDouble(), 0.0))
-
- Assert.assertArrayEquals(intArrayOf(0, topPadding, rightPadding, 0), mapboxMap.padding)
-
- val resultingCameraPosition = mapboxMap.cameraPosition
- assertEquals(expectedTarget.latitude, resultingCameraPosition.target.latitude, 0.1)
- assertEquals(expectedTarget.longitude, resultingCameraPosition.target.longitude, 0.1)
-
- val centerLatLng = mapboxMap.projection.fromScreenLocation(PointF((mapView.width / 2).toFloat(), (mapView.height / 2).toFloat()))
- assertTrue(centerLatLng.latitude > resultingCameraPosition.target.latitude)
- assertTrue(centerLatLng.longitude > resultingCameraPosition.target.longitude)
- Assert.assertArrayEquals(padding, resultingCameraPosition.padding, 0.0001)
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt
deleted file mode 100644
index 2afff34d34..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.content.Context
-import android.content.Intent
-import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
-import android.support.test.InstrumentationRegistry
-import android.support.test.uiautomator.*
-import com.mapbox.mapboxsdk.AppCenter
-import org.junit.Before
-
-const val TIMEOUT_UI_SEARCH_WAIT = 5000L
-
-abstract class BaseIntegrationTest : AppCenter() {
-
- protected lateinit var device: UiDevice
-
- @Before
- open fun beforeTest() {
- device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
- }
-}
-
-/**
- * Launches an activity with FLAG_ACTIVITY_NEW_TASK.
- * <p>
- * To resume an activity, you need to add a single instance launchmode to your manifest configuration.
- * <p>
- */
-fun UiDevice.launchActivity(context: Context, clazz: Class<*>) {
- val applicationPackage = InstrumentationRegistry.getTargetContext().packageName
- val intent = Intent(context, clazz)
- intent.addFlags(FLAG_ACTIVITY_NEW_TASK)
- InstrumentationRegistry.getContext().startActivity(intent)
- wait(Until.hasObject(By.pkg(applicationPackage).depth(0)), TIMEOUT_UI_SEARCH_WAIT)
-}
-
-fun UiDevice.scrollRecyclerViewTo(recycleItem: String) {
- val appView = UiScrollable(UiSelector().scrollable(true))
- appView.scrollIntoView(UiSelector().text(recycleItem))
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt
deleted file mode 100644
index 5673ffd4c1..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import android.support.test.uiautomator.UiSelector
-import com.mapbox.mapboxsdk.testapp.activity.fragment.FragmentBackStackActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates MapFragment integration on the backstack
- */
-@RunWith(AndroidJUnit4::class)
-class FragmentBackStackTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<FragmentBackStackActivity> = ActivityTestRule(FragmentBackStackActivity::class.java)
-
- @Test
- @LargeTest
- fun backPressedOnBackStackResumed() {
- device.waitForIdle()
- clickReplaceFragmentButton()
- device.pressHome()
- device.waitForIdle()
- device.launchActivity(activityRule.activity.applicationContext, FragmentBackStackActivity::class.java)
- backPressBackStack()
- device.waitForIdle()
- }
-
- private fun clickReplaceFragmentButton() {
- device.findObject(UiSelector().description(textDescription)).click()
- }
-
- private fun backPressBackStack() {
- device.pressBack() // pops fragment, showing map
- device.pressBack() // finish activity
- }
-
- private companion object {
- const val textDescription = "btn_change_fragment"
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt
deleted file mode 100644
index 40bc182bd7..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates reopening an Activity with a GLSurfaceView
- */
-@RunWith(AndroidJUnit4::class)
-class GLSurfaceViewReopenTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<SimpleMapActivity> = ActivityTestRule(SimpleMapActivity::class.java)
-
- @Test
- @LargeTest
- fun reopenSimpleMapActivity() {
- device.waitForIdle()
- device.pressHome()
- device.waitForIdle()
- device.launchActivity(activityRule.activity, SimpleMapActivity::class.java)
- device.waitForIdle()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt
deleted file mode 100644
index 5bf45518ec..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates if a GLSurfaceView surface can be recreated without crashing.
- */
-@RunWith(AndroidJUnit4::class)
-class GLSurfaceViewReuseTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<GLSurfaceRecyclerViewActivity> = ActivityTestRule(GLSurfaceRecyclerViewActivity::class.java)
-
- @Test
- @LargeTest
- fun scrollRecyclerView() {
- device.waitForIdle()
- device.scrollRecyclerViewTo("Twenty-one")
- device.waitForIdle()
- device.scrollRecyclerViewTo("One")
- device.waitForIdle()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt
deleted file mode 100644
index 8d5b5eb8aa..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class OrientationChangeTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<SimpleMapActivity> = ActivityTestRule(SimpleMapActivity::class.java)
-
- @Test
- @LargeTest
- fun rotateSimpleMap() {
- device.setOrientationLeft()
- device.waitForIdle()
- device.setOrientationNatural()
- device.waitForIdle()
- device.setOrientationRight()
- device.waitForIdle()
- device.setOrientationNatural()
- device.setOrientationLeft()
- device.setOrientationNatural()
- device.setOrientationRight()
- device.setOrientationNatural()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt
deleted file mode 100644
index e94d568e86..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxCountActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates reopening an Activity and querying the map before surface recreation #14394
- */
-@RunWith(AndroidJUnit4::class)
-class QueryRenderedFeaturesBoxCountTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<QueryRenderedFeaturesBoxCountActivity> =
- ActivityTestRule(QueryRenderedFeaturesBoxCountActivity::class.java)
-
- @Test
- @LargeTest
- fun reopenQueryRendererFeaturesActivity() {
- device.waitForIdle()
- device.pressHome()
- device.waitForIdle()
- device.launchActivity(activityRule.activity, QueryRenderedFeaturesBoxCountActivity::class.java)
- device.waitForIdle()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt
deleted file mode 100644
index cbfd5d6d55..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.textureview.TextureViewDebugModeActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates reopening an Activity with a TextureView
- */
-@RunWith(AndroidJUnit4::class)
-class TextureViewReopenTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<TextureViewDebugModeActivity> = ActivityTestRule(TextureViewDebugModeActivity::class.java)
-
- @Test
- @LargeTest
- fun reopenTextureViewDebugActivity() {
- device.waitForIdle()
- device.pressHome()
- device.waitForIdle()
- device.launchActivity(activityRule.activity, TextureViewDebugModeActivity::class.java)
- device.waitForIdle()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt
deleted file mode 100644
index dc2f74df4a..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.TextureRecyclerViewActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates if a GLSurfaceView surface can be recreated without crashing.
- */
-@RunWith(AndroidJUnit4::class)
-class TextureViewReuseTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<TextureRecyclerViewActivity> = ActivityTestRule(TextureRecyclerViewActivity::class.java)
-
- @Test
- @LargeTest
- fun scrollRecyclerView() {
- device.waitForIdle()
- device.scrollRecyclerViewTo("Twenty-one")
- device.waitForIdle()
- device.scrollRecyclerViewTo("One")
- device.waitForIdle()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt
deleted file mode 100644
index 5178ea9fc0..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.mapbox.mapboxsdk.integration
-
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import android.support.test.uiautomator.UiSelector
-import com.mapbox.mapboxsdk.testapp.activity.fragment.ViewPagerActivity
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates MapFragment integration with a ViewPager
- */
-@RunWith(AndroidJUnit4::class)
-class ViewPagerScrollTest : BaseIntegrationTest() {
-
- @get:Rule
- var activityRule: ActivityTestRule<ViewPagerActivity> = ActivityTestRule(ViewPagerActivity::class.java)
-
- @Test
- @LargeTest
- fun scrollViewPager() {
- for (i in 1..4) {
- clickTab(i)
- }
-
- for (i in 3 downTo 0) {
- clickTab(i)
- }
- }
-
- private fun clickTab(index: Int) {
- device.findObject(UiSelector().text("Page $index")).click()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
deleted file mode 100644
index 51c9e1c100..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
+++ /dev/null
@@ -1,1663 +0,0 @@
-package com.mapbox.mapboxsdk.location
-
-import android.Manifest
-import android.R
-import android.content.Context
-import android.graphics.Color
-import android.graphics.RectF
-import android.location.Location
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.IdlingRegistry
-import android.support.test.espresso.UiController
-import android.support.test.espresso.assertion.ViewAssertions.matches
-import android.support.test.espresso.matcher.ViewMatchers.*
-import android.support.test.rule.GrantPermissionRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.geojson.Point
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.location.LocationComponentConstants.*
-import com.mapbox.mapboxsdk.location.modes.CameraMode
-import com.mapbox.mapboxsdk.location.modes.RenderMode
-import com.mapbox.mapboxsdk.location.utils.*
-import com.mapbox.mapboxsdk.location.utils.MapboxTestingUtils.Companion.MAPBOX_HEAVY_STYLE
-import com.mapbox.mapboxsdk.location.utils.MapboxTestingUtils.Companion.pushSourceUpdates
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity
-import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils
-import com.mapbox.mapboxsdk.utils.BitmapUtils
-import com.mapbox.mapboxsdk.utils.ColorUtils
-import org.hamcrest.CoreMatchers.*
-import org.junit.*
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertTrue
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class LocationComponentTest : EspressoTest() {
-
- @Rule
- @JvmField
- val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION)
-
- private lateinit var styleChangeIdlingResource: StyleChangeIdlingResource
- private val location: Location by lazy {
- val initLocation = Location("")
- initLocation.latitude = 15.0
- initLocation.longitude = 17.0
- initLocation.bearing = 10f
- initLocation.accuracy = 150f
- initLocation
- }
-
- private lateinit var locationComponentActivationOptions: LocationComponentActivationOptions
-
- override fun validateTestSetup() {
- super.validateTestSetup()
- assertThat(mapboxMap.style, notNullValue())
- }
-
- @Before
- override fun beforeTest() {
- super.beforeTest()
- styleChangeIdlingResource = StyleChangeIdlingResource()
- IdlingRegistry.getInstance().register(styleChangeIdlingResource)
- }
-
- @Test
- fun locationComponent_initializesLocationEngineCorrectlyWhenOnesNotProvided() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
-
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .build())
- component.isLocationComponentEnabled = true
-
- val locationEngine = component.locationEngine
- assertThat(locationEngine, notNullValue())
-
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponent_initializesLocationEngineCorrectlyWhenOnesNotProvidedButHasOptions() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .staleStateTimeout(200)
- .enableStaleState(false)
- .accuracyAlpha(.5f)
- .accuracyColor(Color.BLUE)
- .build()
- )
- .build()
-
- component.activateLocationComponent(locationComponentActivationOptions)
-
- component.isLocationComponentEnabled = true
-
- val locationEngine = component.locationEngine
- val componentOptions = component.locationComponentOptions
-
- assertThat(locationEngine, notNullValue())
- assertThat(componentOptions, notNullValue())
-
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- assertThat(componentOptions?.accuracyAlpha(), `is`(.5f))
- assertThat(componentOptions?.accuracyColor(), `is`(Color.BLUE))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponent_doesntInitializeEngineWhenNullProvided() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .locationEngine(null)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .staleStateTimeout(200)
- .enableStaleState(false)
- .accuracyAlpha(.5f)
- .accuracyColor(Color.BLUE)
- .build()
- )
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
-
- component.isLocationComponentEnabled = true
-
- val locationEngine = component.locationEngine
- val componentOptions = component.locationComponentOptions
-
- assertThat(locationEngine, nullValue())
- assertThat(componentOptions, notNullValue())
-
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- assertThat(componentOptions?.accuracyAlpha(), `is`(.5f))
- assertThat(componentOptions?.accuracyColor(), `is`(Color.BLUE))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test(expected = IllegalArgumentException::class)
- fun settingMapStyleImmediatelyBeforeLoadingComponent_throwsInvalidStyle() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT))
-
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponent_doesntShowUntilFirstLocationFix() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
-
- // Source should be present but empty
- val mapView = (rule.activity as EspressoTestActivity).mapView
- assertThat(mapboxMap.queryRenderedFeatures(
- RectF(0f, 0f, mapView.width.toFloat(), mapView.height.toFloat()), FOREGROUND_LAYER)
- .isEmpty(), `is`(true))
-
- // Force the first location update
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- // Check if the puck is visible
- assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- //
- // Location Layer Options
- //
-
- @Test
- fun locationComponentOptions_disablingStaleStateDoesWorkCorrectly() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .staleStateTimeout(200)
- .enableStaleState(false)
- .build())
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
-
- component.isLocationComponentEnabled = true
-
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(300) // waiting for stale state
-
- mapboxMap.querySourceFeatures(LOCATION_SOURCE).also { feature ->
- feature.forEach {
- assertThat(it.getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false))
- }
- }
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponentOptions_loadsForegroundBitmapFromNameOption() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .foregroundName("custom-foreground-bitmap")
- .backgroundName("custom-background-bitmap")
- .foregroundStaleName("custom-foreground-stale-bitmap")
- .backgroundStaleName("custom-background-stale-bitmap")
- .bearingName("custom-bearing-bitmap")
- .build())
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
-
- component.isLocationComponentEnabled = true
-
- val foregroundDrawable = BitmapUtils.getDrawableFromRes(context, R.drawable.ic_media_play)
- foregroundDrawable?.let {
- mapboxMap.addImageFromDrawable("custom-foreground-bitmap", it)
- mapboxMap.addImageFromDrawable("custom-background-bitmap", it)
- mapboxMap.addImageFromDrawable("custom-foreground-stale-bitmap", it)
- mapboxMap.addImageFromDrawable("custom-background-stale-bitmap", it)
- mapboxMap.addImageFromDrawable("custom-bearing-bitmap", it)
- }
-
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- val feature = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0]
-
- assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(false))
- assertThat(feature.getStringProperty(PROPERTY_FOREGROUND_ICON), `is`(equalTo("custom-foreground-bitmap")))
- assertThat(feature.getStringProperty(PROPERTY_BACKGROUND_ICON), `is`(equalTo("custom-background-bitmap")))
- assertThat(feature.getStringProperty(PROPERTY_FOREGROUND_STALE_ICON), `is`(equalTo("custom-foreground-stale-bitmap")))
- assertThat(feature.getStringProperty(PROPERTY_BACKGROUND_STALE_ICON), `is`(equalTo("custom-background-stale-bitmap")))
- assertThat(feature.getStringProperty(PROPERTY_BEARING_ICON), `is`(equalTo("custom-bearing-bitmap")))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponentOptions_loadsGpsNameWithGpsRenderMode() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .foregroundName("custom-foreground-bitmap")
- .gpsName("custom-gps-bitmap")
- .build())
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
-
- component.isLocationComponentEnabled = true
-
- component.renderMode = RenderMode.GPS
- component.forceLocationUpdate(location)
- val foregroundDrawable = BitmapUtils.getDrawableFromRes(context, R.drawable.ic_media_play)
- foregroundDrawable?.let {
- mapboxMap.addImageFromDrawable("custom-foreground-bitmap", it)
- mapboxMap.addImageFromDrawable("custom-gps-bitmap", it)
- }
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)
-
- assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap")))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponentOptions_customIconNameRevertsToDefault() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .foregroundName("custom-foreground-bitmap")
- .gpsName("custom-gps-bitmap")
- .build())
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
- component.isLocationComponentEnabled = true
-
- component.renderMode = RenderMode.GPS
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)
- assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap")))
-
- component.applyStyle(LocationComponentOptions.builder(context).build())
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(FOREGROUND_ICON, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponentOptions_customGpsIconNameChangeBackWithMode() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .gpsName("custom-gps-bitmap")
- .build())
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
- component.isLocationComponentEnabled = true
-
- component.renderMode = RenderMode.GPS
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)
- assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap")))
-
- component.renderMode = RenderMode.NORMAL
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(FOREGROUND_ICON, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun stillStaleAfterResuming() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .staleStateTimeout(200)
- .build())
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
-
- component.isLocationComponentEnabled = true
-
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(250) // engaging stale state
-
- assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true))
-
- component.onStop()
- component.onStart()
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(false))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun stillNotStaleAfterResuming() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
-
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false))
-
- component.onStop()
- component.onStart()
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun locationComponentOptions_accuracyRingWithColor() {
- validateTestSetup()
- val color = Color.parseColor("#4A90E2")
- val rgbaColor = ColorUtils.colorToRgbaString(color)
-
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .locationComponentOptions(
- LocationComponentOptions.builder(context)
- .accuracyColor(color)
- .build())
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
-
- component.isLocationComponentEnabled = true
-
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- mapboxMap.querySourceFeatures(LOCATION_SOURCE).also { feature ->
- feature.forEach {
- assertThat(it.getStringProperty(PROPERTY_ACCURACY_COLOR), `is`(equalTo(rgbaColor)))
- }
- }
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun forceLocationUpdate_doesMoveLocationLayerIconToCorrectPosition() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
-
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point
- assertThat(component.locationEngine, nullValue())
- assertEquals(point.latitude(), location.latitude, 0.1)
- assertEquals(point.longitude(), location.longitude, 0.1)
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun disablingComponentHidesPuck() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- val point: Point = mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER)[0].geometry() as Point
- assertEquals(point.latitude(), location.latitude, 0.1)
- assertEquals(point.longitude(), location.longitude, 0.1)
-
- component.isLocationComponentEnabled = false
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun disablingComponentAndChangingStyleAllowsToEnableAgain() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- component.isLocationComponentEnabled = false
- mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT))
- component.isLocationComponentEnabled = true
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_isDisabledOnStart() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.onStop()
- component.onStart()
-
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
-
- assertThat(component.isLocationComponentEnabled, `is`(false))
- component.onStop()
- component.onStart()
- assertThat(component.isLocationComponentEnabled, `is`(false))
-
- component.isLocationComponentEnabled = true
- assertThat(component.isLocationComponentEnabled, `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_keepsEnabledWhenStoppedAndStarted() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
-
- component.isLocationComponentEnabled = true
- assertThat(component.isLocationComponentEnabled, `is`(true))
- component.onStop()
- component.onStart()
- assertThat(component.isLocationComponentEnabled, `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_keepsDisabledWhenStoppedAndStarted() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.isLocationComponentEnabled = false
- assertThat(component.isLocationComponentEnabled, `is`(false))
- component.onStop()
- component.onStart()
- assertThat(component.isLocationComponentEnabled, `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_ableToChangeStyleAfterResuming() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
-
- component.onStop()
- component.onStart()
-
- mapboxMap.setStyle(Style.Builder().fromUrl(Style.DARK))
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_interruptedDuringStyleChange() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- mapboxMap.setStyle(Style.Builder().fromUrl(Style.DARK))
- component.onStop()
- component.onStart()
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_forceLocationUpdateAfterStopped() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.onStop()
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE).isEmpty(), `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_acceptAndReuseLocationUpdatesBeforeLayerStarted() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.onStop()
- component.forceLocationUpdate(location)
- component.onStart()
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point
- assertEquals(point.latitude(), location.latitude, 0.1)
- assertEquals(point.longitude(), location.longitude, 0.1)
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun lifecycle_lifecycleChangeRightAfterStyleReload() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT))
- component.onStop()
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- component.onStart()
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point
- assertEquals(point.latitude(), location.latitude, 0.1)
- assertEquals(point.longitude(), location.longitude, 0.1)
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun mapChange_settingComponentStyle() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
- val options = LocationComponentOptions.builder(context)
- .accuracyColor(Color.RED)
- .build()
-
- pushSourceUpdates(styleChangeIdlingResource) {
- component.applyStyle(options)
- }
-
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- }
- }
- executeComponentTest(componentAction)
-
- // Waiting for style to finish loading while pushing updates
- onView(withId(R.id.content)).check(matches(isDisplayed()))
- }
-
- @Test
- fun mapChange_forcingLocation() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
-
- pushSourceUpdates(styleChangeIdlingResource) {
- component.forceLocationUpdate(location)
- }
-
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- }
- }
- executeComponentTest(componentAction)
-
- // Waiting for style to finish loading while pushing updates
- onView(withId(R.id.content)).check(matches(isDisplayed()))
- }
-
- @Test
- fun mapChange_settingMapStyleBeforeComponentCreation() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- locationComponentActivationOptions = LocationComponentActivationOptions
- .builder(context, mapboxMap.style!!)
- .useDefaultLocationEngine(false)
- .build()
- component.activateLocationComponent(locationComponentActivationOptions)
- component.isLocationComponentEnabled = true
-
- val options = LocationComponentOptions.builder(context)
- .accuracyColor(Color.RED)
- .build()
-
- pushSourceUpdates(styleChangeIdlingResource) {
- component.forceLocationUpdate(location)
- component.applyStyle(options)
- }
- }
- }
- executeComponentTest(componentAction)
-
- // Waiting for style to finish loading while pushing updates
- onView(withId(R.id.content)).check(matches(isDisplayed()))
- }
-
- @Test
- fun animators_layerBearingCorrect() {
- validateTestSetup()
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.renderMode = RenderMode.GPS
- location.bearing = 77f
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS)
- assertEquals(77f, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_GPS_BEARING).toFloat(), 0.1f)
-
- location.bearing = 92f
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) // Waiting for the animation to finish
- assertEquals(92.0f, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_GPS_BEARING).toFloat(), 0.1f)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_cameraLatLngBearingCorrect() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING_GPS
- location.bearing = 77f
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS)
-
- assertEquals(77.0, mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(location.latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(location.longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
-
- location.bearing = 92f
- location.latitude = 30.0
- location.longitude = 35.0
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) // Waiting for the animation to finish
-
- assertEquals(92.0, mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(location.latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(location.longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_cameraBearingCorrect() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.NONE_GPS
- val latitude = mapboxMap.cameraPosition.target.latitude
- val longitude = mapboxMap.cameraPosition.target.longitude
-
- location.bearing = 77f
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS)
-
- assertEquals(77.0, mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
-
- location.bearing = 92f
- location.latitude = 30.0
- location.longitude = 35.0
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS)
-
- assertEquals(92.0, mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_cameraNoneCorrect() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.NONE
- val latitude = mapboxMap.cameraPosition.target.latitude
- val longitude = mapboxMap.cameraPosition.target.longitude
- val bearing = mapboxMap.cameraPosition.bearing
-
- location.bearing = 77f
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS)
-
- assertEquals(bearing, mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
-
- location.bearing = 92f
- location.latitude = 30.0
- location.longitude = 35.0
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS)
-
- assertEquals(bearing, mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_focalPointAdjustment() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- component.cameraMode = CameraMode.NONE
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.uiSettings.focalPoint, nullValue())
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_dontZoomWhileNotTracking() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.NONE
- val zoom = mapboxMap.cameraPosition.zoom
- component.zoomWhileTracking(10.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(zoom, mapboxMap.cameraPosition.zoom, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_zoomWhileTracking() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- component.zoomWhileTracking(10.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(10.0, mapboxMap.cameraPosition.zoom, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- @Ignore
- fun animators_zoomWhileTrackingCanceledOnModeChange() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- component.zoomWhileTracking(15.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2)
- component.cameraMode = CameraMode.NONE
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(15.0 / 2.0, mapboxMap.cameraPosition.zoom, 3.0)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_dontZoomWhileStopped() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
-
- component.cameraMode = CameraMode.TRACKING
- val zoom = mapboxMap.cameraPosition.zoom
-
- component.onStop()
- component.zoomWhileTracking(10.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(zoom, mapboxMap.cameraPosition.zoom, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_dontZoomWhileTransitioning() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
-
- val zoom = mapboxMap.cameraPosition.zoom
- component.setCameraMode(CameraMode.TRACKING_GPS, 500L, null, null, null, null)
- component.zoomWhileTracking(16.0, 1000)
- uiController.loopMainThreadForAtLeast(1000)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(zoom, mapboxMap.cameraPosition.zoom, 0.0001)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- @Ignore
- fun animators_cancelZoomWhileTracking() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- component.zoomWhileTracking(15.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2)
- component.cancelZoomWhileTrackingAnimation()
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(15.0 / 2.0, mapboxMap.cameraPosition.zoom, 3.0)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_dontTiltWhileNotTracking() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.NONE
- val tilt = mapboxMap.cameraPosition.tilt
- component.tiltWhileTracking(30.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(tilt, mapboxMap.cameraPosition.tilt, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_tiltWhileTracking() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- component.tiltWhileTracking(30.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(30.0, mapboxMap.cameraPosition.tilt, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- @Ignore
- fun animators_tiltWhileTrackingCanceledOnModeChange() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- component.tiltWhileTracking(30.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION / 2)
- component.cameraMode = CameraMode.NONE
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION / 2)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(30.0 / 2.0, mapboxMap.cameraPosition.tilt, 3.0)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_dontTiltWhileStopped() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- val tilt = mapboxMap.cameraPosition.tilt
-
- component.onStop()
- component.tiltWhileTracking(30.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(tilt, mapboxMap.cameraPosition.tilt, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun animators_dontTiltWhileTransitioning() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
-
- val tilt = mapboxMap.cameraPosition.tilt
- component.setCameraMode(CameraMode.TRACKING_GPS, 500L, null, null, null, null)
- component.tiltWhileTracking(30.0, 1000)
- uiController.loopMainThreadForAtLeast(1000)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertEquals(tilt, mapboxMap.cameraPosition.tilt, 0.0001)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- @Ignore
- fun animators_cancelTiltWhileTracking() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING
- component.tiltWhileTracking(30.0)
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION / 2)
- component.cancelTiltWhileTrackingAnimation()
- uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION / 2)
-
- assertEquals(30.0 / 2.0, mapboxMap.cameraPosition.tilt, 3.0)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun cameraPositionAdjustedToTrackingModeWhenComponentEnabled() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.TRACKING_GPS
- component.forceLocationUpdate(location)
- component.isLocationComponentEnabled = false
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(LatLng(51.0, 17.0)))
- mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(90.0))
- component.isLocationComponentEnabled = true
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS)
-
- assertEquals(location.bearing.toDouble(), mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(location.latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(location.longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun cameraPositionSnappedToTargetIfExceedsThreshold() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- component.cameraMode = CameraMode.NONE
- component.forceLocationUpdate(location)
-
- val target = LatLng(51.0, 17.0)
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(target))
- mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(15.0))
- mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(90.0))
- assertTrue(Utils.immediateAnimation(mapboxMap.projection, mapboxMap.cameraPosition.target, LatLng(location)))
-
- component.cameraMode = CameraMode.TRACKING_GPS
- assertEquals(location.bearing.toDouble(), mapboxMap.cameraPosition.bearing, 0.1)
- assertEquals(location.latitude, mapboxMap.cameraPosition.target.latitude, 0.1)
- assertEquals(location.longitude, mapboxMap.cameraPosition.target.longitude, 0.1)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun compassEngine_onComponentInitializedDefaultIsProvided() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- assertTrue(component.compassEngine is LocationComponentCompassEngine)
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @Test
- fun compassEngine_changesWhenNewProvided() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build())
- component.isLocationComponentEnabled = true
- val engine: CompassEngine = object : CompassEngine {
- override fun addCompassListener(compassListener: CompassListener) {
- }
-
- override fun removeCompassListener(compassListener: CompassListener) {
- }
-
- override fun getLastHeading(): Float {
- return 0f
- }
-
- override fun getLastAccuracySensorStatus(): Int {
- return 0
- }
- }
-
- component.compassEngine = engine
- assertThat(component.compassEngine, notNullValue())
- assertThat(component.compassEngine, `is`(equalTo(engine)))
- }
- }
-
- executeComponentTest(componentAction)
- }
-
- @After
- override fun afterTest() {
- super.afterTest()
- IdlingRegistry.getInstance().unregister(styleChangeIdlingResource)
- }
-
- private fun executeComponentTest(listener: LocationComponentAction.OnPerformLocationComponentAction) {
- onView(withId(R.id.content)).perform(LocationComponentAction(mapboxMap, listener))
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt
deleted file mode 100644
index ab70f188c3..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt
+++ /dev/null
@@ -1,609 +0,0 @@
-package com.mapbox.mapboxsdk.location
-
-import android.Manifest
-import android.content.Context
-import android.location.Location
-import android.support.test.annotation.UiThreadTest
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.IdlingRegistry
-import android.support.test.espresso.UiController
-import android.support.test.espresso.assertion.ViewAssertions.matches
-import android.support.test.espresso.matcher.ViewMatchers.isDisplayed
-import android.support.test.espresso.matcher.ViewMatchers.withId
-import android.support.test.rule.GrantPermissionRule
-import android.support.test.rule.GrantPermissionRule.grant
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.location.LocationComponentConstants.*
-import com.mapbox.mapboxsdk.location.modes.RenderMode
-import com.mapbox.mapboxsdk.location.utils.*
-import com.mapbox.mapboxsdk.location.utils.MapboxTestingUtils.Companion.MAPBOX_HEAVY_STYLE
-import com.mapbox.mapboxsdk.location.utils.MapboxTestingUtils.Companion.pushSourceUpdates
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
-import com.mapbox.mapboxsdk.testapp.R
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
-import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils
-import com.mapbox.mapboxsdk.utils.BitmapUtils
-import kotlin.math.abs
-import org.hamcrest.CoreMatchers.`is`
-import org.hamcrest.CoreMatchers.notNullValue
-import org.hamcrest.Matchers.equalTo
-import org.junit.After
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertThat
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class LocationLayerControllerTest : EspressoTest() {
-
- @Rule
- @JvmField
- val permissionRule: GrantPermissionRule = grant(Manifest.permission.ACCESS_FINE_LOCATION)
-
- private lateinit var styleChangeIdlingResource: StyleChangeIdlingResource
- private val location: Location by lazy {
- val initLocation = Location("")
- initLocation.latitude = 15.0
- initLocation.longitude = 17.0
- initLocation.bearing = 10f
- initLocation.accuracy = 150f
- initLocation
- }
-
- @Before
- override fun beforeTest() {
- super.beforeTest()
- styleChangeIdlingResource = StyleChangeIdlingResource()
- IdlingRegistry.getInstance().register(styleChangeIdlingResource)
- }
-
- //
- // Location Source
- //
-
- @Test
- fun renderModeNormal_sourceDoesGetAdded() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.renderMode = RenderMode.NORMAL
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(style.getSource(LOCATION_SOURCE), notNullValue())
- }
- }
- executeComponentTest(componentAction)
- }
-
- //
- // Location Layers
- //
-
- @Test
- fun renderModeNormal_trackingNormalLayersDoGetAdded() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.renderMode = RenderMode.NORMAL
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun renderModeCompass_bearingLayersDoGetAdded() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.renderMode = RenderMode.COMPASS
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun renderModeGps_navigationLayersDoGetAdded() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.renderMode = RenderMode.GPS
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun dontShowPuckWhenRenderModeSetAndComponentDisabled() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- component.isLocationComponentEnabled = false
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- component.renderMode = RenderMode.GPS
-
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun whenLocationComponentDisabled_doesSetAllLayersToVisibilityNone() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.renderMode = RenderMode.NORMAL
- component.forceLocationUpdate(location)
- component.isLocationComponentEnabled = false
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- // Check that all layers visibilities are set to none
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(false))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun onMapChange_locationComponentLayersDoGetRedrawn() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.renderMode = RenderMode.NORMAL
- component.forceLocationUpdate(location)
- styleChangeIdlingResource.waitForStyle(mapboxMap, Style.LIGHT)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(component.renderMode, `is`(equalTo(RenderMode.NORMAL)))
-
- // Check that the Source has been re-added to the new map style
- val source: GeoJsonSource? = mapboxMap.style!!.getSourceAs(LOCATION_SOURCE)
- assertThat(source, notNullValue())
-
- // Check that all layers visibilities are set to visible
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun whenStyleChanged_continuesUsingStaleIcons() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.applyStyle(LocationComponentOptions.builder(context).staleStateTimeout(100).build())
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(150)
-
- assertThat(
- mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE),
- `is`(true)
- )
-
- mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT))
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(
- mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE),
- `is`(true)
- )
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun whenStyleChanged_isDisabled_hasLayerBelow_staysHidden() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- component.isLocationComponentEnabled = false
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(true))
-
- val options = component.locationComponentOptions
- .toBuilder()
- .layerBelow("road-label")
- .build()
-
- component.applyStyle(options)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(true))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun whenStyleChanged_staleStateChanges() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.applyStyle(LocationComponentOptions.builder(context).staleStateTimeout(1).build())
- styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
- pushSourceUpdates(styleChangeIdlingResource) {
- component.forceLocationUpdate(location)
- }
- }
- }
- executeComponentTest(componentAction)
-
- // Waiting for style to finish loading while pushing updates
- onView(withId(android.R.id.content)).check(matches(isDisplayed()))
- }
-
- @Test
- fun whenStyleChanged_layerVisibilityUpdates() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
- uiController.loopMainThreadForAtLeast(100)
- var show = true
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, mapboxMap.style!!)
- .useDefaultLocationEngine(false)
- .build()
- )
- pushSourceUpdates(styleChangeIdlingResource) {
- component.isLocationComponentEnabled = show
- show = !show
- }
-
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- }
- }
- executeComponentTest(componentAction)
-
- // Waiting for style to finish loading while pushing updates
- onView(withId(android.R.id.content)).check(matches(isDisplayed()))
- }
-
- @Test
- fun accuracy_visibleWithNewLocation() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(location), 16.0))
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- uiController.loopMainThreadForAtLeast(ACCURACY_RADIUS_ANIMATION_DURATION)
-
- assertEquals(
- Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/,
- mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0]
- .getNumberProperty(PROPERTY_ACCURACY_RADIUS).toFloat(), 0.1f
- )
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun accuracy_visibleWhenCameraEased() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
-
- val target = LatLng(location)
- val zoom = 16.0
- mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(target, zoom), 300)
- uiController.loopMainThreadForAtLeast(300)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(
- Math.abs(zoom - mapboxMap.cameraPosition.zoom) < 0.1 &&
- Math.abs(target.latitude - mapboxMap.cameraPosition.target.latitude) < 0.1 &&
- Math.abs(target.longitude - mapboxMap.cameraPosition.target.longitude) < 0.1,
- `is`(true)
- )
-
- val expectedRadius =
- Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/
- assertThat(
- Math.abs(
- expectedRadius - mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(
- PROPERTY_ACCURACY_RADIUS
- ).toFloat()
- ) < 0.1,
- `is`(true)
- )
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun accuracy_visibleWhenCameraMoved() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
-
- val target = LatLng(location)
- val zoom = 16.0
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(target, zoom))
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- assertThat(
- abs(zoom - mapboxMap.cameraPosition.zoom) < 0.1 &&
- abs(target.latitude - mapboxMap.cameraPosition.target.latitude) < 0.1 &&
- abs(target.longitude - mapboxMap.cameraPosition.target.longitude) < 0.1,
- `is`(true)
- )
-
- val expectedRadius =
- Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/
- assertThat(
- Math.abs(
- expectedRadius - mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(
- PROPERTY_ACCURACY_RADIUS
- ).toFloat()
- ) < 0.1,
- `is`(true)
- )
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- fun applyStyle_layerBelow_restoreLayerVisibility() {
- val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(
- component: LocationComponent,
- mapboxMap: MapboxMap,
- style: Style,
- uiController: UiController,
- context: Context
- ) {
- component.activateLocationComponent(
- LocationComponentActivationOptions
- .builder(context, style)
- .useDefaultLocationEngine(false)
- .build()
- )
- component.isLocationComponentEnabled = true
- component.forceLocationUpdate(location)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
-
- component.applyStyle(LocationComponentOptions.builder(context).layerBelow("road-label").build())
-
- assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true))
- assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false))
- }
- }
- executeComponentTest(componentAction)
- }
-
- @Test
- @UiThreadTest
- fun test_15026_missingShadowGradientRadius() {
- // test for https://github.com/mapbox/mapbox-gl-native/issues/15026
- val shadowDrawable = BitmapUtils.getDrawableFromRes(context, R.drawable.mapbox_user_icon_shadow_0px_test)
- Utils.generateShadow(shadowDrawable, 0f)
- }
-
- @After
- override fun afterTest() {
- super.afterTest()
- IdlingRegistry.getInstance().unregister(styleChangeIdlingResource)
- }
-
- private fun executeComponentTest(listener: LocationComponentAction.OnPerformLocationComponentAction) {
- onView(withId(android.R.id.content)).perform(LocationComponentAction(mapboxMap, listener))
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt
deleted file mode 100644
index 3cb9e51bf7..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.mapbox.mapboxsdk.location.utils
-
-import android.content.Context
-import android.support.test.espresso.UiController
-import android.support.test.espresso.ViewAction
-import android.support.test.espresso.matcher.ViewMatchers.isDisplayed
-import android.view.View
-import com.mapbox.mapboxsdk.location.LocationComponent
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.Style
-import org.hamcrest.Matcher
-
-class LocationComponentAction(
- private val mapboxMap: MapboxMap,
- private val onPerformLocationComponentAction: OnPerformLocationComponentAction
-) : ViewAction {
-
- override fun getConstraints(): Matcher<View> {
- return isDisplayed()
- }
-
- override fun getDescription(): String {
- return javaClass.simpleName
- }
-
- override fun perform(uiController: UiController, view: View) {
- onPerformLocationComponentAction.onLocationComponentAction(
- mapboxMap.locationComponent,
- mapboxMap,
- mapboxMap.style!!,
- uiController,
- view.context)
- }
-
- interface OnPerformLocationComponentAction {
- fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap, style: Style, uiController: UiController, context: Context)
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt
deleted file mode 100644
index 18da6d1d10..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.mapbox.mapboxsdk.location.utils
-
-import android.graphics.Bitmap
-import android.graphics.Canvas
-import android.graphics.drawable.BitmapDrawable
-import android.graphics.drawable.Drawable
-import android.location.Location
-import android.os.Handler
-import android.os.Looper
-import com.mapbox.geojson.Feature
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.style.layers.Property
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
-
-fun MapboxMap.querySourceFeatures(sourceId: String): List<Feature> {
- return this.style!!.getSourceAs<GeoJsonSource>(sourceId)?.querySourceFeatures(null) ?: emptyList()
-}
-
-fun MapboxMap.queryRenderedFeatures(location: Location, layerId: String): List<Feature> {
- val latLng = LatLng(location.latitude, location.longitude)
- val point = this.projection.toScreenLocation(latLng)
- return this.queryRenderedFeatures(point, layerId)
-}
-
-fun MapboxMap.isLayerVisible(layerId: String): Boolean {
- return this.style!!.getLayer(layerId)?.visibility?.value?.equals(Property.VISIBLE)!!
-}
-
-class MapboxTestingUtils {
- companion object {
-
- /**
- * Used to increase style load time for stress testing.
- */
- const val MAPBOX_HEAVY_STYLE = "asset://heavy_style.json"
-
- private const val DATA_PUSH_INTERVAL = 1L
-
- /**
- * Pushes data updates every [DATA_PUSH_INTERVAL] milliseconds until the style has been loaded,
- * checked with [StyleChangeIdlingResource].
- */
- fun pushSourceUpdates(styleChangeIdlingResource: StyleChangeIdlingResource, update: () -> Unit) {
- val mainHandler = Handler(Looper.getMainLooper())
- val runnable = object : Runnable {
- override fun run() {
- update.invoke()
- if (!styleChangeIdlingResource.isIdleNow) {
- mainHandler.postDelayed(this, DATA_PUSH_INTERVAL)
- }
- }
- }
-
- if (!styleChangeIdlingResource.isIdleNow) {
- if (Looper.myLooper() == Looper.getMainLooper()) {
- runnable.run()
- } else {
- mainHandler.post(runnable)
- }
- }
- }
- }
-}
-
-fun MapboxMap.addImageFromDrawable(string: String, drawable: Drawable) {
- val bitmapFromDrawable = getBitmapFromDrawable(drawable)
- this.style!!.addImage(string, bitmapFromDrawable)
-}
-
-private fun getBitmapFromDrawable(drawable: Drawable): Bitmap {
- if (drawable is BitmapDrawable) return drawable.bitmap
- val bitmap = Bitmap.createBitmap(drawable.intrinsicWidth,
- drawable.intrinsicHeight, Bitmap.Config.ARGB_8888)
- val canvas = Canvas(bitmap)
- drawable.setBounds(0, 0, canvas.width, canvas.height)
- drawable.draw(canvas)
- return bitmap
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt
deleted file mode 100644
index 050535f6df..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.mapbox.mapboxsdk.location.utils
-
-import android.support.test.espresso.IdlingResource
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.Style
-
-/**
- * Resource, that's idling until the provided style is loaded.
- * Remember to add any espresso action (like view assertion) after the [waitForStyle] call
- * for the test to keep running.
- */
-class StyleChangeIdlingResource : IdlingResource {
-
- private var callback: IdlingResource.ResourceCallback? = null
- private var isIdle = true
-
- override fun getName(): String {
- return javaClass.simpleName
- }
-
- override fun isIdleNow(): Boolean {
- return isIdle
- }
-
- override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {
- this.callback = callback
- }
-
- private fun setIdle() {
- isIdle = true
- callback?.onTransitionToIdle()
- }
-
- fun waitForStyle(mapboxMap: MapboxMap, styleUrl: String) {
- isIdle = false
- mapboxMap.setStyle(Style.Builder().fromUrl(styleUrl)) {
- setIdle()
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt
deleted file mode 100644
index 27c040fbb6..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mapbox.mapboxsdk.maps
-
-import android.support.test.InstrumentationRegistry
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.style.layers.Layer
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-abstract class BaseLayerTest : AppCenter() {
- private lateinit var nativeMapView: NativeMap
-
- companion object {
- const val WIDTH = 500
- const val HEIGHT = WIDTH
- }
-
- fun before() {
- val context = InstrumentationRegistry.getContext()
- nativeMapView = NativeMapView(context, false, null, null, NativeMapViewTest.DummyRenderer(context))
- nativeMapView.resizeView(WIDTH, HEIGHT)
- }
-
- fun setupLayer(layer: Layer) {
- nativeMapView.addLayer(layer)
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt
deleted file mode 100644
index f3af386457..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt
+++ /dev/null
@@ -1,516 +0,0 @@
-package com.mapbox.mapboxsdk.maps
-
-import android.graphics.PointF
-import android.os.SystemClock
-import android.support.test.espresso.Espresso
-import android.support.test.espresso.InjectEventSecurityException
-import android.support.test.espresso.UiController
-import android.support.test.espresso.ViewAction
-import android.support.test.espresso.matcher.ViewMatchers
-import android.view.MotionEvent
-import android.view.View
-import org.hamcrest.Matcher
-
-object GesturesUiTestUtils {
-
- private const val DEFAULT_GESTURE_DURATION = 500L
-
- fun pinch(
- startSpan: Float,
- endSpan: Float,
- center: PointF? = null,
- duration: Long = DEFAULT_GESTURE_DURATION
- ): ViewAction {
- return object : ViewAction {
- override fun getConstraints(): Matcher<View> {
- return ViewMatchers.isEnabled()
- }
-
- override fun getDescription(): String = "Pinch $startSpan -> $endSpan"
-
- override fun perform(uiController: UiController, view: View) {
- var middlePosition = center
- if (middlePosition == null) {
- middlePosition = getCenterPointF(view)
- }
-
- val startPoint1 = PointF(middlePosition.x - startSpan / 2f, middlePosition.y)
- val startPoint2 = PointF(middlePosition.x + startSpan / 2f, middlePosition.y)
- val endPoint1 = PointF(middlePosition.x - endSpan / 2f, middlePosition.y)
- val endPoint2 = PointF(middlePosition.x + endSpan / 2f, middlePosition.y)
-
- performPinch(uiController, startPoint1, startPoint2, endPoint1, endPoint2, duration)
- }
- }
- }
-
- fun quickScale(
- deltaY: Float,
- startPoint: PointF? = null,
- withVelocity: Boolean = true,
- duration: Long = DEFAULT_GESTURE_DURATION,
- interrupt: Boolean = false
- ): ViewAction {
- return object : ViewAction {
- override fun getConstraints(): Matcher<View> = ViewMatchers.isEnabled()
-
- override fun getDescription(): String = "quick scale ${deltaY}Y"
-
- override fun perform(uiController: UiController, view: View) {
- var middlePosition = startPoint
- if (middlePosition == null) {
- middlePosition = getCenterPointF(view)
- }
-
- val endPoint = PointF(middlePosition.x, middlePosition.y + deltaY)
-
- performQuickScale(uiController, middlePosition, endPoint, withVelocity, duration, interrupt)
- }
- }
- }
-
- fun move(
- deltaX: Float,
- deltaY: Float,
- startPoint: PointF? = null,
- withVelocity: Boolean = true,
- duration: Long = DEFAULT_GESTURE_DURATION
- ): ViewAction {
- return object : ViewAction {
- override fun getConstraints(): Matcher<View> = ViewMatchers.isEnabled()
-
- override fun getDescription(): String = "move ${deltaX}X, ${deltaY}Y"
-
- override fun perform(uiController: UiController, view: View) {
- var middlePosition = startPoint
- if (middlePosition == null) {
- middlePosition = getCenterPointF(view)
- }
-
- val endPoint = PointF(middlePosition.x + deltaX, middlePosition.y + deltaY)
-
- performMove(uiController, middlePosition, endPoint, withVelocity, duration)
- }
- }
- }
-
- private fun getCenterPointF(view: View): PointF {
- val locationOnScreen = IntArray(2)
- view.getLocationOnScreen(locationOnScreen)
- val viewHeight = view.height * view.scaleY
- val viewWidth = view.width * view.scaleX
- return PointF(
- (locationOnScreen[0] + viewWidth / 2).toInt().toFloat(),
- (locationOnScreen[1] + viewHeight / 2).toInt().toFloat()
- )
- }
-
- // https://stackoverflow.com/a/46443628/9126211
- private fun performPinch(
- uiController: UiController,
- startPoint1: PointF,
- startPoint2: PointF,
- endPoint1: PointF,
- endPoint2: PointF,
- duration: Long
- ) {
- val eventMinInterval: Long = 10
- val startTime = SystemClock.uptimeMillis()
- var eventTime = startTime
- var event: MotionEvent
- var eventX1: Float = startPoint1.x
- var eventY1: Float = startPoint1.y
- var eventX2: Float = startPoint2.x
- var eventY2: Float = startPoint2.y
-
- // Specify the property for the two touch points
- val properties = arrayOfNulls<MotionEvent.PointerProperties>(2)
- val pp1 = MotionEvent.PointerProperties()
- pp1.id = 0
- pp1.toolType = MotionEvent.TOOL_TYPE_FINGER
- val pp2 = MotionEvent.PointerProperties()
- pp2.id = 1
- pp2.toolType = MotionEvent.TOOL_TYPE_FINGER
-
- properties[0] = pp1
- properties[1] = pp2
-
- // Specify the coordinations of the two touch points
- // NOTE: you MUST set the pressure and size value, or it doesn't work
- val pointerCoords = arrayOfNulls<MotionEvent.PointerCoords>(2)
- val pc1 = MotionEvent.PointerCoords()
- pc1.x = eventX1
- pc1.y = eventY1
- pc1.pressure = 1f
- pc1.size = 1f
- val pc2 = MotionEvent.PointerCoords()
- pc2.x = eventX2
- pc2.y = eventY2
- pc2.pressure = 1f
- pc2.size = 1f
- pointerCoords[0] = pc1
- pointerCoords[1] = pc2
-
- /*
- * Events sequence of zoom gesture:
- *
- * 1. Send ACTION_DOWN event of one start point
- * 2. Send ACTION_POINTER_DOWN of two start points
- * 3. Send ACTION_MOVE of two middle points
- * 4. Repeat step 3 with updated middle points (x,y), until reach the end points
- * 5. Send ACTION_POINTER_UP of two end points
- * 6. Send ACTION_UP of one end point
- */
-
- try {
- // Step 1
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_DOWN, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- // Step 2
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_POINTER_DOWN + (pp2.id shl MotionEvent.ACTION_POINTER_INDEX_SHIFT), 2,
- properties, pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- // Step 3, 4
- val moveEventNumber = duration / eventMinInterval
-
- val stepX1: Float
- val stepY1: Float
- val stepX2: Float
- val stepY2: Float
-
- stepX1 = (endPoint1.x - startPoint1.x) / moveEventNumber
- stepY1 = (endPoint1.y - startPoint1.y) / moveEventNumber
- stepX2 = (endPoint2.x - startPoint2.x) / moveEventNumber
- stepY2 = (endPoint2.y - startPoint2.y) / moveEventNumber
-
- for (i in 0 until moveEventNumber) {
- // Update the move events
- eventTime += eventMinInterval
- eventX1 += stepX1
- eventY1 += stepY1
- eventX2 += stepX2
- eventY2 += stepY2
-
- pc1.x = eventX1
- pc1.y = eventY1
- pc2.x = eventX2
- pc2.y = eventY2
-
- pointerCoords[0] = pc1
- pointerCoords[1] = pc2
-
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_MOVE, 2, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- }
-
- // Step 5
- pc1.x = endPoint1.x
- pc1.y = endPoint1.y
- pc2.x = endPoint2.x
- pc2.y = endPoint2.y
- pointerCoords[0] = pc1
- pointerCoords[1] = pc2
-
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_POINTER_UP + (pp2.id shl MotionEvent.ACTION_POINTER_INDEX_SHIFT), 2, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- // Step 6
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_UP, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- } catch (ex: InjectEventSecurityException) {
- throw RuntimeException("Could not perform pinch", ex)
- }
- }
-
- private fun performQuickScale(
- uiController: UiController,
- startPoint: PointF,
- endPoint: PointF,
- withVelocity: Boolean,
- duration: Long,
- interrupt: Boolean
- ) {
- val eventMinInterval: Long = 10
- val tapDownMinInterval: Long = 40 // ViewConfiguration#DOUBLE_TAP_MIN_TIME = 40
- val startTime = SystemClock.uptimeMillis()
- var eventTime = startTime
- var event: MotionEvent
- var eventX1: Float = startPoint.x
- var eventY1: Float = startPoint.y
-
- var properties = arrayOfNulls<MotionEvent.PointerProperties>(1)
- val pp1 = MotionEvent.PointerProperties()
- pp1.id = 0
- pp1.toolType = MotionEvent.TOOL_TYPE_FINGER
- properties[0] = pp1
-
- var pointerCoords = arrayOfNulls<MotionEvent.PointerCoords>(1)
- val pc1 = MotionEvent.PointerCoords()
- pc1.x = eventX1
- pc1.y = eventY1
- pc1.pressure = 1f
- pc1.size = 1f
- pointerCoords[0] = pc1
-
- /*
- * Events sequence of quick scale gesture:
- *
- * 1. Send ACTION_DOWN
- * 2. Send ACTION_UP
- * 3. Send ACTION_DOWN
- * 4. Send ACTION_MOVE with updated middle points (x,y), until reach the end points
- * 5. Send ACTION_UP of one end point
- */
- try {
- // Step 1
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_DOWN, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- // Step 2
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_UP, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- // Step 3
- eventTime += tapDownMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_DOWN, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- // Step 4
- val moveEventNumber = duration / eventMinInterval
-
- val stepX1: Float
- val stepY1: Float
-
- stepX1 = (endPoint.x - startPoint.x) / moveEventNumber
- stepY1 = (endPoint.y - startPoint.y) / moveEventNumber
-
- var interrupted = false
-
- for (i in 0 until moveEventNumber) {
- // Update the move events
- eventTime += eventMinInterval
- eventX1 += stepX1
- eventY1 += stepY1
-
- pc1.x = eventX1
- pc1.y = eventY1
-
- pointerCoords[0] = pc1
-
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_MOVE, if (interrupted) 2 else 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- if (interrupt && i == moveEventNumber / 2) {
- // Specify the property for the two touch points
- properties = arrayOfNulls<MotionEvent.PointerProperties>(2)
- val pp2 = MotionEvent.PointerProperties()
- pp2.id = 1
- pp2.toolType = MotionEvent.TOOL_TYPE_FINGER
-
- properties[0] = pp1
- properties[1] = pp2
-
- // Specify the coordinations of the two touch points
- // NOTE: you MUST set the pressure and size value, or it doesn't work
- pointerCoords = arrayOfNulls<MotionEvent.PointerCoords>(2)
- val pc2 = MotionEvent.PointerCoords()
- pc2.x = startPoint.x
- pc2.y = startPoint.y
- pc2.pressure = 1f
- pc2.size = 1f
- pointerCoords[0] = pc1
- pointerCoords[1] = pc2
-
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_POINTER_DOWN + (pp2.id shl MotionEvent.ACTION_POINTER_INDEX_SHIFT), 2,
- properties, pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- interrupted = true
- }
- }
-
- if (!withVelocity) {
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_MOVE, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- }
-
- // Step 5
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_UP, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- } catch (ex: InjectEventSecurityException) {
- throw RuntimeException("Could not perform quick scale", ex)
- }
- }
-
- private fun performMove(
- uiController: UiController,
- startPoint: PointF,
- endPoint: PointF,
- withVelocity: Boolean,
- duration: Long
- ) {
- val eventMinInterval: Long = 10
- val startTime = SystemClock.uptimeMillis()
- var eventTime = startTime
- var event: MotionEvent
- var eventX1: Float = startPoint.x
- var eventY1: Float = startPoint.y
-
- val properties = arrayOfNulls<MotionEvent.PointerProperties>(1)
- val pp1 = MotionEvent.PointerProperties()
- pp1.id = 0
- pp1.toolType = MotionEvent.TOOL_TYPE_FINGER
- properties[0] = pp1
-
- val pointerCoords = arrayOfNulls<MotionEvent.PointerCoords>(1)
- val pc1 = MotionEvent.PointerCoords()
- pc1.x = eventX1
- pc1.y = eventY1
- pc1.pressure = 1f
- pc1.size = 1f
- pointerCoords[0] = pc1
-
- /*
- * Events sequence of move gesture:
- *
- * 1. Send ACTION_DOWN
- * 2. Send ACTION_MOVE with updated middle points (x,y), until reach the end points
- * 3. Send ACTION_UP
- */
- try {
- // Step 1
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_DOWN, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
-
- // Step 2
- val moveEventNumber = duration / eventMinInterval
-
- val stepX1: Float
- val stepY1: Float
-
- stepX1 = (endPoint.x - startPoint.x) / moveEventNumber
- stepY1 = (endPoint.y - startPoint.y) / moveEventNumber
-
- for (i in 0 until moveEventNumber) {
- // Update the move events
- eventTime += eventMinInterval
- eventX1 += stepX1
- eventY1 += stepY1
-
- pc1.x = eventX1
- pc1.y = eventY1
-
- pointerCoords[0] = pc1
-
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_MOVE, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- }
-
- if (!withVelocity) {
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_MOVE, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- }
-
- // Step 3
- eventTime += eventMinInterval
- event = MotionEvent.obtain(
- startTime, eventTime,
- MotionEvent.ACTION_UP, 1, properties,
- pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0
- )
- injectMotionEventToUiController(uiController, event)
- } catch (ex: InjectEventSecurityException) {
- throw RuntimeException("Could not perform quick scale", ex)
- }
- }
-
- /**
- * Safely call uiController.injectMotionEvent(event): Detect any error and "convert" it to an
- * IllegalStateException
- */
- @Throws(InjectEventSecurityException::class)
- private fun injectMotionEventToUiController(uiController: UiController, event: MotionEvent) {
- val injectEventSucceeded = uiController.injectMotionEvent(event)
- if (!injectEventSucceeded) {
- throw IllegalStateException("Error performing event $event")
- }
- }
-}
-
-fun Int.loopFor(millis: Long) {
- Espresso.onView(ViewMatchers.withId(this)).perform(object : ViewAction {
- override fun getDescription(): String = "waiting for $millis"
-
- override fun getConstraints(): Matcher<View> = ViewMatchers.isEnabled()
-
- override fun perform(uiController: UiController?, view: View?) {
- uiController?.loopMainThreadForAtLeast(millis)
- }
- })
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java
deleted file mode 100644
index 3e226a7ec5..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.mapbox.mapboxsdk.maps;
-
-import com.mapbox.mapboxsdk.annotations.Icon;
-
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
-
-import timber.log.Timber;
-
-public class IconManagerResolver {
-
- private IconManager iconManager;
-
- public IconManagerResolver(MapboxMap mapboxMap) {
- try {
- Field annotationManagerField = MapboxMap.class.getDeclaredField("annotationManager");
- annotationManagerField.setAccessible(true);
- AnnotationManager annotationManager = (AnnotationManager) annotationManagerField.get(mapboxMap);
-
- Field iconManagerField = AnnotationManager.class.getDeclaredField("iconManager");
- iconManagerField.setAccessible(true);
- iconManager = (IconManager) iconManagerField.get(annotationManager);
- } catch (Exception exception) {
- Timber.e(exception, "Could not create IconManagerResolver, unable to reflect.");
- }
- }
-
- @SuppressWarnings("unchecked")
- public Map<Icon, Integer> getIconMap() {
- try {
- Field field = IconManager.class.getDeclaredField("iconMap");
- field.setAccessible(true);
- return (Map<Icon, Integer>) field.get(iconManager);
- } catch (NoSuchFieldException exception) {
- Timber.e(exception, "Could not getIconMap, unable to reflect.");
- } catch (IllegalAccessException exception) {
- Timber.e(exception, "Could not getIconMap, unable to reflect.");
- }
- return new HashMap<>();
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapGestureDetectorTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapGestureDetectorTest.kt
deleted file mode 100644
index 525c576df4..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapGestureDetectorTest.kt
+++ /dev/null
@@ -1,193 +0,0 @@
-package com.mapbox.mapboxsdk.maps
-
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.matcher.ViewMatchers.withId
-import com.mapbox.mapboxsdk.camera.CameraPosition
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
-import com.mapbox.mapboxsdk.constants.MapboxConstants
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.maps.GesturesUiTestUtils.move
-import com.mapbox.mapboxsdk.maps.GesturesUiTestUtils.quickScale
-import com.mapbox.mapboxsdk.testapp.R
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
-import org.junit.Assert
-import org.junit.Before
-import org.junit.Test
-
-class MapGestureDetectorTest : BaseTest() {
- override fun getActivityClass() = SimpleMapActivity::class.java
-
- private var maxWidth: Int = 0
- private var maxHeight: Int = 0
-
- @Before
- fun setup() {
- maxWidth = mapView.width
- maxHeight = mapView.height
- }
-
- @Test
- fun sanity_quickZoom() {
- validateTestSetup()
- var initialZoom: Double? = null
- rule.runOnUiThread {
- initialZoom = mapboxMap.cameraPosition.zoom
- }
- onView(withId(R.id.mapView)).perform(quickScale(maxHeight / 2f, withVelocity = false))
- rule.runOnUiThread {
- Assert.assertTrue(mapboxMap.cameraPosition.zoom > initialZoom!!)
- }
- }
-
- @Test
- fun quickZoomDisabled_phantomQuickZoom_moveStillEnabled_15091() {
- // regression test for https://github.com/mapbox/mapbox-gl-native/issues/15091
- validateTestSetup()
- var initialCameraPosition: CameraPosition? = null
- rule.runOnUiThread {
- // zoom in so we can move vertically
- mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(4.0))
- initialCameraPosition = mapboxMap.cameraPosition
- mapboxMap.uiSettings.isQuickZoomGesturesEnabled = false
- }
-
- onView(withId(R.id.mapView)).perform(quickScale(maxHeight / 2f))
- rule.runOnUiThread {
- // camera did not move
- Assert.assertEquals(initialCameraPosition!!, mapboxMap.cameraPosition)
- }
-
- // move to expected target
- onView(withId(R.id.mapView)).perform(move(-maxWidth / 2f, -maxHeight / 2f, withVelocity = false))
- rule.runOnUiThread {
- Assert.assertNotEquals(initialCameraPosition!!.target.latitude, mapboxMap.cameraPosition.target.latitude, 1.0)
- Assert.assertNotEquals(initialCameraPosition!!.target.longitude, mapboxMap.cameraPosition.target.longitude, 1.0)
- }
- }
-
- @Test
- fun quickZoom_doNotMove_14227() {
- // test for https://github.com/mapbox/mapbox-gl-native/issues/14227
- validateTestSetup()
- var initialTarget: LatLng? = null
- rule.runOnUiThread {
- initialTarget = mapboxMap.cameraPosition.target
- }
-
- onView(withId(R.id.mapView)).perform(quickScale(maxHeight / 2f))
- rule.runOnUiThread {
- // camera did not move
- Assert.assertEquals(initialTarget!!.latitude, mapboxMap.cameraPosition.target.latitude, 1.0)
- Assert.assertEquals(initialTarget!!.longitude, mapboxMap.cameraPosition.target.longitude, 1.0)
- }
- }
-
- @Test
- fun quickZoom_interrupted_moveStillEnabled_14598() {
- // test for https://github.com/mapbox/mapbox-gl-native/issues/14598
- validateTestSetup()
- onView(withId(R.id.mapView)).perform(quickScale(maxHeight / 2f, interrupt = true))
-
- var initialCameraPosition: CameraPosition? = null
- rule.runOnUiThread {
- // zoom in so we can move vertically
- mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(4.0))
- initialCameraPosition = mapboxMap.cameraPosition
- mapboxMap.uiSettings.isQuickZoomGesturesEnabled = false
- }
-
- // move to expected target
- onView(withId(R.id.mapView)).perform(move(-maxWidth / 2f, -maxHeight / 2f, withVelocity = false))
- rule.runOnUiThread {
- Assert.assertNotEquals(initialCameraPosition!!.target.latitude, mapboxMap.cameraPosition.target.latitude, 1.0)
- Assert.assertNotEquals(initialCameraPosition!!.target.longitude, mapboxMap.cameraPosition.target.longitude, 1.0)
- }
- }
-
- @Test
- fun quickZoom_ignoreDoubleTap() {
- // test for https://github.com/mapbox/mapbox-gl-native/issues/14013
- validateTestSetup()
- var initialZoom: Double? = null
- rule.runOnUiThread {
- mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2.0))
- initialZoom = mapboxMap.cameraPosition.zoom
- }
- onView(withId(R.id.mapView)).perform(quickScale(-(mapboxMap.gesturesManager.standardScaleGestureDetector.spanSinceStartThreshold * 2), withVelocity = false, duration = 1000L))
- R.id.mapView.loopFor(MapboxConstants.ANIMATION_DURATION.toLong())
- rule.runOnUiThread {
- Assert.assertTrue(mapboxMap.cameraPosition.zoom < initialZoom!!)
- }
- }
-
- @Test
- fun doubleTap_minimalMovement() {
- validateTestSetup()
- var initialZoom: Double? = null
- rule.runOnUiThread {
- initialZoom = mapboxMap.cameraPosition.zoom
- }
- onView(withId(R.id.mapView)).perform(quickScale(mapboxMap.gesturesManager.standardScaleGestureDetector.spanSinceStartThreshold / 2, withVelocity = false, duration = 50L))
- R.id.mapView.loopFor(MapboxConstants.ANIMATION_DURATION.toLong())
- rule.runOnUiThread {
- Assert.assertEquals(initialZoom!! + 1, mapboxMap.cameraPosition.zoom, 0.1)
- }
- }
-
- @Test
- fun doubleTap_overMaxThreshold_ignore_14013() {
- // test for https://github.com/mapbox/mapbox-gl-native/issues/14013
- validateTestSetup()
- var initialZoom: Double? = null
- rule.runOnUiThread {
- initialZoom = mapboxMap.cameraPosition.zoom
- mapboxMap.uiSettings.isQuickZoomGesturesEnabled = false
- }
- onView(withId(R.id.mapView)).perform(quickScale(mapboxMap.gesturesManager.standardScaleGestureDetector.spanSinceStartThreshold * 2, withVelocity = false, duration = 50L))
- R.id.mapView.loopFor(MapboxConstants.ANIMATION_DURATION.toLong())
- rule.runOnUiThread {
- Assert.assertEquals(initialZoom!!, mapboxMap.cameraPosition.zoom, 0.01)
- }
- }
-
- @Test
- fun doubleTap_interrupted_moveStillEnabled() {
- validateTestSetup()
-
- rule.runOnUiThread {
- mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(4.0))
- }
-
- onView(withId(R.id.mapView)).perform(quickScale(mapboxMap.gesturesManager.standardScaleGestureDetector.spanSinceStartThreshold / 2, withVelocity = false, duration = 50L, interrupt = true))
-
- var initialCameraPosition: CameraPosition? = null
- rule.runOnUiThread {
- // zoom in so we can move vertically
- mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(4.0))
- initialCameraPosition = mapboxMap.cameraPosition
- mapboxMap.uiSettings.isQuickZoomGesturesEnabled = false
- }
-
- // move to expected target
- onView(withId(R.id.mapView)).perform(move(-maxWidth / 2f, -maxHeight / 2f, withVelocity = false))
- rule.runOnUiThread {
- Assert.assertNotEquals(initialCameraPosition!!.target.latitude, mapboxMap.cameraPosition.target.latitude, 1.0)
- Assert.assertNotEquals(initialCameraPosition!!.target.longitude, mapboxMap.cameraPosition.target.longitude, 1.0)
- }
- }
-
- @Test
- fun quickZoom_roundTripping() {
- validateTestSetup()
- rule.runOnUiThread {
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(51.0, 16.0), 3.0))
- }
- onView(withId(R.id.mapView)).perform(quickScale(300f, withVelocity = false, duration = 750L))
- onView(withId(R.id.mapView)).perform(quickScale(-300f, withVelocity = false, duration = 750L))
-
- rule.runOnUiThread {
- Assert.assertEquals(3.0, mapboxMap.cameraPosition.zoom, 0.0001)
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java
deleted file mode 100644
index 00ec1fe601..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java
+++ /dev/null
@@ -1,477 +0,0 @@
-package com.mapbox.mapboxsdk.maps;
-
-import android.graphics.Color;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.annotations.Polygon;
-import com.mapbox.mapboxsdk.annotations.PolygonOptions;
-import com.mapbox.mapboxsdk.annotations.Polyline;
-import com.mapbox.mapboxsdk.annotations.PolylineOptions;
-import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import org.hamcrest.Matcher;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static junit.framework.TestCase.assertFalse;
-import static junit.framework.TestCase.assertNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * This test is responsible for testing the public API.
- * <p>
- * Methods executed on MapboxMap are called from a ViewAction to ensure correct synchronisation
- * with the application UI-thread.
- * </p>
- * @deprecated remove this file when removing deprecated annotations
- */
-@Deprecated
-public class MapboxMapTest extends EspressoTest {
-
- //
- // InfoWindow
- //
-
- @Test
- public void testConcurrentInfoWindowEnabled() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(true);
- assertTrue("ConcurrentWindows should be true", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows());
- }));
- }
-
- @Test
- public void testConcurrentInfoWindowDisabled() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(false);
- assertFalse("ConcurrentWindows should be false", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows());
- }));
- }
-
- @Test
- public void testInfoWindowAdapter() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MapboxMap.InfoWindowAdapter infoWindowAdapter = marker -> null;
- mapboxMap.setInfoWindowAdapter(infoWindowAdapter);
- assertEquals("InfoWindowAdpter should be the same", infoWindowAdapter, mapboxMap.getInfoWindowAdapter());
- }));
- }
-
- //
- // Annotations
- //
-
- @Test
- public void testAddMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- assertTrue("Marker should be contained", mapboxMap.getMarkers().contains(marker));
- }));
- }
-
- @Test(expected = InvalidMarkerPositionException.class)
- public void testAddMarkerInvalidPosition() {
- new MarkerOptions().getMarker();
- }
-
- @Test
- public void testAddMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().position(new LatLng()).title("a");
- MarkerOptions markerOptions2 = new MarkerOptions().position(new LatLng()).title("b");
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- List<Marker> markers = mapboxMap.addMarkers(markerList);
- assertEquals("Markers size should be 2", 2, mapboxMap.getMarkers().size());
- assertTrue(mapboxMap.getMarkers().contains(markers.get(0)));
- assertTrue(mapboxMap.getMarkers().contains(markers.get(1)));
- }));
- }
-
- @Test
- public void testAddMarkersEmpty() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- mapboxMap.addMarkers(markerList);
- assertEquals("Markers size should be 0", 0, mapboxMap.getMarkers().size());
- }));
- }
-
- @Test
- public void testAddMarkersSingleMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions = new MarkerOptions().title("a").position(new LatLng());
- markerList.add(markerOptions);
- List<Marker> markers = mapboxMap.addMarkers(markerList);
- assertEquals("Markers size should be 1", 1, mapboxMap.getMarkers().size());
- assertTrue(mapboxMap.getMarkers().contains(markers.get(0)));
- }));
- }
-
- @Test
- public void testAddPolygon() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- PolygonOptions polygonOptions = new PolygonOptions().add(new LatLng());
- Polygon polygon = mapboxMap.addPolygon(polygonOptions);
- assertTrue("Polygon should be contained", mapboxMap.getPolygons().contains(polygon));
- }));
- }
-
- @Test
- public void testAddEmptyPolygon() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- PolygonOptions polygonOptions = new PolygonOptions();
- Polygon polygon = mapboxMap.addPolygon(polygonOptions);
- assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygon));
- }));
- }
-
- @Test
- public void testAddPolygons() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<PolygonOptions> polygonList = new ArrayList<>();
- PolygonOptions polygonOptions1 = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng());
- PolygonOptions polygonOptions2 = new PolygonOptions().fillColor(Color.WHITE).add(new LatLng());
- PolygonOptions polygonOptions3 = new PolygonOptions();
- polygonList.add(polygonOptions1);
- polygonList.add(polygonOptions2);
- polygonList.add(polygonOptions3);
- mapboxMap.addPolygons(polygonList);
- assertEquals("Polygons size should be 2", 2, mapboxMap.getPolygons().size());
- assertTrue(mapboxMap.getPolygons().contains(polygonOptions1.getPolygon()));
- assertTrue(mapboxMap.getPolygons().contains(polygonOptions2.getPolygon()));
- assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygonOptions3.getPolygon()));
- }));
- }
-
- @Test
- public void addPolygonsEmpty() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- mapboxMap.addPolygons(new ArrayList<PolygonOptions>());
- assertEquals("Polygons size should be 0", 0, mapboxMap.getPolygons().size());
- }));
- }
-
- @Test
- public void addPolygonsSingle() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<PolygonOptions> polygonList = new ArrayList<>();
- PolygonOptions polygonOptions = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng());
- polygonList.add(polygonOptions);
- mapboxMap.addPolygons(polygonList);
- assertEquals("Polygons size should be 1", 1, mapboxMap.getPolygons().size());
- assertTrue(mapboxMap.getPolygons().contains(polygonOptions.getPolygon()));
- }));
- }
-
- @Test
- public void testAddPolyline() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- PolylineOptions polylineOptions = new PolylineOptions().add(new LatLng());
- Polyline polyline = mapboxMap.addPolyline(polylineOptions);
- assertTrue("Polyline should be contained", mapboxMap.getPolylines().contains(polyline));
- }));
- }
-
- @Test
- public void testAddEmptyPolyline() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- PolylineOptions polylineOptions = new PolylineOptions();
- Polyline polyline = mapboxMap.addPolyline(polylineOptions);
- assertTrue("Polyline should be ignored", !mapboxMap.getPolylines().contains(polyline));
- }));
- }
-
- @Test
- public void testAddPolylines() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<PolylineOptions> polylineList = new ArrayList<>();
- PolylineOptions polygonOptions1 = new PolylineOptions().color(Color.BLACK).add(new LatLng());
- PolylineOptions polygonOptions2 = new PolylineOptions().color(Color.WHITE).add(new LatLng());
- PolylineOptions polygonOptions3 = new PolylineOptions();
- polylineList.add(polygonOptions1);
- polylineList.add(polygonOptions2);
- polylineList.add(polygonOptions3);
- mapboxMap.addPolylines(polylineList);
- assertEquals("Polygons size should be 2", 2, mapboxMap.getPolylines().size());
- assertTrue(mapboxMap.getPolylines().contains(polygonOptions1.getPolyline()));
- assertTrue(mapboxMap.getPolylines().contains(polygonOptions2.getPolyline()));
- assertTrue(
- "Polyline should be ignored", !mapboxMap.getPolylines().contains(polygonOptions3.getPolyline())
- );
- }));
- }
-
- @Test
- public void testAddPolylinesEmpty() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- mapboxMap.addPolylines(new ArrayList<PolylineOptions>());
- assertEquals("Polygons size should be 0", 0, mapboxMap.getPolylines().size());
- }));
- }
-
- @Test
- public void testAddPolylinesSingle() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<PolylineOptions> polylineList = new ArrayList<>();
- PolylineOptions polygonOptions = new PolylineOptions().color(Color.BLACK).add(new LatLng());
- polylineList.add(polygonOptions);
- mapboxMap.addPolylines(polylineList);
- assertEquals("Polygons size should be 1", 1, mapboxMap.getPolylines().size());
- assertTrue(mapboxMap.getPolylines().contains(polygonOptions.getPolyline()));
- }));
- }
-
- @Test
- public void testRemoveMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.removeMarker(marker);
- assertTrue("Markers should be empty", mapboxMap.getMarkers().isEmpty());
- }));
- }
-
- @Test
- public void testRemovePolygon() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- PolygonOptions polygonOptions = new PolygonOptions();
- Polygon polygon = mapboxMap.addPolygon(polygonOptions);
- mapboxMap.removePolygon(polygon);
- assertTrue("Polygons should be empty", mapboxMap.getPolylines().isEmpty());
- }));
- }
-
- @Test
- public void testRemovePolyline() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- PolylineOptions polylineOptions = new PolylineOptions();
- Polyline polyline = mapboxMap.addPolyline(polylineOptions);
- mapboxMap.removePolyline(polyline);
- assertTrue("Polylines should be empty", mapboxMap.getPolylines().isEmpty());
- }));
- }
-
- @Test
- public void testRemoveAnnotation() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.removeAnnotation(marker);
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }));
- }
-
- @Test
- public void testRemoveAnnotationById() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- mapboxMap.addMarker(markerOptions);
- // id will always be 0 in unit tests
- mapboxMap.removeAnnotation(0);
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }));
- }
-
- @Test
- public void testRemoveAnnotations() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng());
- MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng());
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- mapboxMap.addMarkers(markerList);
- mapboxMap.removeAnnotations();
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }));
- }
-
- @Test
- public void testClear() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng());
- MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng());
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- mapboxMap.addMarkers(markerList);
- mapboxMap.clear();
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }));
- }
-
- @Test
- public void testRemoveAnnotationsByList() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng());
- MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng());
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- List<Marker> markers = mapboxMap.addMarkers(markerList);
- Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng()).title("c"));
- mapboxMap.removeAnnotations(markers);
- assertTrue("Annotations should not be empty", mapboxMap.getAnnotations().size() == 1);
- assertTrue("Marker should be contained", mapboxMap.getAnnotations().contains(marker));
- }));
- }
-
- @Test
- public void testGetAnnotationById() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker initialMarker = mapboxMap.addMarker(markerOptions);
- Marker retrievedMarker = (Marker) mapboxMap.getAnnotation(0);
- assertEquals("Markers should match", initialMarker, retrievedMarker);
- }));
- }
-
- @Test
- public void testGetAnnotations() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(
- new MapboxMapAction((uiController, view) ->
- assertNotNull("Annotations should be non null", mapboxMap.getAnnotations()))
- );
- }
-
- @Test
- public void testGetMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(
- new MapboxMapAction((uiController, view) ->
- assertNotNull("Markers should be non null", mapboxMap.getMarkers()))
- );
- }
-
- @Test
- public void testGetPolygons() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) ->
- assertNotNull("Polygons should be non null", mapboxMap.getPolygons()))
- );
- }
-
- @Test
- public void testGetPolylines() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) ->
- assertNotNull("Polylines should be non null", mapboxMap.getPolylines()))
- );
- }
-
- @Test
- public void testGetSelectedMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) ->
- assertNotNull("Selected markers should be non null", mapboxMap.getSelectedMarkers()))
- );
- }
-
- @Test
- public void testSelectMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.selectMarker(marker);
- assertTrue("Marker should be contained", mapboxMap.getSelectedMarkers().contains(marker));
- }));
- }
-
- @Test
- public void testDeselectMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.selectMarker(marker);
- mapboxMap.deselectMarker(marker);
- assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty());
- }));
- }
-
- @Test
- public void testDeselectMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker1 = mapboxMap.addMarker(markerOptions);
- Marker marker2 = mapboxMap.addMarker(markerOptions);
- mapboxMap.selectMarker(marker1);
- mapboxMap.selectMarker(marker2);
- mapboxMap.deselectMarkers();
- assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty());
- }));
- }
-
- public class MapboxMapAction implements ViewAction {
-
- private InvokeViewAction invokeViewAction;
-
- MapboxMapAction(InvokeViewAction invokeViewAction) {
- this.invokeViewAction = invokeViewAction;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- invokeViewAction.onViewAction(uiController, view);
- }
- }
-
- interface InvokeViewAction {
- void onViewAction(UiController uiController, View view);
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java
deleted file mode 100644
index 5b737dd4d2..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.mapbox.mapboxsdk.maps;
-
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.AppCenter;
-import com.mapbox.mapboxsdk.Mapbox;
-import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-
-@RunWith(AndroidJUnit4.class)
-public class MapboxTest extends AppCenter {
-
- private static final String ACCESS_TOKEN = "pk.0000000001";
- private static final String ACCESS_TOKEN_2 = "pk.0000000002";
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private String realToken;
-
- @Before
- public void setup() {
- realToken = Mapbox.getAccessToken();
- }
-
- @Test
- @UiThreadTest
- public void testConnected() {
- assertTrue(Mapbox.isConnected());
-
- // test manual connectivity
- Mapbox.setConnected(true);
- assertTrue(Mapbox.isConnected());
- Mapbox.setConnected(false);
- assertFalse(Mapbox.isConnected());
-
- // reset to Android connectivity
- Mapbox.setConnected(null);
- assertTrue(Mapbox.isConnected());
- }
-
- @Test
- @UiThreadTest
- public void setAccessToken() {
- Mapbox.setAccessToken(ACCESS_TOKEN);
- assertSame(ACCESS_TOKEN, Mapbox.getAccessToken());
- Mapbox.setAccessToken(ACCESS_TOKEN_2);
- assertSame(ACCESS_TOKEN_2, Mapbox.getAccessToken());
- }
-
- @Test
- @UiThreadTest
- public void setInvalidAccessToken() {
- final String invalidAccessToken = "xyz";
- expectedException.expect(MapboxConfigurationException.class);
- expectedException.expectMessage(
- "A valid access token parameter is required when using a Mapbox service."
- + "\nPlease see https://www.mapbox.com/help/create-api-access-token/ to learn how to create one."
- + "\nMore information in this guide https://www.mapbox.com/help/first-steps-android-sdk/#access-tokens."
- + "Currently provided token is: " + invalidAccessToken
- );
-
- Mapbox.setAccessToken(invalidAccessToken);
- assertNull(Mapbox.getTelemetry());
- Mapbox.getSkuToken();
- }
-
- @Test
- @UiThreadTest
- public void setNullAccessToken() {
- expectedException.expect(MapboxConfigurationException.class);
- expectedException.expectMessage(
- "A valid access token parameter is required when using a Mapbox service."
- + "\nPlease see https://www.mapbox.com/help/create-api-access-token/ to learn how to create one."
- + "\nMore information in this guide https://www.mapbox.com/help/first-steps-android-sdk/#access-tokens."
- + "Currently provided token is: " + null
- );
-
- Mapbox.setAccessToken(null);
- assertNull(Mapbox.getTelemetry());
- Mapbox.getSkuToken();
- }
-
- @Test
- @UiThreadTest
- public void setValidAccessToken() {
- final String invalidAccessToken = "xyz";
- Mapbox.setAccessToken(invalidAccessToken);
- Mapbox.setAccessToken(ACCESS_TOKEN);
- assertNotNull(Mapbox.getTelemetry());
- assertNotNull(Mapbox.getSkuToken());
- }
-
- @After
- public void tearDown() {
- Mapbox.setAccessToken(realToken);
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
deleted file mode 100644
index dc313b5f64..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
+++ /dev/null
@@ -1,421 +0,0 @@
-package com.mapbox.mapboxsdk.maps
-
-import android.content.Context
-import android.graphics.PointF
-import android.support.test.InstrumentationRegistry
-import android.support.test.annotation.UiThreadTest
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.camera.CameraPosition
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.geometry.LatLngBounds
-import com.mapbox.mapboxsdk.geometry.ProjectedMeters
-import com.mapbox.mapboxsdk.maps.renderer.MapRenderer
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants
-import junit.framework.Assert.*
-import org.junit.After
-import org.junit.Assert
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class NativeMapViewTest : AppCenter() {
-
- private lateinit var nativeMapView: NativeMap
-
- companion object {
- const val DELTA = 0.000001
- const val DELTA_BIG = 1.0
- const val BEARING_TEST = 60.0
- const val PITCH_TEST = 40.0
- const val ZOOM_TEST = 16.0
- val PADDING_TEST = doubleArrayOf(80.0, 150.0, 0.0, 0.0)
- const val WIDTH = 500
- const val HEIGHT = WIDTH
- val LATLNG_TEST = LatLng(12.0, 34.0)
- }
-
- @Before
- @UiThreadTest
- fun before() {
- val context = InstrumentationRegistry.getContext()
- nativeMapView = NativeMapView(context, 2.0f, false, null, null, DummyRenderer(context))
- nativeMapView.resizeView(WIDTH, HEIGHT)
- }
-
- @After
- @UiThreadTest
- fun after() {
- nativeMapView.destroy()
- }
-
- @Test
- @UiThreadTest
- fun testSetStyleUrl() {
- val expected = Style.DARK
- nativeMapView.styleUri = expected
- val actual = nativeMapView.styleUri
- assertEquals("Style URL should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testSetStyleJson() {
- val expected = "{}"
- nativeMapView.styleJson = expected
- val actual = nativeMapView.styleJson
- assertEquals("Style JSON should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testBearing() {
- val expected = BEARING_TEST
- nativeMapView.setBearing(expected, 0)
- val actual = nativeMapView.bearing
- assertEquals("Bearing should match", expected, actual, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testLatLng() {
- val expected = LATLNG_TEST
- nativeMapView.setLatLng(expected, 0)
- val actual = nativeMapView.latLng
- assertEquals("Latitude should match", expected.latitude, actual.latitude, DELTA)
- assertEquals("Longitude should match", expected.longitude, actual.longitude, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngPadding() {
- val expected = LATLNG_TEST
- nativeMapView.contentPadding = PADDING_TEST
- nativeMapView.setLatLng(expected, 0)
- val actual = nativeMapView.latLng
- assertEquals("Latitude should match", expected.latitude, actual.latitude, DELTA)
- assertEquals("Longitude should match", expected.longitude, actual.longitude, DELTA)
- Assert.assertArrayEquals(PADDING_TEST, nativeMapView.cameraPosition.padding, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngDefault() {
- val expected = LatLng()
- val actual = nativeMapView.latLng
- assertEquals("Latitude should match", expected.latitude, actual.latitude, DELTA)
- assertEquals("Longitude should match", expected.longitude, actual.longitude, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testBearingDefault() {
- val expected = 0.0
- val actual = nativeMapView.bearing
- assertEquals("Bearing should match", expected, actual, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testPitch() {
- val expected = PITCH_TEST
- nativeMapView.setPitch(expected, 0)
- val actual = nativeMapView.pitch
- assertEquals("Pitch should match", expected, actual, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testPitchDefault() {
- val expected = 0.0
- val actual = nativeMapView.pitch
- assertEquals("Pitch should match", expected, actual, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testZoom() {
- val expected = ZOOM_TEST
- nativeMapView.setZoom(expected, PointF(0.0f, 0.0f), 0)
- val actual = nativeMapView.zoom
- assertEquals("Zoom should match", expected, actual, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testZoomDefault() {
- val expected = 0.0
- val actual = nativeMapView.zoom
- assertEquals("Zoom should match", expected, actual, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testJumpTo() {
- val expected = CameraPosition.Builder()
- .bearing(BEARING_TEST)
- .target(LATLNG_TEST)
- .tilt(PITCH_TEST)
- .zoom(ZOOM_TEST)
- .padding(PADDING_TEST)
- .build()
- // verify that the lazily set padding is ignored when a value is provided with the camera
- nativeMapView.contentPadding = doubleArrayOf(1.0, 2.0, 3.0, 4.0)
- nativeMapView.jumpTo(LATLNG_TEST, ZOOM_TEST, PITCH_TEST, BEARING_TEST, PADDING_TEST)
- val actual = nativeMapView.cameraPosition
- assertEquals("Latitude should match", expected.target.latitude, actual.target.latitude, DELTA)
- assertEquals("Longitude should match", expected.target.longitude, actual.target.longitude, DELTA)
- assertEquals("Bearing should match", expected.bearing, actual.bearing, DELTA)
- assertEquals("Pitch should match", expected.tilt, actual.tilt, DELTA)
- assertEquals("Zoom should match", expected.zoom, actual.zoom, DELTA)
- Assert.assertArrayEquals(expected.padding, actual.padding, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngForPixel() {
- val expected = LATLNG_TEST
- nativeMapView.setLatLng(LATLNG_TEST, 0)
- val actual = nativeMapView.latLngForPixel(
- PointF((WIDTH / 2).toFloat(), (HEIGHT / 2).toFloat())
- )
- assertEquals("Latitude should match", expected.latitude, actual.latitude, DELTA_BIG)
- assertEquals("Longitude should match", expected.longitude, actual.longitude, DELTA_BIG)
- }
-
- @Test
- @UiThreadTest
- fun testPixelForLatLng() {
- val expected = PointF((WIDTH / 2).toFloat(), (HEIGHT / 2).toFloat())
- nativeMapView.setLatLng(LATLNG_TEST, 0)
- val actual = nativeMapView.pixelForLatLng(LATLNG_TEST)
- assertEquals("X should match", expected.x.toDouble(), actual.x.toDouble(), DELTA_BIG)
- assertEquals("Y should match", expected.y.toDouble(), actual.y.toDouble(), DELTA_BIG)
- }
-
- @Test
- @UiThreadTest
- fun testPrefetchTilesTrue() {
- val expected = true
- nativeMapView.prefetchTiles = true
- val actual = nativeMapView.prefetchTiles
- assertEquals("Flag should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testPrefetchTilesFalse() {
- val expected = false
- nativeMapView.prefetchTiles = false
- val actual = nativeMapView.prefetchTiles
- assertEquals("Flag should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testPrefetchTilesDefault() {
- val expected = true
- val actual = nativeMapView.prefetchTiles
- assertEquals("Flag should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testPrefetchZoomDelta() {
- val expected = 2
- nativeMapView.prefetchZoomDelta = 2
- val actual = nativeMapView.prefetchZoomDelta
- assertEquals("Prefetch zoom delta should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testPrefetchZoomDeltaDefault() {
- val expected = 4
- val actual = nativeMapView.prefetchZoomDelta
- assertEquals("Prefetch zoom delta should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testSetContentPadding() {
- val expected = doubleArrayOf(1.0, 2.0, 3.0, 4.0)
- nativeMapView.contentPadding = expected
- val actual = nativeMapView.contentPadding
- assertEquals("Left should match", expected[0], actual[0])
- assertEquals("Top should match", expected[1], actual[1])
- assertEquals("Right should match", expected[2], actual[2])
- assertEquals("Bottom should match", expected[3], actual[3])
- }
-
- @Test
- @UiThreadTest
- fun testSetMinZoom() {
- val expected = 12.0
- nativeMapView.minZoom = expected
- val actual = nativeMapView.minZoom
- assertEquals("Min zoom should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testSetMaxZoom() {
- val expected = 12.0
- nativeMapView.maxZoom = expected
- val actual = nativeMapView.maxZoom
- assertEquals("Max zoom should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testGetProjectedMetersAtLatitude() {
- val expected = 77973.67021115532
- val actual = nativeMapView.getMetersPerPixelAtLatitude(5.0)
- assertEquals("Get projected meters should match", expected, actual)
- }
-
- @Test
- @UiThreadTest
- fun testLatLngForProjectedMeters() {
- val expected = LatLng(0.01796630538796444, 0.02694945852363162)
- val actual = nativeMapView.latLngForProjectedMeters(ProjectedMeters(2000.0, 3000.0))
- assertEquals("Lat for projected meters", expected.latitude, actual.latitude, DELTA)
- assertEquals("Lng for projected meters", expected.longitude, actual.longitude, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testFlyTo() {
- val expected = CameraPosition.Builder()
- .zoom(12.0)
- .tilt(30.0)
- .target(LatLng(12.0, 14.0))
- .bearing(20.0)
- .padding(PADDING_TEST)
- .build()
- // verify that the lazily set padding is ignored when a value is provided with the camera
- nativeMapView.contentPadding = doubleArrayOf(1.0, 2.0, 3.0, 4.0)
- nativeMapView.flyTo(expected.target, expected.zoom, expected.bearing, expected.tilt, PADDING_TEST, 0)
- val actual = nativeMapView.cameraPosition
- assertEquals("Bearing should match", expected.bearing, actual.bearing, TestConstants.BEARING_DELTA)
- assertEquals("Latitude should match", expected.target.latitude, actual.target.latitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Longitude should match", expected.target.longitude, actual.target.longitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Tilt should match", expected.tilt, actual.tilt, TestConstants.TILT_DELTA)
- assertEquals("Zoom should match", expected.zoom, actual.zoom, TestConstants.ZOOM_DELTA)
- Assert.assertArrayEquals(expected.padding, actual.padding, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testEaseTo() {
- val expected = CameraPosition.Builder()
- .zoom(12.0)
- .tilt(30.0)
- .target(LatLng(12.0, 14.0))
- .bearing(20.0)
- .padding(PADDING_TEST)
- .build()
- // verify that the lazily set padding is ignored when a value is provided with the camera
- nativeMapView.contentPadding = doubleArrayOf(1.0, 2.0, 3.0, 4.0)
- nativeMapView.easeTo(expected.target, expected.zoom, expected.bearing, expected.tilt, PADDING_TEST, 0, false)
- val actual = nativeMapView.cameraPosition
- assertEquals("Bearing should match", expected.bearing, actual.bearing, TestConstants.BEARING_DELTA)
- assertEquals("Latitude should match", expected.target.latitude, actual.target.latitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Longitude should match", expected.target.longitude, actual.target.longitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Tilt should match", expected.tilt, actual.tilt, TestConstants.TILT_DELTA)
- assertEquals("Zoom should match", expected.zoom, actual.zoom, TestConstants.ZOOM_DELTA)
- Assert.assertArrayEquals(expected.padding, actual.padding, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testResetPosition() {
- val expected = CameraPosition.Builder()
- .zoom(0.0)
- .tilt(0.0)
- .target(LatLng(0.0, 0.0))
- .bearing(0.0)
- .padding(PADDING_TEST)
- .build()
- nativeMapView.jumpTo(LatLng(1.0, 2.0), 12.0, 23.0, 1.0, PADDING_TEST)
- nativeMapView.resetPosition()
- val actual = nativeMapView.cameraPosition
- assertEquals("Bearing should match", expected.bearing, actual.bearing, TestConstants.BEARING_DELTA)
- assertEquals("Latitude should match", expected.target.latitude, actual.target.latitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Longitude should match", expected.target.longitude, actual.target.longitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Tilt should match", expected.tilt, actual.tilt, TestConstants.TILT_DELTA)
- assertEquals("Zoom should match", expected.zoom, actual.zoom, TestConstants.ZOOM_DELTA)
- Assert.assertArrayEquals(expected.padding, actual.padding, DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testGetCameraForLatLngBounds() {
- val expected = CameraPosition.Builder()
- .zoom(3.5258764777024005)
- .tilt(0.0)
- .target(LatLng(23.182767623652808, 13.999999999994088))
- .bearing(0.0)
- .build()
- val actual = nativeMapView.getCameraForLatLngBounds(
- LatLngBounds.from(30.0, 16.0, 16.0, 12.0),
- intArrayOf(0, 0, 0, 0),
- 0.0,
- 0.0
- )
- assertEquals("Bearing should match", expected.bearing, actual.bearing, TestConstants.BEARING_DELTA)
- assertEquals("Latitude should match", expected.target.latitude, actual.target.latitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Longitude should match", expected.target.longitude, actual.target.longitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Tilt should match", expected.tilt, actual.tilt, TestConstants.TILT_DELTA)
- assertEquals("Zoom should match", expected.zoom, actual.zoom, TestConstants.ZOOM_DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testMoveBy() {
- val expected = CameraPosition.Builder()
- .zoom(0.0)
- .tilt(0.0)
- .target(LatLng(4.21494310024160, -4.218749958739409))
- .bearing(0.0)
- .build()
- nativeMapView.moveBy(12.0, 12.0, 0)
- val actual = nativeMapView.cameraPosition
- assertEquals("Bearing should match", expected.bearing, actual.bearing, TestConstants.BEARING_DELTA)
- assertEquals("Latitude should match", expected.target.latitude, actual.target.latitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Longitude should match", expected.target.longitude, actual.target.longitude, TestConstants.LAT_LNG_DELTA)
- assertEquals("Tilt should match", expected.tilt, actual.tilt, TestConstants.TILT_DELTA)
- assertEquals("Zoom should match", expected.zoom, actual.zoom, TestConstants.ZOOM_DELTA)
- }
-
- @Test
- @UiThreadTest
- fun testTransitionOptions() {
- val transitionOptions = TransitionOptions(500, 500)
- nativeMapView.transitionOptions = transitionOptions
- assertTrue(transitionOptions.isEnablePlacementTransitions)
- assertEquals(transitionOptions, nativeMapView.transitionOptions)
- }
-
- @Test
- @UiThreadTest
- fun testTransitionOptions_disablePlacementTransitions() {
- val transitionOptions = TransitionOptions(500, 500, false)
- nativeMapView.transitionOptions = transitionOptions
- assertFalse(transitionOptions.isEnablePlacementTransitions)
- assertEquals(transitionOptions, nativeMapView.transitionOptions)
- }
-
- class DummyRenderer(context: Context) : MapRenderer(context, null) {
-
- override fun requestRender() {
- // no-op
- }
-
- override fun queueEvent(runnable: Runnable?) {
- // no-op
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt
deleted file mode 100644
index 6b59411ae8..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.mapbox.mapboxsdk.maps
-
-import android.support.test.espresso.UiController
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
-import org.junit.Assert.assertEquals
-import org.junit.Test
-
-class TransformTest : EspressoTest() {
-
- companion object {
- val initialCameraUpdate = CameraUpdateFactory.newLatLngZoom(LatLng(12.0, 12.0), 12.0)!!
- }
-
- @Test
- fun mapboxMapScrollByWithPadding() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(initialCameraUpdate)
- mapboxMap.scrollBy(400.0f, 0.0f)
- val expectedCameraPosition = mapboxMap.cameraPosition
-
- mapboxMap.moveCamera(initialCameraUpdate)
- mapboxMap.setPadding(250, 250, 0, 0)
- mapboxMap.scrollBy(400.0f, 0.0f)
- val actualCameraPosition = mapboxMap.cameraPosition
-
- assertEquals("Camera position should match", expectedCameraPosition, actualCameraPosition)
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt
deleted file mode 100644
index 12dff5d452..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt
+++ /dev/null
@@ -1,400 +0,0 @@
-package com.mapbox.mapboxsdk.maps
-
-import android.graphics.PointF
-import android.support.test.espresso.UiController
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest
-import com.mapbox.mapboxsdk.testapp.activity.espresso.PixelTestActivity
-import org.junit.Assert.assertFalse
-import org.junit.Assert.assertTrue
-import org.junit.Test
-
-class VisibleRegionTest : BaseTest() {
-
- override fun getActivityClass(): Class<*> {
- return PixelTestActivity::class.java
- }
-
- override
- fun beforeTest() {
- super.beforeTest()
- mapView = (rule.activity as PixelTestActivity).mapView
- }
-
- @Test
- fun visibleRegionTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
- val visibleRegion = mapboxMap.projection.visibleRegion
- assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) })
- }
- }
-
- @Test
- fun paddedVisibleRegionTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(
- mapView.width / 4,
- mapView.height / 4,
- mapView.width / 4,
- mapView.height / 4)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 1)
- assertTrue(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)))
- }
- }
-
- @Test
- fun paddedLeftVisibleRegionTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(mapView.width / 4, 0, 0, 0)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f)))
- }
- }
-
- @Test
- fun paddedTopVisibleRegionTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(0, mapView.height / 4, 0, 0)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f)))
- }
- }
-
- @Test
- fun paddedRightVisibleRegionTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(0, 0, mapView.width / 4, 0)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f)))
- }
- }
-
- @Test
- fun paddedBottomVisibleRegionTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(0, 0, 0, mapView.height / 4)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat())))
- }
- }
-
- @Test
- fun visibleRegionOverDatelineTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat())
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
- val visibleRegion = mapboxMap.projection.visibleRegion
- assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) })
- }
- }
-
- @Test
- fun paddedVisibleRegionOverDatelineTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(
- mapView.width / 4,
- mapView.height / 4,
- mapView.width / 4,
- mapView.height / 4)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 1)
- assertTrue(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)))
- }
- }
-
- @Test
- fun paddedLeftVisibleRegionOverDatelineTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat())
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(mapView.width / 4, 0, 0, 0)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f)))
- }
- }
-
- @Test
- fun paddedTopVisibleRegionOverDatelineTest() {
- validateTestSetup()
- invoke(mapboxMap) { ui: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- ui.loopMainThreadForAtLeast(5000)
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat())
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(0, mapView.height / 4, 0, 0)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f)))
- }
- }
-
- @Test
- fun paddedRightVisibleRegionOverDatelineTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat())
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(0, 0, mapView.width / 4, 0)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f)))
- }
- }
-
- @Test
- fun paddedBottomVisibleRegionOverDatelineTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(0f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat())
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()),
- mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f)
- )
-
- mapboxMap.setPadding(0, 0, 0, mapView.height / 4)
-
- val visibleRegion = mapboxMap.projection.getVisibleRegion(false)
- val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) }
- assertTrue(filtered.size == 6)
- assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat())))
- }
- }
-
- @Test
- fun visibleRotatedRegionTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0))
- val d = Math.min(mapboxMap.width, mapboxMap.height) / 4
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f)
- )
-
- for (bearing in 45 until 360 step 45) {
- mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble()))
- val visibleRegion = mapboxMap.projection.visibleRegion
- assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) })
- }
- }
- }
-
- @Test
- fun visibleRotatedRegionOverDatelineTest() {
- validateTestSetup()
- invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- val d = Math.min(mapboxMap.width, mapboxMap.height) / 4
- val latLngs = listOf(
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f)
- .also { it.longitude += 360 },
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f),
- mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f)
- )
-
- for (bearing in 45 until 360 step 45) {
- mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble()))
- val visibleRegion = mapboxMap.projection.visibleRegion
- assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) })
- }
- }
- }
-
- private fun MapboxMap.getLatLngFromScreenCoords(x: Float, y: Float): LatLng {
- return this.projection.fromScreenLocation(PointF(x, y))
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt
deleted file mode 100644
index 6b5bc63adb..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.mapbox.mapboxsdk.offline
-
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.geojson.Point
-import com.mapbox.mapboxsdk.log.Logger
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
-import java.util.concurrent.CountDownLatch
-import java.util.concurrent.TimeUnit
-import java.util.concurrent.TimeoutException
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Integration test that validates downloading an offline region from a point geometry at zoomlevel 17
- */
-@RunWith(AndroidJUnit4::class)
-class OfflineDownloadTest : OfflineRegion.OfflineRegionObserver {
-
- @Rule
- @JvmField
- var rule = ActivityTestRule(FeatureOverviewActivity::class.java)
-
- private val countDownLatch = CountDownLatch(1)
- private lateinit var offlineRegion: OfflineRegion
-
- @Test(timeout = 60000)
- fun offlineDownload() {
- rule.runOnUiThreadActivity {
- OfflineManager.getInstance(rule.activity).createOfflineRegion(
- createTestRegionDefinition(),
- ByteArray(0),
- object : OfflineManager.CreateOfflineRegionCallback {
- override fun onCreate(region: OfflineRegion) {
- offlineRegion = region
- offlineRegion.setDownloadState(OfflineRegion.STATE_ACTIVE)
- offlineRegion.setObserver(this@OfflineDownloadTest)
- }
-
- override fun onError(error: String) {
- Logger.e(TAG, "Error while creating offline region: $error")
- }
- })
- }
-
- if (!countDownLatch.await(60, TimeUnit.SECONDS)) {
- throw TimeoutException()
- }
- }
-
- override fun onStatusChanged(status: OfflineRegionStatus) {
- Logger.i(TAG, "Download percentage ${100.0 * status.completedResourceCount / status.requiredResourceCount}")
- if (status.isComplete) {
- offlineRegion.setDownloadState(OfflineRegion.STATE_INACTIVE)
- countDownLatch.countDown()
- }
- }
-
- override fun onError(error: OfflineRegionError) {
- Logger.e(TAG, "Error while downloading offline region: $error")
- }
-
- override fun mapboxTileCountLimitExceeded(limit: Long) {
- Logger.e(TAG, "Tile count limited exceeded: $limit")
- }
-
- private fun createTestRegionDefinition(): OfflineRegionDefinition {
- return OfflineGeometryRegionDefinition(
- Style.MAPBOX_STREETS,
- Point.fromLngLat(50.847857, 4.360137),
- 17.0,
- 17.0,
- 1.0f,
- false
- )
- }
-
- companion object {
- const val TAG = "OfflineDownloadTest"
- }
-}
-
-fun ActivityTestRule<*>.runOnUiThreadActivity(runnable: () -> Unit) = activity.runOnUiThread(runnable) \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt
deleted file mode 100644
index 9fca11c017..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.mapbox.mapboxsdk.snapshotter
-
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.camera.CameraPosition
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
-import java.util.concurrent.CountDownLatch
-import java.util.concurrent.TimeUnit
-import java.util.concurrent.TimeoutException
-import junit.framework.Assert.assertNotNull
-import org.junit.Assert
-import org.junit.Ignore
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Integration test that validates if a snapshotter creation
- */
-@RunWith(AndroidJUnit4::class)
-@Ignore("Ignored until https://github.com/mapbox/mapbox-gl-native/issues/11669 is resolved.")
-class MapSnapshotterTest {
-
- @Rule
- @JvmField
- var rule = ActivityTestRule(FeatureOverviewActivity::class.java)
-
- private val countDownLatch = CountDownLatch(1)
-
- @Test
- fun mapSnapshotter() {
- rule.activity.runOnUiThread {
- val options = MapSnapshotter.Options(512, 512)
- .withPixelRatio(1.0f)
- .withStyle(Style.SATELLITE_STREETS)
- .withCameraPosition(
- CameraPosition.Builder()
- .zoom(12.0)
- .target(LatLng(51.145495, 5.742234))
- .build()
- )
- val mapSnapshotter = MapSnapshotter(rule.activity, options)
- mapSnapshotter.start({
- assertNotNull(it)
- assertNotNull(it.bitmap)
- countDownLatch.countDown()
- }, {
- Assert.fail(it)
- })
- }
- if (!countDownLatch.await(30, TimeUnit.SECONDS)) {
- throw TimeoutException()
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java
deleted file mode 100644
index 926212afc8..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.action;
-
-import android.support.annotation.NonNull;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-
-import org.hamcrest.Matcher;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-
-public class MapboxMapAction implements ViewAction {
-
- private OnInvokeActionListener invokeViewAction;
- private MapboxMap mapboxMap;
-
- public MapboxMapAction(OnInvokeActionListener invokeViewAction, MapboxMap mapboxMap) {
- this.invokeViewAction = invokeViewAction;
- this.mapboxMap = mapboxMap;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- invokeViewAction.onInvokeAction(uiController, mapboxMap);
- }
-
- public static void invoke(MapboxMap mapboxMap, OnInvokeActionListener invokeViewAction) {
- onView(withId(android.R.id.content)).perform(new MapboxMapAction(invokeViewAction, mapboxMap));
- }
-
- public interface OnInvokeActionListener {
- void onInvokeAction(@NonNull UiController uiController, @NonNull MapboxMap mapboxMap);
- }
-}
-
-
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java
deleted file mode 100644
index 1bf5a87970..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.action;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.ContextWrapper;
-import android.content.pm.ActivityInfo;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-import android.view.ViewGroup;
-import org.hamcrest.Matcher;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isRoot;
-
-public class OrientationAction implements ViewAction {
-
- private final int orientation;
-
- private OrientationAction(int orientation) {
- this.orientation = orientation;
- }
-
- public static ViewAction orientationLandscape() {
- return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
- }
-
- public static ViewAction orientationPortrait() {
- return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
- }
-
- public static ViewAction orientationLandscapeReverse() {
- return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
- }
-
- public static ViewAction orientationPortraitReverse() {
- return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isRoot();
- }
-
- @Override
- public String getDescription() {
- return "change orientation to " + orientation;
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- uiController.loopMainThreadUntilIdle();
- Activity activity = getActivity(view.getContext());
- if (activity == null && view instanceof ViewGroup) {
- ViewGroup v = (ViewGroup) view;
- int c = v.getChildCount();
- for (int i = 0; i < c && activity == null; ++i) {
- activity = getActivity(v.getChildAt(i).getContext());
- }
- }
- activity.setRequestedOrientation(orientation);
- }
-
- public static void invoke(ViewAction action) {
- onView(isRoot()).perform(action);
- }
-
- private Activity getActivity(Context context) {
- while (context instanceof ContextWrapper) {
- if (context instanceof Activity) {
- return (Activity) context;
- }
- context = ((ContextWrapper) context).getBaseContext();
- }
- return null;
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java
deleted file mode 100644
index e3741f3d42..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.action;
-
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-import org.hamcrest.Matcher;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.isRoot;
-
-public final class WaitAction implements ViewAction {
-
- private final long loopTime;
-
- public WaitAction(long loopTime) {
- this.loopTime = loopTime;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- uiController.loopMainThreadForAtLeast(loopTime);
- }
-
- public static void invoke(long loopTime) {
- onView(isRoot()).perform(new WaitAction(loopTime));
- }
-}
-
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java
deleted file mode 100644
index b6c16c8147..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.activity;
-
-import android.content.Context;
-import android.support.annotation.CallSuper;
-import android.support.annotation.UiThread;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.rule.GrantPermissionRule;
-
-import com.mapbox.mapboxsdk.AppCenter;
-import com.mapbox.mapboxsdk.Mapbox;
-import com.mapbox.mapboxsdk.maps.MapView;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import timber.log.Timber;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import static junit.framework.TestCase.assertNotNull;
-import static junit.framework.TestCase.assertTrue;
-
-/**
- * Base class for all Activity test hooking into an existing Activity that will load style.
- */
-public abstract class BaseTest extends AppCenter {
-
- private static final int WAIT_TIMEOUT = 30; //seconds
-
- @Rule
- public ActivityTestRule rule = new ActivityTestRule<>(getActivityClass());
-
- @Rule
- public TestName testName = new TestName();
-
- @Rule
- public GrantPermissionRule grantLocationPermissionRule = GrantPermissionRule
- .grant(android.Manifest.permission.ACCESS_FINE_LOCATION);
-
- protected MapboxMap mapboxMap;
- protected MapView mapView;
- private final CountDownLatch latch = new CountDownLatch(1);
-
- @Before
- @CallSuper
- public void beforeTest() {
- initialiseMap();
- holdTestRunnerForStyleLoad();
- }
-
- @After
- @CallSuper
- public void afterTest() {
- super.afterTest();
- }
-
- @UiThread
- @CallSuper
- protected void initMap(MapboxMap mapboxMap) {
- this.mapboxMap = mapboxMap;
- mapboxMap.getStyle(style -> latch.countDown());
- }
-
- protected void validateTestSetup() {
- if (!Mapbox.isConnected()) {
- Timber.e("Not connected to the internet while running test");
- }
- assertNotNull("MapView isn't initialised", mapView);
- assertNotNull("MapboxMap isn't initialised", mapboxMap);
- assertNotNull("Style isn't initialised", mapboxMap.getStyle());
- assertTrue("Style isn't fully loaded", mapboxMap.getStyle().isFullyLoaded());
- }
-
- protected abstract Class getActivityClass();
-
- private void initialiseMap() {
- try {
- rule.runOnUiThread(() -> {
- mapView = rule.getActivity().findViewById(R.id.mapView);
- if (mapView != null) {
- mapView.getMapAsync(this::initMap);
- } else {
- Timber.w("Skipping map load test since mapView is not found.");
- latch.countDown();
- }
- });
- } catch (Throwable throwable) {
- throwable.printStackTrace();
- }
- }
-
- private void holdTestRunnerForStyleLoad() {
- boolean interrupted;
- try {
- interrupted = latch.await(WAIT_TIMEOUT, TimeUnit.SECONDS);
- } catch (InterruptedException ignore) {
- interrupted = true;
- }
-
- if (!interrupted) {
- Timber.e("Timeout occurred for %s", testName.getMethodName());
- validateTestSetup();
- }
- }
-
- protected Context getContext() {
- return rule.getActivity();
- }
-
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java
deleted file mode 100644
index c168bf5f2e..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.activity;
-
-import android.support.annotation.UiThread;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.maps.Style;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-
-/**
- * Base class for all tests using EspressoTestActivity as wrapper.
- * <p>
- * Loads "assets/streets.json" as style.
- * </p>
- */
-public class EspressoTest extends BaseTest {
-
- @Override
- protected final Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @UiThread
- @Override
- protected void initMap(MapboxMap mapboxMap) {
- mapboxMap.setStyle(new Style.Builder().fromUri("asset://streets.json"));
- super.initMap(mapboxMap);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs
deleted file mode 100644
index 22082400b5..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs
+++ /dev/null
@@ -1,32 +0,0 @@
-<%
- const activity = locals[0];
- const subPackage = locals[1];
--%>
-// This file is generated. Edit android/platform/scripts/generate-test-code.js, then run `make generate-test-android`.
-package com.mapbox.mapboxsdk.testapp.activity.gen.<%- subPackage %>;
-
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
-import com.mapbox.mapboxsdk.testapp.activity.<%- subPackage %>.<%- activity %>;
-
-import junit.framework.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Sanity test for <%- activity %>
- */
-@RunWith(AndroidJUnit4.class)
-public class <%- activity %>Test extends BaseTest {
-
- @Test
- public void testSanity() {
-
- }
-
- @Override
- protected Class getActivityClass() {
- return <%- activity %>.class;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java
deleted file mode 100644
index 559213af3d..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.v4.content.res.ResourcesCompat;
-import com.mapbox.mapboxsdk.annotations.Icon;
-import com.mapbox.mapboxsdk.annotations.IconFactory;
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.IconManagerResolver;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import com.mapbox.mapboxsdk.testapp.utils.IconUtils;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Map;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
-
-/**
- * Tests integration between Icons and Markers
- */
-public class IconTest extends EspressoTest {
-
- private Map<Icon, Integer> iconMap;
-
- @Before
- public void beforeTest() {
- super.beforeTest();
- iconMap = new IconManagerResolver(mapboxMap).getIconMap();
- }
-
- @Test
- @UiThreadTest
- public void testAddSameIconMarker() {
- validateTestSetup();
- Icon defaultMarker = IconFactory.getInstance(rule.getActivity()).defaultMarker();
- mapboxMap.addMarker(new MarkerOptions().position(new LatLng()));
- mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1)));
- assertEquals(1, iconMap.size());
- assertEquals(2, iconMap.get(defaultMarker), 0);
- }
-
- @Test
- @UiThreadTest
- public void testAddDifferentIconMarker() {
- validateTestSetup();
- Icon icon = IconFactory.getInstance(rule.getActivity()).fromResource(R.drawable.mapbox_logo_icon);
- mapboxMap.addMarker(new MarkerOptions().icon(icon).position(new LatLng()));
- mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1)));
- assertEquals(iconMap.size(), 2);
- assertTrue(iconMap.containsKey(icon));
- assertTrue(iconMap.get(icon) == 1);
- }
-
- @Test
- @UiThreadTest
- public void testAddRemoveIconMarker() {
- validateTestSetup();
- Icon icon = IconFactory.getInstance(rule.getActivity()).fromResource(R.drawable.mapbox_logo_icon);
- Marker marker = mapboxMap.addMarker(new MarkerOptions().icon(icon).position(new LatLng()));
- mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1)));
- assertEquals(iconMap.size(), 2);
- assertTrue(iconMap.containsKey(icon));
- assertTrue(iconMap.get(icon) == 1);
-
- mapboxMap.removeMarker(marker);
- assertEquals(iconMap.size(), 1);
- assertFalse(iconMap.containsKey(icon));
- }
-
- @Test
- @UiThreadTest
- public void testAddRemoveDefaultMarker() {
- validateTestSetup();
- Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1)));
- assertEquals(iconMap.size(), 1);
-
- mapboxMap.removeMarker(marker);
- assertEquals(iconMap.size(), 0);
-
- mapboxMap.addMarker(new MarkerOptions().position(new LatLng()));
- assertEquals(iconMap.size(), 1);
- }
-
- @Test
- @UiThreadTest
- public void testAddRemoveMany() {
- validateTestSetup();
- Activity activity = rule.getActivity();
- IconFactory iconFactory = IconFactory.getInstance(activity);
-
- // add 2 default icon markers
- Marker defaultMarkerOne = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1)));
- Marker defaultMarkerTwo = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(2, 1)));
-
- // add 4 unique icon markers
- mapboxMap.addMarker(new MarkerOptions()
- .icon(iconFactory.fromResource(R.drawable.mapbox_logo_icon))
- .position(new LatLng(3, 1))
- );
- mapboxMap.addMarker(new MarkerOptions()
- .icon(iconFactory.fromResource(R.drawable.mapbox_compass_icon))
- .position(new LatLng(4, 1))
- );
- mapboxMap.addMarker(new MarkerOptions()
- .icon(IconUtils.drawableToIcon(activity, R.drawable.ic_stars,
- ResourcesCompat.getColor(activity.getResources(),
- R.color.blueAccent, activity.getTheme())))
- .position(new LatLng(5, 1))
- );
- mapboxMap.addMarker(new MarkerOptions()
- .icon(iconFactory.fromResource(R.drawable.ic_android))
- .position(new LatLng(6, 1))
- );
-
- assertEquals("Amount of icons should match 5", 5, iconMap.size());
- assertEquals("Refcounter of default marker should match 2", 2, iconMap.get(iconFactory.defaultMarker()), 0);
-
- mapboxMap.removeMarker(defaultMarkerOne);
-
- assertEquals("Amount of icons should match 5", 5, iconMap.size());
- assertEquals("Refcounter of default marker should match 1", 1, iconMap.get(iconFactory.defaultMarker()), 0);
-
- mapboxMap.removeMarker(defaultMarkerTwo);
-
- assertEquals("Amount of icons should match 4", 4, iconMap.size());
- assertNull("DefaultMarker shouldn't exist anymore", iconMap.get(iconFactory.defaultMarker()));
-
- mapboxMap.clear();
- assertEquals("Amount of icons should match 0", 0, iconMap.size());
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java
deleted file mode 100644
index 2328023a3d..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertEquals;
-
-public class MarkerTest extends EspressoTest {
-
- private Marker marker;
-
- @Test
- @Ignore
- public void addMarkerTest() {
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
-
- MarkerOptions options = new MarkerOptions();
- options.setPosition(new LatLng());
- options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.setTitle(TestConstants.TEXT_MARKER_TITLE);
- marker = mapboxMap.addMarker(options);
-
- assertEquals("Markers size should be 1, ", 1, mapboxMap.getMarkers().size());
- assertEquals("Marker id should be 0", 0, marker.getId());
- assertEquals("Marker target should match", new LatLng(), marker.getPosition());
- assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet());
- assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle());
- mapboxMap.clear();
- assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
- });
- }
-
- @Test
- @Ignore
- public void showInfoWindowTest() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- final MarkerOptions options = new MarkerOptions();
- options.setPosition(new LatLng());
- options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.setTitle(TestConstants.TEXT_MARKER_TITLE);
- marker = mapboxMap.addMarker(options);
- mapboxMap.selectMarker(marker);
- });
- onView(withText(TestConstants.TEXT_MARKER_TITLE)).check(matches(isDisplayed()));
- onView(withText(TestConstants.TEXT_MARKER_SNIPPET)).check(matches(isDisplayed()));
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java
deleted file mode 100644
index b604bb7da1..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import android.graphics.Color;
-
-import com.mapbox.mapboxsdk.annotations.Polygon;
-import com.mapbox.mapboxsdk.annotations.PolygonOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertEquals;
-
-public class PolygonTest extends EspressoTest {
-
- @Test
- @Ignore
- public void addPolygonTest() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLngOne = new LatLng();
- LatLng latLngTwo = new LatLng(1, 0);
- LatLng latLngThree = new LatLng(1, 1);
-
- assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
-
- final PolygonOptions options = new PolygonOptions();
- options.strokeColor(Color.BLUE);
- options.fillColor(Color.RED);
- options.add(latLngOne);
- options.add(latLngTwo);
- options.add(latLngThree);
- Polygon polygon = mapboxMap.addPolygon(options);
-
- assertEquals("Polygons should be 1", 1, mapboxMap.getPolygons().size());
- assertEquals("Polygon id should be 0", 0, polygon.getId());
- assertEquals("Polygon points size should match", 3, polygon.getPoints().size());
- assertEquals("Polygon stroke color should match", Color.BLUE, polygon.getStrokeColor());
- assertEquals("Polygon target should match", Color.RED, polygon.getFillColor());
- mapboxMap.clear();
- assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
- });
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java
deleted file mode 100644
index f977e25981..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import android.graphics.Color;
-
-import com.mapbox.mapboxsdk.annotations.Polyline;
-import com.mapbox.mapboxsdk.annotations.PolylineOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertEquals;
-
-public class PolylineTest extends EspressoTest {
-
- @Test
- @Ignore
- public void addPolylineTest() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLngOne = new LatLng();
- LatLng latLngTwo = new LatLng(1, 0);
-
- assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
-
- final PolylineOptions options = new PolylineOptions();
- options.color(Color.BLUE);
- options.add(latLngOne);
- options.add(latLngTwo);
- Polyline polyline = mapboxMap.addPolyline(options);
-
- assertEquals("Polylines should be 1", 1, mapboxMap.getPolylines().size());
- assertEquals("Polyline id should be 0", 0, polyline.getId());
- assertEquals("Polyline points size should match", 2, polyline.getPoints().size());
- assertEquals("Polyline stroke color should match", Color.BLUE, polyline.getColor());
- mapboxMap.clear();
- assertEquals("Polyline should be empty", 0, mapboxMap.getPolylines().size());
- });
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java
deleted file mode 100644
index 69cf1264bf..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-
-public class CameraAnimateTest extends CameraTest {
- @Override
- void executeCameraMovement(CameraUpdate cameraUpdate, MapboxMap.CancelableCallback callback) {
- mapboxMap.animateCamera(cameraUpdate, callback);
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java
deleted file mode 100644
index be3b18ef8b..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-
-public class CameraEaseTest extends CameraTest {
-
- @Override
- void executeCameraMovement(CameraUpdate cameraUpdate, MapboxMap.CancelableCallback callback) {
- mapboxMap.easeCamera(cameraUpdate, callback);
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java
deleted file mode 100644
index 4365ea95ff..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import android.support.annotation.NonNull;
-import android.support.test.annotation.UiThreadTest;
-import com.mapbox.geojson.Point;
-import com.mapbox.geojson.Polygon;
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.DeviceIndependentTestActivity;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-public class CameraForTest extends BaseTest {
-
- @Test
- @UiThreadTest
- public void testGetCameraForLatLngBounds() {
- validateTestSetup();
- CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
- LatLngBounds.from(10, 10, -10, -10));
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Bearing should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match", expectedPosition.tilt, actualPosition.tilt, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForLatLngBoundsPadding() {
- validateTestSetup();
- CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
- LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5});
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForLatLngBoundsBearing() {
- validateTestSetup();
- CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
- LatLngBounds.from(10, 10, -10, -10), 45, 0);
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForLatLngBoundsTilt() {
- validateTestSetup();
- CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
- LatLngBounds.from(10, 10, -10, -10), 0, 45);
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng(-0.264576975267, 0)).zoom(4.13).tilt(45).bearing(0).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForLatLngBoundsAll() {
- validateTestSetup();
- CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
- LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5}, 45, 45);
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng(-0.3732134634, -0.3713191053)).zoom(3.63).tilt(45).bearing(45).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForGeometry() {
- validateTestSetup();
- List<List<Point>> polygonDefinition = getPolygonDefinition();
- CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition));
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Bearing should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match", expectedPosition.tilt, actualPosition.tilt, 0.01f);
- }
-
- @NonNull
- private List<List<Point>> getPolygonDefinition() {
- return new ArrayList<List<Point>>() {
- {
- add(new ArrayList<Point>() {
- {
- add(Point.fromLngLat(10, 10));
- add(Point.fromLngLat(-10, 10));
- add(Point.fromLngLat(-10, -10));
- add(Point.fromLngLat(10, -10));
- }
- });
- }
- };
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForGeometryPadding() {
- validateTestSetup();
- List<List<Point>> polygonDefinition = getPolygonDefinition();
- CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition),
- new int[] {5, 5, 5, 5});
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForGeometryBearing() {
- validateTestSetup();
- List<List<Point>> polygonDefinition = getPolygonDefinition();
- CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 45, 0);
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForGeometryTilt() {
- validateTestSetup();
- List<List<Point>> polygonDefinition = getPolygonDefinition();
- CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 0, 45);
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng(-0.2645769752, 0)).zoom(4.13).tilt(45).bearing(0).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForGeometryAll() {
- validateTestSetup();
- List<List<Point>> polygonDefinition = getPolygonDefinition();
- CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition),
- new int[] {5, 5, 5, 5}, 45, 45);
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng(-0.373213463, -0.37131910534)).zoom(3.63).tilt(45).bearing(45).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Test
- @UiThreadTest
- public void testGetCameraForGeometryDeprecatedApi() {
- validateTestSetup();
- List<List<Point>> polygonDefinition = getPolygonDefinition();
- CameraPosition actualPosition = mapboxMap.getCameraForGeometry(
- Polygon.fromLngLats(polygonDefinition),
- new int[] {5, 5, 5, 5},
- 45, 0);
- CameraPosition expectedPosition = new CameraPosition.Builder()
- .target(new LatLng()).zoom(3.63).tilt(0).bearing(45).build();
- assertEquals("Latitude should match",
- expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
- assertEquals("Longitude should match",
- expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f);
- assertEquals("Zoom should match",
- expectedPosition.zoom, actualPosition.zoom, 0.01f);
- assertEquals("Tilt should match",
- expectedPosition.tilt, actualPosition.tilt, 0.01f);
- assertEquals("Bearing should match",
- expectedPosition.bearing, actualPosition.bearing, 0.01f);
- }
-
- @Override
- protected Class getActivityClass() {
- return DeviceIndependentTestActivity.class;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java
deleted file mode 100644
index 2cd7b6ffe3..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-
-public class CameraMoveTest extends CameraTest {
- @Override
- void executeCameraMovement(CameraUpdate cameraUpdate, MapboxMap.CancelableCallback callback) {
- mapboxMap.moveCamera(cameraUpdate, callback);
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraTest.java
deleted file mode 100644
index ebce9aaec5..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraTest.java
+++ /dev/null
@@ -1,307 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.DeviceIndependentTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-public abstract class CameraTest extends BaseTest {
-
- private CountDownLatch latch;
-
- @Override
- protected Class getActivityClass() {
- return DeviceIndependentTestActivity.class;
- }
-
- @Override
- public void beforeTest() {
- super.beforeTest();
- latch = new CountDownLatch(1);
- }
-
- @Test
- public void testToCameraPositionTarget() throws InterruptedException {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- float zoom = 1.0f;
- LatLng moveTarget = new LatLng(1, 1);
- CameraPosition initialPosition = new CameraPosition.Builder().target(
- new LatLng()).zoom(zoom).bearing(0).tilt(0).padding(new double[4]).build();
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Default camera position should match default", cameraPosition, initialPosition);
-
- executeCameraMovement(CameraUpdateFactory.newLatLng(moveTarget), new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, moveTarget, zoom, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, moveTarget, zoom, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- @Test
- public void testToCameraPositionTargetZoom() throws InterruptedException {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- final float moveZoom = 15.5f;
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
-
- executeCameraMovement(CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom),
- new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, moveTarget, moveZoom, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, moveTarget, moveZoom, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- @Test
- public void testToCameraPosition() throws InterruptedException {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
- final float moveZoom = 15.5f;
- final float moveTilt = 45.5f;
- final float moveBearing = 12.5f;
- final double[] movePadding = new double[] {0, 500, 350, 1};
-
- executeCameraMovement(CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .target(moveTarget)
- .zoom(moveZoom)
- .tilt(moveTilt)
- .bearing(moveBearing)
- .padding(movePadding)
- .build()),
- new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, moveTarget, moveZoom, moveBearing, moveTilt, movePadding);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, moveTarget, moveZoom, moveBearing, moveTilt, movePadding);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- @Test
- public void testToBounds() throws InterruptedException {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- final LatLng centerBounds = new LatLng(1, 1);
- LatLng cornerOne = new LatLng();
- LatLng cornerTwo = new LatLng(2, 2);
- final LatLngBounds.Builder builder = new LatLngBounds.Builder();
- builder.include(cornerOne);
- builder.include(cornerTwo);
-
- executeCameraMovement(CameraUpdateFactory.newLatLngBounds(builder.build(), 0),
- new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, centerBounds, mapboxMap.getCameraPosition().zoom, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, centerBounds, mapboxMap.getCameraPosition().zoom, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- @Test
- public void testToZoomIn() throws InterruptedException {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- float zoom = 1.0f;
-
- executeCameraMovement(CameraUpdateFactory.zoomIn(), new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + 1, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + 1, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- @Test
- public void testToZoomOut() throws InterruptedException {
- float zoom = 10.0f;
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- executeCameraMovement(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom), new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
-
- latch = new CountDownLatch(1);
-
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- executeCameraMovement(CameraUpdateFactory.zoomOut(), new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom - 1, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom - 1, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- @Test
- public void testToZoomBy() throws InterruptedException {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- float zoom = 1.0f;
- final float zoomBy = 2.45f;
-
- executeCameraMovement(CameraUpdateFactory.zoomBy(zoomBy), new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + zoomBy, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + zoomBy, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- @Test
- public void testToZoomTo() throws InterruptedException {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- final float zoomTo = 2.45f;
-
- executeCameraMovement(CameraUpdateFactory.zoomTo(zoomTo), new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoomTo, 0, 0, new double[4]);
- latch.countDown();
- }
-
- @Override
- public void onFinish() {
- verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoomTo, 0, 0, new double[4]);
- latch.countDown();
- }
- });
- });
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- Assert.fail("timeout");
- }
- }
-
- abstract void executeCameraMovement(CameraUpdate cameraUpdate, MapboxMap.CancelableCallback callback);
-
- private void verifyCameraPosition(MapboxMap mapboxMap, LatLng moveTarget, double moveZoom, double moveBearing,
- double moveTilt, double[] padding) {
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA);
- assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA);
- assertArrayEquals("Moved padding should match", cameraPosition.padding, padding, TestConstants.PADDING_DELTA);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt
deleted file mode 100644
index f695f3efe2..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.fragment
-
-import android.support.test.espresso.Espresso
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.action.ViewActions.click
-import android.support.test.espresso.matcher.ViewMatchers.withId
-import android.support.test.filters.LargeTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.testapp.R
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.MapInDialogActivity
-import org.junit.Ignore
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Regression test that validates that a map inside a DialogFragment can be opened and closed.
- */
-@RunWith(AndroidJUnit4::class)
-@LargeTest
-class MapDialogFragmentTest : AppCenter() {
-
- @get:Rule
- var activityRule: ActivityTestRule<MapInDialogActivity> = ActivityTestRule(MapInDialogActivity::class.java)
-
- @Test
- @Ignore
- fun openCloseDialog() {
- onView(withId(R.id.button_open_dialog)).perform(click())
- Thread.sleep(2500)
- Espresso.pressBack()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java
deleted file mode 100644
index 81d10a5f15..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.geometry;
-
-import android.support.test.annotation.UiThreadTest;
-import com.google.gson.JsonArray;
-import com.mapbox.geojson.Feature;
-import com.mapbox.geojson.Point;
-import com.mapbox.geojson.Polygon;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
-import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isRoot;
-import static com.mapbox.geojson.Feature.fromGeometry;
-import static com.mapbox.geojson.FeatureCollection.fromFeatures;
-import static com.mapbox.geojson.GeometryCollection.fromGeometries;
-import static com.mapbox.geojson.LineString.fromLngLats;
-import static com.mapbox.geojson.MultiLineString.fromLineString;
-import static com.mapbox.geojson.MultiPolygon.fromPolygon;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.singletonList;
-import static org.junit.Assert.assertFalse;
-
-/**
- * Instrumentation test to validate java geojson conversion to c++
- */
-public class GeoJsonConversionTest extends EspressoTest {
-
- // Regression test for #12343
- @Test
- @UiThreadTest
- public void testEmptyFeatureCollection() {
- validateTestSetup();
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("test-id",
- fromFeatures(singletonList(fromGeometry(fromGeometries(emptyList()))))
- )
- );
- mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
- }
-
- @Test
- @UiThreadTest
- public void testPointFeatureCollection() {
- validateTestSetup();
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("test-id",
- fromFeatures(singletonList(fromGeometry(Point.fromLngLat(0.0, 0.0))))
- )
- );
- mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
- }
-
- @Test
- @UiThreadTest
- public void testMultiPointFeatureCollection() {
- validateTestSetup();
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("test-id",
- fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))
- )
- );
- mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
- }
-
- @Test
- @UiThreadTest
- public void testPolygonFeatureCollection() {
- validateTestSetup();
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("test-id",
- fromFeatures(singletonList(fromGeometry(Polygon.fromLngLats(emptyList()))))
- )
- );
- mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
- }
-
- @Test
- @UiThreadTest
- public void testMultiPolygonFeatureCollection() {
- validateTestSetup();
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("test-id",
- fromFeatures(singletonList(fromGeometry(fromPolygon(Polygon.fromLngLats(emptyList())))))
- )
- );
- mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
- }
-
- @Test
- @UiThreadTest
- public void testLineStringFeatureCollection() {
- validateTestSetup();
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("test-id",
- fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))
- )
- );
- mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
- }
-
- @Test
- @UiThreadTest
- public void testMultiLineStringFeatureCollection() {
- validateTestSetup();
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("test-id",
- fromFeatures(singletonList(fromGeometry(fromLineString(fromLngLats(emptyList())))))
- )
- );
- mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
- }
-
-
- @Test
- public void testNegativeNumberPropertyConversion() {
- validateTestSetup();
- onView(isRoot()).perform(new MapboxMapAction((uiController, mapboxMap) -> {
- LatLng latLng = new LatLng();
- Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
-
- JsonArray foregroundJsonArray = new JsonArray();
- foregroundJsonArray.add(0f);
- foregroundJsonArray.add(-3f);
- feature.addProperty("property", foregroundJsonArray);
-
- GeoJsonSource source = new GeoJsonSource("source", feature);
- mapboxMap.getStyle().addSource(source);
-
- SymbolLayer layer = new SymbolLayer("layer", "source")
- .withProperties(
- PropertyFactory.iconOffset(Expression.get("property")),
- PropertyFactory.iconImage("zoo-15")
- );
- mapboxMap.getStyle().addLayer(layer);
-
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng)).isEmpty());
- }, mapboxMap));
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java
deleted file mode 100644
index 607d7cd635..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.geometry;
-
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
-import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxHighlightActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import org.junit.Test;
-
-import static junit.framework.Assert.assertEquals;
-
-/**
- * Instrumentation test to validate integration of LatLngBounds
- */
-public class LatLngBoundsTest extends BaseTest {
-
- private static final double MAP_BEARING = 50;
-
- @Override
- protected Class getActivityClass() {
- return QueryRenderedFeaturesBoxHighlightActivity.class;
- }
-
- @Test
- public void testLatLngBounds() {
- // regression test for #9322
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLngBounds bounds = new LatLngBounds.Builder()
- .include(new LatLng(48.8589506, 2.2773457))
- .include(new LatLng(47.2383171, -1.6309316))
- .build();
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
- });
- }
-
- @Test
- public void testLatLngBoundsBearing() {
- // regression test for #12549
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLngBounds bounds = new LatLngBounds.Builder()
- .include(new LatLng(48.8589506, 2.2773457))
- .include(new LatLng(47.2383171, -1.6309316))
- .build();
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
- mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(MAP_BEARING));
- assertEquals(
- "Initial bearing should match for latlngbounds",
- mapboxMap.getCameraPosition().bearing,
- MAP_BEARING,
- TestConstants.BEARING_DELTA
- );
-
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
- assertEquals("Bearing should match after resetting latlngbounds",
- mapboxMap.getCameraPosition().bearing,
- MAP_BEARING,
- TestConstants.BEARING_DELTA);
- });
- }
-
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt
deleted file mode 100644
index dd046f0189..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt
+++ /dev/null
@@ -1,155 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps
-
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.maps.MapView
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.testapp.R
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity
-import java.util.concurrent.CountDownLatch
-import java.util.concurrent.TimeUnit
-import java.util.concurrent.TimeoutException
-import junit.framework.Assert.assertEquals
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class ImageMissingTest : AppCenter() {
-
- @Rule
- @JvmField
- var rule = ActivityTestRule(EspressoTestActivity::class.java)
-
- private lateinit var mapView: MapView
- private lateinit var latch: CountDownLatch
-
- @Before
- fun setup() {
- latch = CountDownLatch(1)
- }
-
- @Test
- fun testMissingImage() {
- rule.runOnUiThread {
- initMap(styleJson).addOnStyleImageMissingListener {
- assertEquals("missing-icon", it)
- latch.countDown()
- }
- }
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- throw TimeoutException()
- }
- }
-
- @Test
- fun testMissingImage_invalidSprite() {
- rule.runOnUiThread {
- initMap(styleJsonInvalidSprite).addOnStyleImageMissingListener {
- assertEquals("missing-icon", it)
- latch.countDown()
- }
- }
-
- if (!latch.await(10, TimeUnit.SECONDS)) {
- throw TimeoutException()
- }
- }
-
- private fun initMap(style: String): MapView {
- mapView = rule.activity.findViewById(R.id.mapView)
- mapView.getMapAsync { it.setStyle(Style.Builder().fromJson(style)) }
- return mapView
- }
-
- companion object {
- private const val styleJson = """
- {
- "version": 8,
- "name": "Mapbox Streets",
- "sprite": "mapbox://sprites/mapbox/streets-v8",
- "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
- "sources": {
- "point": {
- "type": "geojson",
- "data": {
- "type": "Feature",
- "properties": {},
- "geometry": {
- "type": "Point",
- "coordinates": [0, 0]
- }
- }
- }
- },
- "layers": [{
- "id": "bg",
- "type": "background",
- "paint": {
- "background-color": "#f00"
- }
- }, {
- "id": "point",
- "type": "circle",
- "source": "point",
- "paint": {
- "circle-radius": 100
- }
- }, {
- "id": "icon",
- "type": "symbol",
- "source": "point",
- "layout": {
- "icon-image": "missing-icon"
- }
- }]
- }
- """
-
- private const val styleJsonInvalidSprite = """
- {
- "version": 8,
- "name": "Mapbox Streets",
- "sprite": "asset://sprites/mapbox/invalid",
- "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
- "sources": {
- "point": {
- "type": "geojson",
- "data": {
- "type": "Feature",
- "properties": {},
- "geometry": {
- "type": "Point",
- "coordinates": [0, 0]
- }
- }
- }
- },
- "layers": [{
- "id": "bg",
- "type": "background",
- "paint": {
- "background-color": "#f00"
- }
- }, {
- "id": "point",
- "type": "circle",
- "source": "point",
- "paint": {
- "circle-radius": 100
- }
- }, {
- "id": "icon",
- "type": "symbol",
- "source": "point",
- "layout": {
- "icon-image": "missing-icon"
- }
- }]
- }
- """
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt
deleted file mode 100644
index d586a7e2d1..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt
+++ /dev/null
@@ -1,163 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps
-
-import android.graphics.Bitmap
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.maps.MapView
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.testapp.R
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity
-import java.util.concurrent.CountDownLatch
-import java.util.concurrent.TimeUnit
-import java.util.concurrent.TimeoutException
-import org.junit.Assert.*
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class RemoveUnusedImagesTest : AppCenter() {
-
- @Rule
- @JvmField
- var rule = ActivityTestRule(EspressoTestActivity::class.java)
-
- private lateinit var mapView: MapView
- private lateinit var mapboxMap: MapboxMap
- private val latch = CountDownLatch(1)
-
- @Before
- fun setup() {
- rule.runOnUiThread {
- mapView = rule.activity.findViewById(R.id.mapView)
- mapView.getMapAsync {
- mapboxMap = it
- mapboxMap.setStyle(Style.Builder().fromJson(styleJson))
- }
- }
- }
-
- @Test
- fun testRemoveUnusedImagesUserProvidedListener() {
- var callbackLatch = CountDownLatch(2)
- rule.runOnUiThread {
- mapView.addOnStyleImageMissingListener {
- mapboxMap.style!!.addImage(it, Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888))
- }
-
- // Remove layer and source, so that rendered tiles are no longer used, therefore, map must
- // notify client about unused images.
- mapView.addOnDidBecomeIdleListener {
- mapboxMap.style!!.removeLayer("icon")
- mapboxMap.style!!.removeSource("geojson")
- }
-
- mapView.addOnCanRemoveUnusedStyleImageListener {
- callbackLatch.countDown()
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 120.0), 8.0))
- mapView.addOnDidFinishRenderingFrameListener {
- assertNotNull(mapboxMap.style!!.getImage("small"))
- assertNotNull(mapboxMap.style!!.getImage("large"))
- latch.countDown()
- }
- return@addOnCanRemoveUnusedStyleImageListener false
- }
- }
-
- if (!latch.await(5, TimeUnit.SECONDS) && !callbackLatch.await(5, TimeUnit.SECONDS)) {
- throw TimeoutException()
- }
- }
-
- @Test
- fun testRemoveUnusedImagesDefaultListener() {
- rule.runOnUiThread {
- mapView.addOnStyleImageMissingListener {
- mapboxMap.style!!.addImage(it, Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888))
- }
-
- // Remove layer and source, so that rendered tiles are no longer used, thus
- // map must request removal of unused images.
- mapView.addOnDidBecomeIdleListener {
- mapboxMap.style!!.removeLayer("icon")
- mapboxMap.style!!.removeSource("geojson")
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 120.0), 8.0))
-
- // Wait for the next frame and check that images were removed from the style.
- mapView.addOnDidFinishRenderingFrameListener {
- if (mapboxMap.style!!.getImage("small") == null && mapboxMap.style!!.getImage("large") == null) {
- latch.countDown()
- }
- }
- }
- }
-
- if (!latch.await(5, TimeUnit.SECONDS)) {
- throw TimeoutException()
- }
- }
-
- companion object {
- private const val styleJson = """
- {
- "version": 8,
- "name": "Mapbox Streets",
- "sources": {
- "geojson": {
- "type": "geojson",
- "data": {
- "type": "FeatureCollection",
- "features": [
- {
- "type": "Feature",
- "properties": {
- "image": "small"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 0,
- 0
- ]
- }
- },
- {
- "type": "Feature",
- "properties": {
- "image": "large"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 1,
- 1
- ]
- }
- }
- ]
- }
- }
- },
- "layers": [{
- "id": "bg",
- "type": "background",
- "paint": {
- "background-color": "#f00"
- }
- },{
- "id": "icon",
- "type": "symbol",
- "source": "geojson",
- "layout": {
- "icon-image": ["get", "image"]
- }
- }]
- }
- """
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt
deleted file mode 100644
index 951750f354..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps
-
-import android.support.test.espresso.UiController
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.style.layers.SymbolLayer
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
-import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class StyleLoadTest : EspressoTest() {
-
- @Test
- fun updateSourceAfterStyleLoad() {
- validateTestSetup()
- MapboxMapAction.invoke(mapboxMap) { uiController: UiController, mapboxMap: MapboxMap ->
- val source = GeoJsonSource("id")
- val layer = SymbolLayer("id", "id")
- mapboxMap.setStyle(Style.Builder().withSource(source).withLayer(layer))
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- mapboxMap.setStyle(Style.Builder().fromUrl(Style.MAPBOX_STREETS))
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- source.setGeoJson("{}")
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java
deleted file mode 100644
index ca5c9adc1f..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps.widgets;
-
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Build;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.support.test.espresso.intent.Intents;
-import android.text.Html;
-import android.text.SpannableStringBuilder;
-import android.text.TextUtils;
-import android.text.style.URLSpan;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.sources.Source;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-
-import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onData;
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.action.ViewActions.click;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.intent.Intents.intended;
-import static android.support.test.espresso.intent.Intents.intending;
-import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
-import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData;
-import static android.support.test.espresso.matcher.RootMatchers.isDialog;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static org.hamcrest.CoreMatchers.allOf;
-import static org.hamcrest.CoreMatchers.anything;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assume.assumeTrue;
-
-public class AttributionTest extends EspressoTest {
-
- private URLSpan[] urlSpans;
-
- @Before
- public void beforeTest() {
- super.beforeTest();
- Intents.init();
- }
-
- @Test
- public void testDisabled() {
- validateTestSetup();
-
- // Default
- onView(withId(R.id.attributionView)).check(matches(isDisplayed()));
-
- // Disabled
- onView(withId(R.id.attributionView))
- .perform(new DisableAction(mapboxMap))
- .check(matches(not(isDisplayed())));
- }
-
- @Test
- @Ignore
- public void testMapboxStreetsMapboxAttributionLink() {
- validateTestSetup();
- if (urlSpans == null) {
- buildUrlSpans();
- }
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
-
- // test for trigger url intent
- Matcher<Intent> expectedIntent = allOf(hasAction(Intent.ACTION_VIEW), hasData(Uri.parse(urlSpans[0].getURL())));
- intending(expectedIntent).respondWith(new Instrumentation.ActivityResult(0, null));
-
- // click item and test for url
- onData(anything()).inAdapterView(withId(R.id.select_dialog_listview)).atPosition(0).perform(click());
- intended(expectedIntent);
- }
-
- @Test
- @Ignore
- public void testMapboxStreetsOpenStreetMapAttributionLink() {
- validateTestSetup();
- if (urlSpans == null) {
- buildUrlSpans();
- }
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
-
- // test for trigger url intent
- Matcher<Intent> expectedIntent = allOf(hasAction(Intent.ACTION_VIEW), hasData(Uri.parse(urlSpans[1].getURL())));
- intending(expectedIntent).respondWith(new Instrumentation.ActivityResult(0, null));
-
- // click item and test for url
- onData(anything()).inAdapterView(withId(R.id.select_dialog_listview)).atPosition(1).perform(click());
- intended(expectedIntent);
- }
-
- @Test
- @Ignore
- public void testImproveMapLink() {
- validateTestSetup();
- if (urlSpans == null) {
- buildUrlSpans();
- }
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
-
- // test for trigger url intent
- Matcher<Intent> expectedIntent = hasAction(Intent.ACTION_VIEW);
- intending(expectedIntent).respondWith(new Instrumentation.ActivityResult(0, null));
-
- // click item and test for url
- onData(anything()).inAdapterView(withId(R.id.select_dialog_listview)).atPosition(2).perform(click());
- intended(expectedIntent);
- }
-
- @Test
- public void testTelemetryDialog() {
- assumeTrue(
- "Can only run on API Level 23 or newer because of instability",
- Build.VERSION.SDK_INT >= 23
- );
-
- validateTestSetup();
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).inRoot(isDialog()).check(matches(isDisplayed()));
-
- // click on item to open second dialog
- onView(withText(R.string.mapbox_telemetrySettings)).inRoot(isDialog()).perform(click());
- onView(withText(R.string.mapbox_attributionTelemetryTitle)).inRoot(isDialog()).check(matches(isDisplayed()));
- }
-
- @After
- public void afterTest() {
- super.afterTest();
- Intents.release();
- }
-
- private void buildUrlSpans() {
- onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
- for (Source source : mapboxMap.getStyle().getSources()) {
- String attributionSource = source.getAttribution();
- if (!TextUtils.isEmpty(attributionSource)) {
- SpannableStringBuilder htmlBuilder = (SpannableStringBuilder) Html.fromHtml(attributionSource);
- urlSpans = htmlBuilder.getSpans(0, htmlBuilder.length(), URLSpan.class);
- }
- }
- }));
- }
-
- private class DisableAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- DisableAction(MapboxMap map) {
- mapboxMap = map;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.getUiSettings().setAttributionEnabled(false);
- }
- }
-
- private class MapboxMapAction implements ViewAction {
-
- private InvokeViewAction invokeViewAction;
-
- MapboxMapAction(InvokeViewAction invokeViewAction) {
- this.invokeViewAction = invokeViewAction;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- invokeViewAction.onViewAction(uiController, view);
- }
- }
-
- interface InvokeViewAction {
- void onViewAction(UiController uiController, View view);
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java
deleted file mode 100644
index 8b62ee7612..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps.widgets;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.action.WaitAction;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.action.ViewActions.click;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertEquals;
-
-public class CompassViewTest extends EspressoTest {
-
- @Test
- public void testDefault() {
- validateTestSetup();
- onView(withId(R.id.compassView)).check(matches(not(isDisplayed())));
- }
-
- @Test
- @Ignore
- public void testVisible() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .bearing(45)
- .zoom(1)
- .target(new LatLng())
- .build()
- ));
- uiController.loopMainThreadForAtLeast(500);
- });
- onView(withId(R.id.compassView)).check(matches(isDisplayed()));
- }
-
- @Test
- @Ignore
- public void testClick() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .bearing(45)
- .zoom(1)
- .target(new LatLng())
- .build()
- )));
- onView(withId(R.id.compassView)).perform(click());
- WaitAction.invoke(500);
- onView(withId(R.id.compassView)).check(matches(not(isDisplayed())));
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Camera bearing should face north, ", 0, cameraPosition.bearing, TestConstants.BEARING_DELTA);
- });
- }
-}
-
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java
deleted file mode 100644
index 677ad6caa5..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps.widgets;
-
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-
-import org.hamcrest.Matcher;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.hamcrest.Matchers.not;
-
-public class LogoTest extends EspressoTest {
-
- @Test
- public void testDefault() {
- validateTestSetup();
- onView(withId(R.id.logoView)).check(matches(isDisplayed()));
- }
-
- @Test
- public void testDisabled() {
- validateTestSetup();
-
- onView(withId(R.id.logoView))
- .perform(new DisableAction(mapboxMap))
- .check(matches(not(isDisplayed())));
- }
-
- private class DisableAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- DisableAction(MapboxMap map) {
- mapboxMap = map;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.getUiSettings().setLogoEnabled(false);
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt
deleted file mode 100644
index da4cfbaf01..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.offline
-
-import android.content.Context
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.offline.OfflineManager
-import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
-import java.util.concurrent.CountDownLatch
-import org.junit.Assert
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class CacheTest {
-
- @Rule
- @JvmField
- var rule = ActivityTestRule(FeatureOverviewActivity::class.java)
-
- private val context: Context by lazy { rule.activity }
-
- private val countDownLatch = CountDownLatch(1)
-
- @Test
- fun testSetMaximumAmbientCacheSize() {
- rule.activity.runOnUiThread {
- OfflineManager.getInstance(context).setMaximumAmbientCacheSize(10000000, object : OfflineManager.FileSourceCallback {
- override fun onSuccess() {
- countDownLatch.countDown()
- }
-
- override fun onError(message: String) {
- Assert.assertNull("onError should not be called", message)
- }
- })
- }
- countDownLatch.await()
- }
-
- @Test
- fun testSetClearAmbientCache() {
- rule.activity.runOnUiThread {
- OfflineManager.getInstance(context).clearAmbientCache(object : OfflineManager.FileSourceCallback {
- override fun onSuccess() {
- countDownLatch.countDown()
- }
-
- override fun onError(message: String) {
- Assert.assertNull("onError should not be called", message)
- }
- })
- }
- countDownLatch.await()
- }
-
- @Test
- fun testSetInvalidateAmbientCache() {
- rule.activity.runOnUiThread {
- OfflineManager.getInstance(context).invalidateAmbientCache(object : OfflineManager.FileSourceCallback {
- override fun onSuccess() {
- countDownLatch.countDown()
- }
-
- override fun onError(message: String) {
- Assert.assertNull("onError should not be called", message)
- }
- })
- }
- countDownLatch.await()
- }
-
- @Test
- fun testSetResetDatabase() {
- rule.activity.runOnUiThread {
- OfflineManager.getInstance(context).resetDatabase(object : OfflineManager.FileSourceCallback {
- override fun onSuccess() {
- countDownLatch.countDown()
- }
-
- override fun onError(message: String) {
- Assert.assertNull("onError should not be called", message)
- }
- })
- }
- countDownLatch.await()
- }
-
- @Test
- fun testSetPackDatabase() {
- rule.activity.runOnUiThread {
- OfflineManager.getInstance(context).packDatabase(object : OfflineManager.FileSourceCallback {
- override fun onSuccess() {
- countDownLatch.countDown()
- }
-
- override fun onError(message: String) {
- Assert.assertNull("onError should not be called", message)
- }
- })
- }
- countDownLatch.await()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt
deleted file mode 100644
index e07dc1e9f1..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.offline
-
-import android.content.Context
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.offline.OfflineManager
-import com.mapbox.mapboxsdk.offline.OfflineRegion
-import com.mapbox.mapboxsdk.storage.FileSource
-import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
-import com.mapbox.mapboxsdk.testapp.utils.FileUtils
-import java.io.IOException
-import java.util.concurrent.CountDownLatch
-import org.junit.FixMethodOrder
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.MethodSorters
-
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-@RunWith(AndroidJUnit4::class)
-class OfflineManagerTest : AppCenter() {
-
- companion object {
- private const val TEST_DB_FILE_NAME = "offline_test.db"
- private lateinit var mergedRegion: OfflineRegion
- }
-
- @Rule
- @JvmField
- var rule = ActivityTestRule(FeatureOverviewActivity::class.java)
-
- private val context: Context by lazy { rule.activity }
-
- @Test(timeout = 30_000)
- fun a_copyFileFromAssets() {
- val latch = CountDownLatch(1)
- rule.activity.runOnUiThread {
- FileUtils.CopyFileFromAssetsTask(rule.activity, object : FileUtils.OnFileCopiedFromAssetsListener {
- override fun onFileCopiedFromAssets() {
- latch.countDown()
- }
-
- override fun onError() {
- throw IOException("Unable to copy DB file.")
- }
- }).execute(TEST_DB_FILE_NAME, FileSource.getResourcesCachePath(rule.activity))
- }
- latch.await()
- }
-
- @Test(timeout = 30_000)
- fun b_mergeRegion() {
- val latch = CountDownLatch(1)
- rule.activity.runOnUiThread {
- OfflineManager.getInstance(context).mergeOfflineRegions(
- FileSource.getResourcesCachePath(rule.activity) + "/" + TEST_DB_FILE_NAME,
- object : OfflineManager.MergeOfflineRegionsCallback {
- override fun onMerge(offlineRegions: Array<out OfflineRegion>?) {
- assert(offlineRegions?.size == 1)
- latch.countDown()
- }
-
- override fun onError(error: String?) {
- throw RuntimeException("Unable to merge external offline database. $error")
- }
- })
- }
- latch.await()
- }
-
- @Test(timeout = 30_000)
- fun c_listRegion() {
- val latch = CountDownLatch(1)
- rule.activity.runOnUiThread {
- OfflineManager.getInstance(context).listOfflineRegions(object : OfflineManager.ListOfflineRegionsCallback {
- override fun onList(offlineRegions: Array<out OfflineRegion>?) {
- assert(offlineRegions?.size == 1)
- mergedRegion = offlineRegions!![0]
- latch.countDown()
- }
-
- override fun onError(error: String?) {
- throw RuntimeException("Unable to merge external offline database. $error")
- }
- })
- }
- latch.await()
- }
-
- @Test(timeout = 30_000)
- fun d_invalidateRegion() {
- val latch = CountDownLatch(1)
- rule.activity.runOnUiThread {
- mergedRegion.invalidate(object : OfflineRegion.OfflineRegionInvalidateCallback {
- override fun onInvalidate() {
- latch.countDown()
- }
-
- override fun onError(error: String?) {
- throw RuntimeException("Unable to delete region")
- }
- })
- }
- latch.await()
- }
-
- @Test(timeout = 30_000)
- fun e_deleteRegion() {
- val latch = CountDownLatch(1)
- rule.activity.runOnUiThread {
- mergedRegion.delete(object : OfflineRegion.OfflineRegionDeleteCallback {
- override fun onDelete() {
- latch.countDown()
- }
-
- override fun onError(error: String?) {
- throw RuntimeException("Unable to delete region")
- }
- })
- }
- latch.await()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java
deleted file mode 100644
index 48eb8e832d..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.offline;
-
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.AppCenter;
-import com.mapbox.mapboxsdk.testapp.utils.OfflineUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-
-import static com.mapbox.mapboxsdk.testapp.activity.offline.OfflineActivity.JSON_CHARSET;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.TestCase.assertTrue;
-
-@RunWith(AndroidJUnit4.class)
-public class OfflineUtilsTest extends AppCenter {
-
- private static final String REGION_NAME = "hello world";
- private static final String CONVERTED_REGION_NAME = "{\"FIELD_REGION_NAME\":\"hello world\"}";
-
- @Test
- public void testOfflineUtilsConvertToBytes() throws UnsupportedEncodingException {
- byte[] expected = CONVERTED_REGION_NAME.getBytes(JSON_CHARSET);
- byte[] actual = OfflineUtils.convertRegionName(REGION_NAME);
- assertTrue("Bytes arrays should match", Arrays.equals(expected, actual));
- }
-
- @Test
- public void testOfflineUtilsConvertToString() throws UnsupportedEncodingException {
- String actual = OfflineUtils.convertRegionName(CONVERTED_REGION_NAME.getBytes(JSON_CHARSET));
- assertEquals("Strings should match", REGION_NAME, actual);
- }
-
- @Test
- public void testOfflineUtilsConvertNoOp() {
- String convertNoOp = OfflineUtils.convertRegionName(OfflineUtils.convertRegionName(REGION_NAME));
- assertEquals("Strings should match", REGION_NAME, convertNoOp);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java
deleted file mode 100644
index c74e110b6c..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.render;
-
-import android.Manifest;
-import android.support.test.espresso.IdlingPolicies;
-import android.support.test.espresso.IdlingRegistry;
-import android.support.test.espresso.IdlingResourceTimeoutException;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.rule.GrantPermissionRule;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.AppCenter;
-import com.mapbox.mapboxsdk.testapp.activity.render.RenderTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.SnapshotterIdlingResource;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import timber.log.Timber;
-
-import java.util.concurrent.TimeUnit;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-
-/**
- * Instrumentation render tests
- */
-@RunWith(AndroidJUnit4.class)
-public class RenderTest extends AppCenter {
-
- private static final int RENDER_TEST_TIMEOUT = 30;
- private SnapshotterIdlingResource idlingResource;
-
- @Rule
- public ActivityTestRule<RenderTestActivity> activityRule = new ActivityTestRule<>(RenderTestActivity.class);
-
- @Rule
- public GrantPermissionRule writeRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);
-
- @Rule
- public GrantPermissionRule readRule = GrantPermissionRule.grant(Manifest.permission.READ_EXTERNAL_STORAGE);
-
- @Before
- public void beforeTest() {
- IdlingPolicies.setMasterPolicyTimeout(RENDER_TEST_TIMEOUT, TimeUnit.MINUTES);
- setupIdlingResource();
- }
-
- private void setupIdlingResource() {
- try {
- Timber.e("@Before test: register idle resource");
- IdlingPolicies.setIdlingResourceTimeout(RENDER_TEST_TIMEOUT, TimeUnit.MINUTES);
- IdlingRegistry.getInstance().register(idlingResource = new SnapshotterIdlingResource(activityRule.getActivity()));
- } catch (IdlingResourceTimeoutException idlingResourceTimeoutException) {
- throw new RuntimeException("Idling out!");
- }
- }
-
- @Test
- @Ignore
- public void testRender() {
- onView(withId(android.R.id.content)).check(matches(isDisplayed()));
- }
-
- @After
- public void afterTest() {
- Timber.e("@After test: unregister idle resource");
- IdlingRegistry.getInstance().unregister(idlingResource);
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt
deleted file mode 100644
index d08507470e..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.storage
-
-import android.support.test.annotation.UiThreadTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.storage.FileSource
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity
-import java.util.concurrent.CountDownLatch
-import junit.framework.Assert
-import org.junit.After
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.rules.TestName
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-open class FileSourceMapTest : AppCenter() {
-
- private lateinit var fileSourceTestUtils: FileSourceTestUtils
-
- @get:Rule
- val rule = ActivityTestRule(EspressoTestActivity::class.java)
-
- @get:Rule
- val testName = TestName()
-
- @Before
- @UiThreadTest
- fun setup() {
- fileSourceTestUtils = FileSourceTestUtils(rule.activity)
- fileSourceTestUtils.setup()
- }
-
- @Test
- fun changeResourcesPathWhileMapVisible() {
- val latch = CountDownLatch(1)
- rule.activity.runOnUiThread {
- FileSource.setResourcesCachePath(fileSourceTestUtils.testPath, object : FileSource.ResourcesCachePathChangeCallback {
- override fun onSuccess(path: String) {
- Assert.fail("Requested resources change while the map is running should fail")
- }
-
- override fun onError(message: String) {
- Assert.assertEquals("Cannot set path, file source is activated." +
- " Make sure that the map or a resources download is not running.", message)
- latch.countDown()
- }
- })
- }
- latch.await()
- }
-
- @After
- fun cleanup() {
- fileSourceTestUtils.cleanup()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt
deleted file mode 100644
index 59f0d04237..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.storage
-
-import android.support.test.annotation.UiThreadTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.storage.FileSource
-import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
-import java.util.concurrent.CountDownLatch
-import java.util.concurrent.TimeUnit
-import org.junit.*
-import org.junit.rules.TestName
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class FileSourceStandaloneTest : AppCenter() {
-
- private lateinit var fileSourceTestUtils: FileSourceTestUtils
- private lateinit var fileSource: FileSource
-
- @get:Rule
- val rule = ActivityTestRule(FeatureOverviewActivity::class.java)
-
- @get:Rule
- val testName = TestName()
-
- @Before
- @UiThreadTest
- fun setup() {
- fileSource = FileSource.getInstance(rule.activity)
- fileSourceTestUtils = FileSourceTestUtils(rule.activity)
- fileSourceTestUtils.setup()
- }
-
- @Test
- @UiThreadTest
- fun testDefault() {
- Assert.assertFalse("FileSource should not be active", fileSource.isActivated)
- }
-
- @Test
- @UiThreadTest
- fun testActivateDeactivate() {
- Assert.assertFalse("1) FileSource should not be active", fileSource.isActivated)
- fileSource.activate()
- Assert.assertTrue("2) FileSource should be active", fileSource.isActivated)
- fileSource.deactivate()
- Assert.assertFalse("3) FileSource should not be active", fileSource.isActivated)
- }
-
- @Test
- fun pathChangeTest() {
- Assert.assertFalse("FileSource should not be active", fileSource.isActivated)
- Assert.assertEquals(fileSourceTestUtils.originalPath, FileSource.getResourcesCachePath(rule.activity))
-
- fileSourceTestUtils.changePath(fileSourceTestUtils.testPath)
- Assert.assertEquals(fileSourceTestUtils.testPath, FileSource.getResourcesCachePath(rule.activity))
-
- fileSourceTestUtils.changePath(fileSourceTestUtils.originalPath)
- Assert.assertEquals(fileSourceTestUtils.originalPath, FileSource.getResourcesCachePath(rule.activity))
- }
-
- @Test
- fun overridePathChangeCallTest() {
- val firstLatch = CountDownLatch(1)
- val secondLatch = CountDownLatch(1)
- rule.activity.runOnUiThread {
- FileSource.setResourcesCachePath(
- fileSourceTestUtils.testPath,
- object : FileSource.ResourcesCachePathChangeCallback {
- override fun onSuccess(path: String) {
- Assert.assertEquals(fileSourceTestUtils.testPath, path)
- firstLatch.countDown()
- }
-
- override fun onError(message: String) {
- Assert.fail("First attempt should succeed.")
- }
- })
-
- FileSource.setResourcesCachePath(
- fileSourceTestUtils.testPath2,
- object : FileSource.ResourcesCachePathChangeCallback {
- override fun onSuccess(path: String) {
- Assert.fail("Second attempt should fail because first one is in progress.")
- }
-
- override fun onError(message: String) {
- Assert.assertEquals("Another resources cache path change is in progress", message)
- secondLatch.countDown()
- }
- })
- }
-
- if (!secondLatch.await(5, TimeUnit.SECONDS)) {
- rule.runOnUiThread {
- // if we fail to call a callback, the file source is not going to be deactivated
- fileSource.deactivate()
- }
- Assert.fail("Second attempt should fail.")
- }
-
- if (!firstLatch.await(5, TimeUnit.SECONDS)) {
- rule.runOnUiThread {
- // if we fail to call a callback, the file source is not going to be deactivated
- fileSource.deactivate()
- }
- Assert.fail("First attempt should succeed.")
- }
- }
-
- @After
- fun cleanup() {
- fileSourceTestUtils.cleanup()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt
deleted file mode 100644
index 6bd97056a6..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.storage
-
-import android.app.Activity
-import android.support.annotation.WorkerThread
-import com.mapbox.mapboxsdk.AppCenter
-import com.mapbox.mapboxsdk.storage.FileSource
-import java.io.File
-import java.util.concurrent.CountDownLatch
-import junit.framework.Assert
-
-class FileSourceTestUtils(private val activity: Activity) : AppCenter() {
- val originalPath = FileSource.getResourcesCachePath(activity)
- val testPath = "$originalPath/test"
- val testPath2 = "$originalPath/test2"
-
- private val paths = listOf(testPath, testPath2)
-
- fun setup() {
- for (path in paths) {
- val testFile = File(path)
- testFile.mkdirs()
- }
- }
-
- @WorkerThread
- fun cleanup() {
- val currentPath = FileSource.getResourcesCachePath(activity)
- if (currentPath != originalPath) {
- changePath(originalPath)
- }
-
- for (path in paths) {
- val testFile = File(path)
- if (testFile.exists()) {
- testFile.deleteRecursively()
- }
- }
- }
-
- @WorkerThread
- fun changePath(requestedPath: String) {
- val latch = CountDownLatch(1)
- activity.runOnUiThread {
- FileSource.setResourcesCachePath(
- requestedPath,
- object : FileSource.ResourcesCachePathChangeCallback {
- override fun onSuccess(path: String) {
- Assert.assertEquals(requestedPath, path)
- latch.countDown()
- }
-
- override fun onError(message: String) {
- Assert.fail("Resource path change failed - path: $requestedPath, message: $message")
- }
- })
- }
- latch.await()
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/string/UppperLowerCaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/string/UppperLowerCaseTest.java
deleted file mode 100644
index 0ef8051a3f..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/string/UppperLowerCaseTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.string;
-
-import android.support.test.runner.AndroidJUnit4;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static junit.framework.Assert.assertEquals;
-
-/**
- * Test verifying if String#toUpperCase and String#toLowerCase produces desired results
- * <p>
- * See core test in https://github.com/mapbox/mapbox-gl-native/blob/master/test/util/text_conversions.test.cpp
- * </p>
- */
-@RunWith(AndroidJUnit4.class)
-public class UppperLowerCaseTest extends EspressoTest {
-
- @Test
- public void testToUpperCase() {
- assertEquals("STREET", "strEEt".toUpperCase()); // EN
- assertEquals("ROAD", "rOAd".toUpperCase()); // EN
-
- assertEquals("STRASSE", "straße".toUpperCase()); // DE
- assertEquals("MASSE", "maße".toUpperCase()); // DE
- assertEquals("WEISSKOPFSEEADLER", "weißkopfseeadler".toUpperCase()); // DE
-
- assertEquals("BÊNÇÃO", "bênção".toUpperCase()); // PT
- assertEquals("AZƏRBAYCAN", "Azərbaycan".toUpperCase()); // AZ
- assertEquals("ὈΔΥΣΣΕΎΣ", "Ὀδυσσεύς".toUpperCase()); // GR
- }
-
- @Test
- public void testToLowerCase() {
- assertEquals("street", "strEEt".toLowerCase()); // EN
- assertEquals("road", "rOAd".toLowerCase()); // EN
-
- assertEquals("straße", "Straße".toLowerCase()); // DE
- assertEquals("strasse", "STRASSE".toLowerCase()); // DE
- assertEquals("masse", "MASSE".toLowerCase()); // DE
- assertEquals("weisskopfseeadler", "weiSSkopfseeadler".toLowerCase()); // DE
-
- assertEquals("bênção", "BÊNÇÃO".toLowerCase()); // PT
- assertEquals("azərbaycan", "AZƏRBAYCAN".toLowerCase()); //
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
deleted file mode 100644
index d3edfb852d..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.BackgroundLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for BackgroundLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class BackgroundLayerTest extends BaseLayerTest {
-
- private BackgroundLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new BackgroundLayer("my-layer");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testBackgroundColorTransition() {
- Timber.i("background-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setBackgroundColorTransition(options);
- assertEquals(layer.getBackgroundColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testBackgroundColorAsConstant() {
- Timber.i("background-color");
- assertNotNull(layer);
- assertNull(layer.getBackgroundColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(backgroundColor(propertyValue));
- assertEquals(layer.getBackgroundColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testBackgroundColorAsIntConstant() {
- Timber.i("background-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(backgroundColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getBackgroundColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testBackgroundPatternTransition() {
- Timber.i("background-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setBackgroundPatternTransition(options);
- assertEquals(layer.getBackgroundPatternTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testBackgroundPatternAsConstant() {
- Timber.i("background-pattern");
- assertNotNull(layer);
- assertNull(layer.getBackgroundPattern().getValue());
-
- // Set and Get
- String propertyValue = "pedestrian-polygon";
- layer.setProperties(backgroundPattern(propertyValue));
- assertEquals(layer.getBackgroundPattern().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testBackgroundOpacityTransition() {
- Timber.i("background-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setBackgroundOpacityTransition(options);
- assertEquals(layer.getBackgroundOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testBackgroundOpacityAsConstant() {
- Timber.i("background-opacity");
- assertNotNull(layer);
- assertNull(layer.getBackgroundOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(backgroundOpacity(propertyValue));
- assertEquals(layer.getBackgroundOpacity().getValue(), propertyValue);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
deleted file mode 100644
index 146cfc2209..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
+++ /dev/null
@@ -1,453 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.CircleLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for CircleLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class CircleLayerTest extends BaseLayerTest {
-
- private CircleLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new CircleLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testSourceLayer() {
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- @UiThreadTest
- public void testFilter() {
- Timber.i("Filter");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getFilter(), null);
-
- // Set
- Expression filter = eq(get("undefined"), literal(1.0));
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
-
- // Set constant
- filter = literal(true);
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
- }
-
-
-
- @Test
- @UiThreadTest
- public void testCircleRadiusTransition() {
- Timber.i("circle-radiusTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleRadiusTransition(options);
- assertEquals(layer.getCircleRadiusTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleRadiusAsConstant() {
- Timber.i("circle-radius");
- assertNotNull(layer);
- assertNull(layer.getCircleRadius().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(circleRadius(propertyValue));
- assertEquals(layer.getCircleRadius().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleRadiusAsExpression() {
- Timber.i("circle-radius-expression");
- assertNotNull(layer);
- assertNull(layer.getCircleRadius().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(circleRadius(expression));
- assertEquals(layer.getCircleRadius().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testCircleColorTransition() {
- Timber.i("circle-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleColorTransition(options);
- assertEquals(layer.getCircleColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleColorAsConstant() {
- Timber.i("circle-color");
- assertNotNull(layer);
- assertNull(layer.getCircleColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(circleColor(propertyValue));
- assertEquals(layer.getCircleColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleColorAsExpression() {
- Timber.i("circle-color-expression");
- assertNotNull(layer);
- assertNull(layer.getCircleColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(circleColor(expression));
- assertEquals(layer.getCircleColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testCircleColorAsIntConstant() {
- Timber.i("circle-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getCircleColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testCircleBlurTransition() {
- Timber.i("circle-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleBlurTransition(options);
- assertEquals(layer.getCircleBlurTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleBlurAsConstant() {
- Timber.i("circle-blur");
- assertNotNull(layer);
- assertNull(layer.getCircleBlur().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(circleBlur(propertyValue));
- assertEquals(layer.getCircleBlur().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleBlurAsExpression() {
- Timber.i("circle-blur-expression");
- assertNotNull(layer);
- assertNull(layer.getCircleBlur().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(circleBlur(expression));
- assertEquals(layer.getCircleBlur().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testCircleOpacityTransition() {
- Timber.i("circle-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleOpacityTransition(options);
- assertEquals(layer.getCircleOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleOpacityAsConstant() {
- Timber.i("circle-opacity");
- assertNotNull(layer);
- assertNull(layer.getCircleOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(circleOpacity(propertyValue));
- assertEquals(layer.getCircleOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleOpacityAsExpression() {
- Timber.i("circle-opacity-expression");
- assertNotNull(layer);
- assertNull(layer.getCircleOpacity().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(circleOpacity(expression));
- assertEquals(layer.getCircleOpacity().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testCircleTranslateTransition() {
- Timber.i("circle-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleTranslateTransition(options);
- assertEquals(layer.getCircleTranslateTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleTranslateAsConstant() {
- Timber.i("circle-translate");
- assertNotNull(layer);
- assertNull(layer.getCircleTranslate().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(circleTranslate(propertyValue));
- assertEquals(layer.getCircleTranslate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleTranslateAnchorAsConstant() {
- Timber.i("circle-translate-anchor");
- assertNotNull(layer);
- assertNull(layer.getCircleTranslateAnchor().getValue());
-
- // Set and Get
- String propertyValue = CIRCLE_TRANSLATE_ANCHOR_MAP;
- layer.setProperties(circleTranslateAnchor(propertyValue));
- assertEquals(layer.getCircleTranslateAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCirclePitchScaleAsConstant() {
- Timber.i("circle-pitch-scale");
- assertNotNull(layer);
- assertNull(layer.getCirclePitchScale().getValue());
-
- // Set and Get
- String propertyValue = CIRCLE_PITCH_SCALE_MAP;
- layer.setProperties(circlePitchScale(propertyValue));
- assertEquals(layer.getCirclePitchScale().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCirclePitchAlignmentAsConstant() {
- Timber.i("circle-pitch-alignment");
- assertNotNull(layer);
- assertNull(layer.getCirclePitchAlignment().getValue());
-
- // Set and Get
- String propertyValue = CIRCLE_PITCH_ALIGNMENT_MAP;
- layer.setProperties(circlePitchAlignment(propertyValue));
- assertEquals(layer.getCirclePitchAlignment().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeWidthTransition() {
- Timber.i("circle-stroke-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleStrokeWidthTransition(options);
- assertEquals(layer.getCircleStrokeWidthTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeWidthAsConstant() {
- Timber.i("circle-stroke-width");
- assertNotNull(layer);
- assertNull(layer.getCircleStrokeWidth().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(circleStrokeWidth(propertyValue));
- assertEquals(layer.getCircleStrokeWidth().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeWidthAsExpression() {
- Timber.i("circle-stroke-width-expression");
- assertNotNull(layer);
- assertNull(layer.getCircleStrokeWidth().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(circleStrokeWidth(expression));
- assertEquals(layer.getCircleStrokeWidth().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeColorTransition() {
- Timber.i("circle-stroke-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleStrokeColorTransition(options);
- assertEquals(layer.getCircleStrokeColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeColorAsConstant() {
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
- assertNull(layer.getCircleStrokeColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(circleStrokeColor(propertyValue));
- assertEquals(layer.getCircleStrokeColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeColorAsExpression() {
- Timber.i("circle-stroke-color-expression");
- assertNotNull(layer);
- assertNull(layer.getCircleStrokeColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(circleStrokeColor(expression));
- assertEquals(layer.getCircleStrokeColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeColorAsIntConstant() {
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleStrokeColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getCircleStrokeColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeOpacityTransition() {
- Timber.i("circle-stroke-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleStrokeOpacityTransition(options);
- assertEquals(layer.getCircleStrokeOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeOpacityAsConstant() {
- Timber.i("circle-stroke-opacity");
- assertNotNull(layer);
- assertNull(layer.getCircleStrokeOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(circleStrokeOpacity(propertyValue));
- assertEquals(layer.getCircleStrokeOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testCircleStrokeOpacityAsExpression() {
- Timber.i("circle-stroke-opacity-expression");
- assertNotNull(layer);
- assertNull(layer.getCircleStrokeOpacity().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(circleStrokeOpacity(expression));
- assertEquals(layer.getCircleStrokeOpacity().getExpression(), expression);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt
deleted file mode 100644
index 9c2eb3df81..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style
-
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.matcher.ViewMatchers.isRoot
-import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.THREAD_POOL_LIMIT
-import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.THREAD_PREFIX
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke
-import com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationLandscape
-import com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationPortrait
-import com.mapbox.mapboxsdk.testapp.action.WaitAction
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest
-import com.mapbox.mapboxsdk.testapp.activity.style.GridSourceActivity
-import com.mapbox.mapboxsdk.testapp.activity.style.GridSourceActivity.ID_GRID_LAYER
-import com.mapbox.mapboxsdk.testapp.activity.style.GridSourceActivity.ID_GRID_SOURCE
-import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils
-import org.junit.Assert
-import org.junit.Test
-
-class CustomGeometrySourceTest : BaseTest() {
-
- override fun getActivityClass(): Class<*> = GridSourceActivity::class.java
-
- @Test
- fun sourceNotLeakingThreadsTest() {
- validateTestSetup()
- WaitAction.invoke(4000)
- onView(isRoot()).perform(orientationLandscape())
- WaitAction.invoke(2000)
- onView(isRoot()).perform(orientationPortrait())
- WaitAction.invoke(2000)
- Assert.assertFalse("Threads should be shutdown when the source is destroyed.",
- Thread.getAllStackTraces().keys.filter {
- it.name.startsWith(THREAD_PREFIX)
- }.count() > THREAD_POOL_LIMIT)
- }
-
- @Test
- fun threadsShutdownWhenSourceRemovedTest() {
- validateTestSetup()
- invoke(mapboxMap) { uiController, mapboxMap ->
- mapboxMap.style!!.removeLayer(ID_GRID_LAYER)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- mapboxMap.style!!.removeSource(ID_GRID_SOURCE)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- Assert.assertTrue("There should be no threads running when the source is removed.",
- Thread.getAllStackTraces().keys.filter {
- it.name.startsWith(THREAD_PREFIX)
- }.count() == 0)
- }
- }
-
- @Test
- fun threadsRestartedWhenSourceReAddedTest() {
- validateTestSetup()
- invoke(mapboxMap) { uiController, mapboxMap ->
- mapboxMap.style!!.removeLayer((rule.activity as GridSourceActivity).layer)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- mapboxMap.style!!.removeSource(ID_GRID_SOURCE)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- mapboxMap.style!!.addSource((rule.activity as GridSourceActivity).source)
- mapboxMap.style!!.addLayer((rule.activity as GridSourceActivity).layer)
- TestingAsyncUtils.waitForLayer(uiController, mapView)
- Assert.assertTrue("Threads should be restarted when the source is re-added to the map.",
- Thread.getAllStackTraces().keys.filter {
- it.name.startsWith(THREAD_PREFIX)
- }.count() == THREAD_POOL_LIMIT)
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
deleted file mode 100644
index 95bd651cff..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
+++ /dev/null
@@ -1,786 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.geojson.Feature;
-import com.mapbox.geojson.Point;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.CircleLayer;
-import com.mapbox.mapboxsdk.style.layers.FillLayer;
-import com.mapbox.mapboxsdk.style.layers.Layer;
-import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
-import com.mapbox.mapboxsdk.style.sources.Source;
-import com.mapbox.mapboxsdk.style.types.Formatted;
-import com.mapbox.mapboxsdk.style.types.FormattedSection;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
-import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils;
-import com.mapbox.mapboxsdk.utils.ColorUtils;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-import timber.log.Timber;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.FormatOption.formatFontScale;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.FormatOption.formatTextColor;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.FormatOption.formatTextFont;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.NumberFormatOption.currency;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.NumberFormatOption.locale;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.NumberFormatOption.maxFractionDigits;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.NumberFormatOption.minFractionDigits;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.collator;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.color;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.exponential;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.format;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.formatEntry;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.interpolate;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.match;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.number;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.numberFormat;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.rgb;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.rgba;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.step;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.stop;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.string;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.switchCase;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.toColor;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.zoom;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillAntialias;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillColor;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillOutlineColor;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textColor;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textField;
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-@RunWith(AndroidJUnit4.class)
-public class ExpressionTest extends EspressoTest {
-
- private FillLayer layer;
-
- @Test
- public void testConstantExpressionConversion() {
- validateTestSetup();
- setupStyle();
- Timber.i("camera function");
-
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- // create color expression
- Expression inputExpression = rgba(255.0f, 0.0f, 0.0f, 1.0f);
-
- // set color expression
- layer.setProperties(
- fillColor(inputExpression)
- );
-
- // get color value
- int color = layer.getFillColor().getColorInt();
-
- // compare
- assertEquals("input expression should match", Color.RED, color);
- });
- }
-
- @Test
- public void testGetExpressionWrapping() {
- validateTestSetup();
- setupStyle();
- Timber.i("camera function");
-
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- // create get expression
- Expression inputExpression = get("fill");
-
- // set get expression
- layer.setProperties(
- fillColor(inputExpression)
- );
-
- // get actual expression
- Expression actualExpression = layer.getFillColor().getExpression();
-
- // create wrapped expected expression
- Expression expectedExpression = toColor(get("fill"));
-
- // compare
- assertEquals("input expression should match", expectedExpression, actualExpression);
- });
- }
-
- @Test
- public void testCameraFunction() {
- validateTestSetup();
- setupStyle();
- Timber.i("camera function");
-
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- // create camera function expression
- Expression inputExpression = interpolate(
- exponential(0.5f), zoom(),
- stop(1.0f, rgba(255.0f, 0.0f, 0.0f, 1.0f)),
- stop(5.0f, rgba(0.0f, 0.0f, 255.0f, 1.0f)),
- stop(10.0f, rgba(0.0f, 255.0f, 0.0f, 1.0f))
- );
-
- // set camera function expression
- layer.setProperties(
- fillColor(inputExpression)
- );
-
- // get camera function expression
- Expression outputExpression = layer.getFillColor().getExpression();
-
- // compare
- assertEquals("input expression should match", inputExpression, outputExpression);
- });
- }
-
- @Test
- public void testSourceFunction() {
- validateTestSetup();
- setupStyle();
- Timber.i("camera function");
-
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- // create camera function expression
- Expression inputExpression = toColor(get("fill"));
-
- // set camera function expression
- layer.setProperties(
- fillColor(inputExpression)
- );
-
- // get camera function expression
- Expression outputExpression = layer.getFillColor().getExpression();
-
- // compare
- assertEquals("input expression should match", inputExpression, outputExpression);
- });
- }
-
- @Test
- public void testCompositeFunction() {
- validateTestSetup();
- setupStyle();
- Timber.i("camera function");
-
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- // create camera function expression
- Expression inputExpression = step(zoom(),
- rgba(255.0f, 255.0f, 255.0f, 1.0f),
- stop(7.0f, match(
- string(get("name")),
- literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
- rgba(255.0f, 255.0f, 255.0f, 1.0f)
- )),
- stop(8.0f, match(
- string(get("name")),
- literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
- rgba(255.0f, 255.0f, 255.0f, 1.0f)
- ))
- );
-
- // set camera function expression
- layer.setProperties(
- fillColor(inputExpression)
- );
-
- // get camera function expression
- Expression outputExpression = layer.getFillColor().getExpression();
-
- // compare
- assertEquals("input expression should match", inputExpression, outputExpression);
- });
- }
-
- @Test
- public void testLiteralProperty() {
- validateTestSetup();
- setupStyle();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- layer.setProperties(
- fillColor(literal("#4286f4"))
- );
- });
- }
-
- @Test
- public void testLiteralMatchExpression() {
- validateTestSetup();
- setupStyle();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- Expression expression = match(literal("something"), literal(0f),
- stop("1", get("1")),
- stop("2", get("2")),
- stop("3", get("3")),
- stop("4", get("4"))
- );
-
- layer.setProperties(
- fillColor(expression)
- );
- expression.toArray();
- });
- }
-
- @Test
- public void testCollatorExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
-
- Expression expression1 = eq(literal("Łukasz"), literal("lukasz"), collator(true, true));
- Expression expression2 = eq(literal("Łukasz"), literal("lukasz"), collator(literal(false), eq(literal(1),
- literal(1)), literal("en")));
- Expression expression3 = eq(literal("Łukasz"), literal("lukasz"), collator(literal(false), eq(literal(2),
- literal(1))));
-
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- Layer layer = new CircleLayer("layer", "source")
- .withProperties(circleColor(
- switchCase(
- expression1, literal(ColorUtils.colorToRgbaString(Color.GREEN)),
- literal(ColorUtils.colorToRgbaString(Color.RED))
- )
- ));
- mapboxMap.getStyle().addLayer(layer);
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
-
- layer.setProperties(circleColor(
- switchCase(
- expression2, literal(ColorUtils.colorToRgbaString(Color.GREEN)),
- literal(ColorUtils.colorToRgbaString(Color.RED))
- )
- ));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
-
- layer.setProperties(circleColor(
- switchCase(
- expression3, literal(ColorUtils.colorToRgbaString(Color.GREEN)),
- literal(ColorUtils.colorToRgbaString(Color.RED))
- )
- ));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
- });
- }
-
- @Test
- public void testConstFormatExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry("test")
- );
- layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
- assertNull(layer.getTextField().getExpression());
- assertEquals(new Formatted(new FormattedSection("test")), layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testConstFormatExpressionFontScaleParam() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry("test", formatFontScale(1.75))
- );
- layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
- assertNull(layer.getTextField().getExpression());
- assertEquals(new Formatted(new FormattedSection("test", 1.75)), layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testConstFormatExpressionTextFontParam() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry(
- literal("test"),
- formatTextFont(new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"})
- )
- );
- layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(
- mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals(new Formatted(
- new FormattedSection("test",
- new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"})
- ), layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testConstFormatExpressionTextColorParam() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry(
- literal("test"),
- formatTextColor(literal("yellow"))
- )
- );
- layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(
- mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals(new Formatted(
- new FormattedSection("test", null, null, "rgba(255,255,0,1)")
- ), layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testConstFormatExpressionAllParams() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry(
- "test",
- formatFontScale(0.5),
- formatTextFont(new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"}),
- formatTextColor(rgb(126, 0, 0))
- )
- );
- layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(
- mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals(new Formatted(
- new FormattedSection("test",
- 0.5,
- new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"},
- "rgba(126,0,0,1)")
- ), layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testConstFormatExpressionMultipleInputs() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry(
- "test",
- formatFontScale(1.5),
- formatTextFont(new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"})
- ),
- formatEntry("\ntest2", formatFontScale(2), formatTextColor(Color.BLUE)),
- formatEntry("\ntest3", formatFontScale(2.5), formatTextColor(toColor(literal("rgba(0, 128, 255, 0.5)"))))
- );
- layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(
- mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals(new Formatted(
- new FormattedSection("test", 1.5,
- new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"}),
- new FormattedSection("\ntest2", 2.0, null, "rgba(0,0,255,1)"),
- new FormattedSection("\ntest3", 2.5, null, "rgba(0,128,255,0.5)")
- ), layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testVariableFormatExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
- feature.addStringProperty("test_property", "test");
- feature.addNumberProperty("test_property_number", 1.5);
- feature.addStringProperty("test_property_color", "green");
- mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry(
- get("test_property"),
- Expression.FormatOption.formatFontScale(number(get("test_property_number"))),
- formatTextFont(new String[] {"Arial Unicode MS Regular", "DIN Offc Pro Regular"}),
- formatTextColor(toColor(get("test_property_color")))
- )
- );
- layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
- assertEquals(expression, layer.getTextField().getExpression());
- assertNull(layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testVariableFormatExpressionMultipleInputs() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
- feature.addStringProperty("test_property", "test");
- feature.addNumberProperty("test_property_number", 1.5);
- feature.addStringProperty("test_property_color", "rgba(0, 255, 0, 1)");
- mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression expression = format(
- formatEntry(
- get("test_property"),
- formatFontScale(1.25),
- formatTextFont(new String[] {"Arial Unicode MS Regular", "DIN Offc Pro Regular"}),
- formatTextColor(toColor(get("test_property_color")))
- ),
- formatEntry("\ntest2", formatFontScale(2))
- );
- layer.setProperties(textField(expression), textColor("rgba(128, 0, 0, 1)"));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
- assertEquals(expression, layer.getTextField().getExpression());
- assertNull(layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testFormatExpressionPlainTextCoercion() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- layer.setProperties(textField("test"));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
- assertNull(layer.getTextField().getExpression());
- assertEquals(new Formatted(
- new FormattedSection("test")), layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testTextFieldFormattedArgument() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Formatted formatted = new Formatted(
- new FormattedSection("test", 1.5),
- new FormattedSection("\ntest", 0.5, new String[] {"Arial Unicode MS Regular", "DIN Offc Pro Regular"}),
- new FormattedSection("test", null, null, "rgba(0,255,0,1)")
- );
- layer.setProperties(textField(formatted), textColor("rgba(128,0,0,1)"));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
- .isEmpty());
- assertNull(layer.getTextField().getExpression());
- assertEquals(formatted, layer.getTextField().getValue());
- });
- }
-
- @Test
- public void testNumberFormatCurrencyExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- layer.setProperties(
- textField(
- numberFormat(12.345, locale("en-US"), currency("USD"))
- )
- );
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(
- mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals("$12.35", layer.getTextField().getValue().getFormattedSections()[0].getText());
- });
- }
-
- @Test
- public void testNumberFormatMaxExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- layer.setProperties(
- textField(
- numberFormat(12.34567890, maxFractionDigits(5), minFractionDigits(0))
- )
- );
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(
- mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals("12.34568", layer.getTextField().getValue().getFormattedSections()[0].getText());
- });
- }
-
- @Test
- public void testNumberFormatMinExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- layer.setProperties(
- textField(
- numberFormat(12.0000001, maxFractionDigits(5), minFractionDigits(0))
- )
- );
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(
- mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals("12", layer.getTextField().getValue().getFormattedSections()[0].getText());
- });
- }
-
- @Test
- public void testNumberFormatLocaleExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle()
- .addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- layer.setProperties(
- textField(
- numberFormat(12.0000001, locale("nl-BE"), maxFractionDigits(5), minFractionDigits(1))
- )
- );
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(
- mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
- assertNull(layer.getTextField().getExpression());
- assertEquals("12,0", layer.getTextField().getValue().getFormattedSections()[0].getText());
- });
- }
-
- @Test
- public void testNumberFormatNonConstantExpression() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
- feature.addNumberProperty("number_value", 12.345678);
- feature.addStringProperty("locale_value", "nl-BE");
- feature.addNumberProperty("max_value", 5);
- feature.addNumberProperty("min_value", 1);
-
-
- mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
- SymbolLayer layer = new SymbolLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression numberFormatExpression = numberFormat(
- number(number(get("number_value"))),
- locale(string(get("locale_value"))),
- maxFractionDigits(number(get("max_value"))),
- minFractionDigits(number(get("min_value")))
- );
-
- layer.setProperties(textField(numberFormatExpression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
-
- assertFalse(mapboxMap.queryRenderedFeatures(
- mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
- );
-
- assertNotNull(layer.getTextField().getExpression());
-
- // Expressions evaluated to string are wrapped by a format expression, take array index 1 to get original
- Object[] returnExpression = (Object[]) layer.getTextField().getExpression().toArray()[1];
- Object[] setExpression = numberFormatExpression.toArray();
- assertEquals("Number format should match",returnExpression[0], setExpression[0]);
- assertArrayEquals("Get value expression should match",
- (Object[]) returnExpression[1],
- (Object[]) setExpression[1]
- );
-
- // number format objects
- HashMap<String, Object> returnMap = (HashMap<String, Object>) returnExpression[2];
- HashMap<String, Object> setMap = (HashMap<String, Object>) returnExpression[2];
-
- assertArrayEquals("Number format min fraction digits should match ",
- (Object[]) returnMap.get("min-fraction-digits"),
- (Object[]) setMap.get("min-fraction-digits")
- );
-
- assertArrayEquals("Number format max fraction digits should match ",
- (Object[]) returnMap.get("max-fraction-digits"),
- (Object[]) setMap.get("max-fraction-digits")
- );
-
- assertArrayEquals("Number format min fraction digits should match ",
- (Object[]) returnMap.get("locale"),
- (Object[]) setMap.get("locale")
- );
- });
-
- }
-
- /**
- * Regression test for #15532
- */
- @Test
- public void testDoubleConversion() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- LatLng latLng = new LatLng(51, 17);
- mapboxMap.getStyle().addSource(
- new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()))
- );
-
- CircleLayer layer = new CircleLayer("layer", "source");
- mapboxMap.getStyle().addLayer(layer);
-
- Expression input = interpolate(
- exponential(0.5f), zoom(),
- stop(-0.1, color(Color.RED)),
- stop(0, color(Color.BLUE))
- );
-
- layer.setProperties(circleColor(input));
-
- Expression output = layer.getCircleColor().getExpression();
- assertArrayEquals("Expression should match", input.toArray(), output.toArray());
- });
- }
-
- private void setupStyle() {
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- // Add a source
- Source source;
- try {
- source = new GeoJsonSource("amsterdam-parks-source",
- ResourceUtils.readRawResource(rule.getActivity(), R.raw.amsterdam));
- mapboxMap.getStyle().addSource(source);
- } catch (IOException ioException) {
- return;
- }
-
- // Add a fill layer
- mapboxMap.getStyle().addLayer(layer = new FillLayer("amsterdam-parks-layer", source.getId())
- .withProperties(
- fillColor(rgba(0.0f, 0.0f, 0.0f, 0.5f)),
- fillOutlineColor(rgb(0, 0, 255)),
- fillAntialias(true)
- )
- );
- });
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java
deleted file mode 100644
index 4b936a4c92..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java
+++ /dev/null
@@ -1,340 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for FillExtrusionLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class FillExtrusionLayerTest extends BaseLayerTest {
-
- private FillExtrusionLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new FillExtrusionLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testSourceLayer() {
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- @UiThreadTest
- public void testFilter() {
- Timber.i("Filter");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getFilter(), null);
-
- // Set
- Expression filter = eq(get("undefined"), literal(1.0));
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
-
- // Set constant
- filter = literal(true);
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
- }
-
-
-
- @Test
- @UiThreadTest
- public void testFillExtrusionOpacityTransition() {
- Timber.i("fill-extrusion-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionOpacityTransition(options);
- assertEquals(layer.getFillExtrusionOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionOpacityAsConstant() {
- Timber.i("fill-extrusion-opacity");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(fillExtrusionOpacity(propertyValue));
- assertEquals(layer.getFillExtrusionOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionColorTransition() {
- Timber.i("fill-extrusion-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionColorTransition(options);
- assertEquals(layer.getFillExtrusionColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionColorAsConstant() {
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(fillExtrusionColor(propertyValue));
- assertEquals(layer.getFillExtrusionColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionColorAsExpression() {
- Timber.i("fill-extrusion-color-expression");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(fillExtrusionColor(expression));
- assertEquals(layer.getFillExtrusionColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionColorAsIntConstant() {
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getFillExtrusionColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionTranslateTransition() {
- Timber.i("fill-extrusion-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionTranslateTransition(options);
- assertEquals(layer.getFillExtrusionTranslateTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionTranslateAsConstant() {
- Timber.i("fill-extrusion-translate");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionTranslate().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(fillExtrusionTranslate(propertyValue));
- assertEquals(layer.getFillExtrusionTranslate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionTranslateAnchorAsConstant() {
- Timber.i("fill-extrusion-translate-anchor");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionTranslateAnchor().getValue());
-
- // Set and Get
- String propertyValue = FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP;
- layer.setProperties(fillExtrusionTranslateAnchor(propertyValue));
- assertEquals(layer.getFillExtrusionTranslateAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionPatternTransition() {
- Timber.i("fill-extrusion-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionPatternTransition(options);
- assertEquals(layer.getFillExtrusionPatternTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionPatternAsConstant() {
- Timber.i("fill-extrusion-pattern");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionPattern().getValue());
-
- // Set and Get
- String propertyValue = "pedestrian-polygon";
- layer.setProperties(fillExtrusionPattern(propertyValue));
- assertEquals(layer.getFillExtrusionPattern().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionPatternAsExpression() {
- Timber.i("fill-extrusion-pattern-expression");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionPattern().getExpression());
-
- // Set and Get
- Expression expression = image(string(Expression.get("undefined")));
- layer.setProperties(fillExtrusionPattern(expression));
- assertEquals(layer.getFillExtrusionPattern().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionHeightTransition() {
- Timber.i("fill-extrusion-heightTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionHeightTransition(options);
- assertEquals(layer.getFillExtrusionHeightTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionHeightAsConstant() {
- Timber.i("fill-extrusion-height");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionHeight().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(fillExtrusionHeight(propertyValue));
- assertEquals(layer.getFillExtrusionHeight().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionHeightAsExpression() {
- Timber.i("fill-extrusion-height-expression");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionHeight().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(fillExtrusionHeight(expression));
- assertEquals(layer.getFillExtrusionHeight().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionBaseTransition() {
- Timber.i("fill-extrusion-baseTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionBaseTransition(options);
- assertEquals(layer.getFillExtrusionBaseTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionBaseAsConstant() {
- Timber.i("fill-extrusion-base");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionBase().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(fillExtrusionBase(propertyValue));
- assertEquals(layer.getFillExtrusionBase().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionBaseAsExpression() {
- Timber.i("fill-extrusion-base-expression");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionBase().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(fillExtrusionBase(expression));
- assertEquals(layer.getFillExtrusionBase().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testFillExtrusionVerticalGradientAsConstant() {
- Timber.i("fill-extrusion-vertical-gradient");
- assertNotNull(layer);
- assertNull(layer.getFillExtrusionVerticalGradient().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(fillExtrusionVerticalGradient(propertyValue));
- assertEquals(layer.getFillExtrusionVerticalGradient().getValue(), propertyValue);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
deleted file mode 100644
index 4e9dddc0a6..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
+++ /dev/null
@@ -1,326 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.FillLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for FillLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class FillLayerTest extends BaseLayerTest {
-
- private FillLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new FillLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testSourceLayer() {
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- @UiThreadTest
- public void testFilter() {
- Timber.i("Filter");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getFilter(), null);
-
- // Set
- Expression filter = eq(get("undefined"), literal(1.0));
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
-
- // Set constant
- filter = literal(true);
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
- }
-
-
-
- @Test
- @UiThreadTest
- public void testFillAntialiasAsConstant() {
- Timber.i("fill-antialias");
- assertNotNull(layer);
- assertNull(layer.getFillAntialias().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(fillAntialias(propertyValue));
- assertEquals(layer.getFillAntialias().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillOpacityTransition() {
- Timber.i("fill-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillOpacityTransition(options);
- assertEquals(layer.getFillOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillOpacityAsConstant() {
- Timber.i("fill-opacity");
- assertNotNull(layer);
- assertNull(layer.getFillOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(fillOpacity(propertyValue));
- assertEquals(layer.getFillOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillOpacityAsExpression() {
- Timber.i("fill-opacity-expression");
- assertNotNull(layer);
- assertNull(layer.getFillOpacity().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(fillOpacity(expression));
- assertEquals(layer.getFillOpacity().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testFillColorTransition() {
- Timber.i("fill-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillColorTransition(options);
- assertEquals(layer.getFillColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillColorAsConstant() {
- Timber.i("fill-color");
- assertNotNull(layer);
- assertNull(layer.getFillColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(fillColor(propertyValue));
- assertEquals(layer.getFillColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillColorAsExpression() {
- Timber.i("fill-color-expression");
- assertNotNull(layer);
- assertNull(layer.getFillColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(fillColor(expression));
- assertEquals(layer.getFillColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testFillColorAsIntConstant() {
- Timber.i("fill-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getFillColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testFillOutlineColorTransition() {
- Timber.i("fill-outline-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillOutlineColorTransition(options);
- assertEquals(layer.getFillOutlineColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillOutlineColorAsConstant() {
- Timber.i("fill-outline-color");
- assertNotNull(layer);
- assertNull(layer.getFillOutlineColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(fillOutlineColor(propertyValue));
- assertEquals(layer.getFillOutlineColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillOutlineColorAsExpression() {
- Timber.i("fill-outline-color-expression");
- assertNotNull(layer);
- assertNull(layer.getFillOutlineColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(fillOutlineColor(expression));
- assertEquals(layer.getFillOutlineColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testFillOutlineColorAsIntConstant() {
- Timber.i("fill-outline-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillOutlineColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getFillOutlineColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testFillTranslateTransition() {
- Timber.i("fill-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillTranslateTransition(options);
- assertEquals(layer.getFillTranslateTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillTranslateAsConstant() {
- Timber.i("fill-translate");
- assertNotNull(layer);
- assertNull(layer.getFillTranslate().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(fillTranslate(propertyValue));
- assertEquals(layer.getFillTranslate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillTranslateAnchorAsConstant() {
- Timber.i("fill-translate-anchor");
- assertNotNull(layer);
- assertNull(layer.getFillTranslateAnchor().getValue());
-
- // Set and Get
- String propertyValue = FILL_TRANSLATE_ANCHOR_MAP;
- layer.setProperties(fillTranslateAnchor(propertyValue));
- assertEquals(layer.getFillTranslateAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillPatternTransition() {
- Timber.i("fill-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillPatternTransition(options);
- assertEquals(layer.getFillPatternTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testFillPatternAsConstant() {
- Timber.i("fill-pattern");
- assertNotNull(layer);
- assertNull(layer.getFillPattern().getValue());
-
- // Set and Get
- String propertyValue = "pedestrian-polygon";
- layer.setProperties(fillPattern(propertyValue));
- assertEquals(layer.getFillPattern().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testFillPatternAsExpression() {
- Timber.i("fill-pattern-expression");
- assertNotNull(layer);
- assertNull(layer.getFillPattern().getExpression());
-
- // Set and Get
- Expression expression = image(string(Expression.get("undefined")));
- layer.setProperties(fillPattern(expression));
- assertEquals(layer.getFillPattern().getExpression(), expression);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
deleted file mode 100644
index 61086e1344..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.support.annotation.RawRes;
-import android.support.test.espresso.ViewAction;
-import android.support.test.runner.AndroidJUnit4;
-import android.view.View;
-
-import com.mapbox.geojson.Feature;
-import com.mapbox.geojson.FeatureCollection;
-import com.mapbox.geojson.Point;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.style.layers.CircleLayer;
-import com.mapbox.mapboxsdk.style.layers.Layer;
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
-import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils;
-
-import org.hamcrest.Matcher;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import timber.log.Timber;
-
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for {@link GeoJsonSource}
- */
-@RunWith(AndroidJUnit4.class)
-public class GeoJsonSourceTests extends EspressoTest {
-
- @Test
- public void testFeatureCollection() {
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- GeoJsonSource source = null;
- try {
- source = new GeoJsonSource("source", FeatureCollection
- .fromJson(ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_collection)));
- } catch (IOException exception) {
- Timber.e(exception);
- }
- mapboxMap.getStyle().addSource(source);
- mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
- });
- }
-
- @Test
- public void testPointGeometry() {
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- GeoJsonSource source = new GeoJsonSource("source", Point.fromLngLat(0d, 0d));
- mapboxMap.getStyle().addSource(source);
- mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
- });
- }
-
- @Test
- public void testFeatureProperties() {
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- GeoJsonSource source = null;
- try {
- source = new GeoJsonSource("source",
- ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_properties));
- } catch (IOException exception) {
- Timber.e(exception);
- }
- mapboxMap.getStyle().addSource(source);
- mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
- });
- }
-
- @Test
- public void testUpdateCoalescing() {
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- GeoJsonSource source = new GeoJsonSource("source");
- mapboxMap.getStyle().addSource(source);
- mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
-
- source.setGeoJson(Point.fromLngLat(0, 0));
- source.setGeoJson(Point.fromLngLat(-25, -25));
- try {
- source.setGeoJson(ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_properties));
- } catch (IOException exception) {
- Timber.e(exception);
- }
-
- source.setGeoJson(Point.fromLngLat(20, 55));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
- assertEquals(1, mapboxMap.queryRenderedFeatures(
- mapboxMap.getProjection().toScreenLocation(
- new LatLng(55, 20)), "layer").size());
- });
- }
-
- @Test
- public void testClearCollectionDuringConversion() {
- // https://github.com/mapbox/mapbox-gl-native/issues/14565
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- for (int j = 0; j < 1000; j++) {
- List<Feature> features = new ArrayList<>();
- for (int i = 0; i < 100; i++) {
- features.add(Feature.fromGeometry(Point.fromLngLat(0, 0)));
- }
- mapboxMap.getStyle().addSource(new GeoJsonSource("source" + j, FeatureCollection.fromFeatures(features)));
- features.clear();
- }
- });
- }
-
- @Test
- public void testPointFeature() {
- testFeatureFromResource(R.raw.test_point_feature);
- }
-
- @Test
- public void testLineStringFeature() {
- testFeatureFromResource(R.raw.test_line_string_feature);
- }
-
- @Test
- public void testPolygonFeature() {
- testFeatureFromResource(R.raw.test_polygon_feature);
- }
-
- @Test
- public void testPolygonWithHoleFeature() {
- testFeatureFromResource(R.raw.test_polygon_with_hole_feature);
- }
-
- @Test
- public void testMultiPointFeature() {
- testFeatureFromResource(R.raw.test_multi_point_feature);
- }
-
- @Test
- public void testMultiLineStringFeature() {
- testFeatureFromResource(R.raw.test_multi_line_string_feature);
- }
-
- @Test
- public void testMultiPolygonFeature() {
- testFeatureFromResource(R.raw.test_multi_polygon_feature);
- }
-
- protected void testFeatureFromResource(final @RawRes int resource) {
- validateTestSetup();
- MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
- GeoJsonSource source = new GeoJsonSource("source");
- mapboxMap.getStyle().addSource(source);
- Layer layer = new CircleLayer("layer", source.getId());
- mapboxMap.getStyle().addLayer(layer);
-
- try {
- source.setGeoJson(Feature.fromJson(ResourceUtils.readRawResource(rule.getActivity(), resource)));
- } catch (IOException exception) {
- Timber.e(exception);
- }
-
- mapboxMap.getStyle().removeLayer(layer);
- mapboxMap.getStyle().removeSource(source);
- });
- }
-
- public abstract class BaseViewAction implements ViewAction {
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java
deleted file mode 100644
index 21a17723db..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java
+++ /dev/null
@@ -1,215 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.HeatmapLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for HeatmapLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class HeatmapLayerTest extends BaseLayerTest {
-
- private HeatmapLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new HeatmapLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testSourceLayer() {
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- @UiThreadTest
- public void testFilter() {
- Timber.i("Filter");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getFilter(), null);
-
- // Set
- Expression filter = eq(get("undefined"), literal(1.0));
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
-
- // Set constant
- filter = literal(true);
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
- }
-
-
-
- @Test
- @UiThreadTest
- public void testHeatmapRadiusTransition() {
- Timber.i("heatmap-radiusTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setHeatmapRadiusTransition(options);
- assertEquals(layer.getHeatmapRadiusTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapRadiusAsConstant() {
- Timber.i("heatmap-radius");
- assertNotNull(layer);
- assertNull(layer.getHeatmapRadius().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(heatmapRadius(propertyValue));
- assertEquals(layer.getHeatmapRadius().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapRadiusAsExpression() {
- Timber.i("heatmap-radius-expression");
- assertNotNull(layer);
- assertNull(layer.getHeatmapRadius().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(heatmapRadius(expression));
- assertEquals(layer.getHeatmapRadius().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapWeightAsConstant() {
- Timber.i("heatmap-weight");
- assertNotNull(layer);
- assertNull(layer.getHeatmapWeight().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(heatmapWeight(propertyValue));
- assertEquals(layer.getHeatmapWeight().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapWeightAsExpression() {
- Timber.i("heatmap-weight-expression");
- assertNotNull(layer);
- assertNull(layer.getHeatmapWeight().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(heatmapWeight(expression));
- assertEquals(layer.getHeatmapWeight().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapIntensityTransition() {
- Timber.i("heatmap-intensityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setHeatmapIntensityTransition(options);
- assertEquals(layer.getHeatmapIntensityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapIntensityAsConstant() {
- Timber.i("heatmap-intensity");
- assertNotNull(layer);
- assertNull(layer.getHeatmapIntensity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(heatmapIntensity(propertyValue));
- assertEquals(layer.getHeatmapIntensity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapOpacityTransition() {
- Timber.i("heatmap-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setHeatmapOpacityTransition(options);
- assertEquals(layer.getHeatmapOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testHeatmapOpacityAsConstant() {
- Timber.i("heatmap-opacity");
- assertNotNull(layer);
- assertNull(layer.getHeatmapOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(heatmapOpacity(propertyValue));
- assertEquals(layer.getHeatmapOpacity().getValue(), propertyValue);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java
deleted file mode 100644
index 694348b888..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java
+++ /dev/null
@@ -1,223 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.HillshadeLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for HillshadeLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class HillshadeLayerTest extends BaseLayerTest {
-
- private HillshadeLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new HillshadeLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeIlluminationDirectionAsConstant() {
- Timber.i("hillshade-illumination-direction");
- assertNotNull(layer);
- assertNull(layer.getHillshadeIlluminationDirection().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(hillshadeIlluminationDirection(propertyValue));
- assertEquals(layer.getHillshadeIlluminationDirection().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeIlluminationAnchorAsConstant() {
- Timber.i("hillshade-illumination-anchor");
- assertNotNull(layer);
- assertNull(layer.getHillshadeIlluminationAnchor().getValue());
-
- // Set and Get
- String propertyValue = HILLSHADE_ILLUMINATION_ANCHOR_MAP;
- layer.setProperties(hillshadeIlluminationAnchor(propertyValue));
- assertEquals(layer.getHillshadeIlluminationAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeExaggerationTransition() {
- Timber.i("hillshade-exaggerationTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setHillshadeExaggerationTransition(options);
- assertEquals(layer.getHillshadeExaggerationTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeExaggerationAsConstant() {
- Timber.i("hillshade-exaggeration");
- assertNotNull(layer);
- assertNull(layer.getHillshadeExaggeration().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(hillshadeExaggeration(propertyValue));
- assertEquals(layer.getHillshadeExaggeration().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeShadowColorTransition() {
- Timber.i("hillshade-shadow-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setHillshadeShadowColorTransition(options);
- assertEquals(layer.getHillshadeShadowColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeShadowColorAsConstant() {
- Timber.i("hillshade-shadow-color");
- assertNotNull(layer);
- assertNull(layer.getHillshadeShadowColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(hillshadeShadowColor(propertyValue));
- assertEquals(layer.getHillshadeShadowColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeShadowColorAsIntConstant() {
- Timber.i("hillshade-shadow-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(hillshadeShadowColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getHillshadeShadowColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeHighlightColorTransition() {
- Timber.i("hillshade-highlight-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setHillshadeHighlightColorTransition(options);
- assertEquals(layer.getHillshadeHighlightColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeHighlightColorAsConstant() {
- Timber.i("hillshade-highlight-color");
- assertNotNull(layer);
- assertNull(layer.getHillshadeHighlightColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(hillshadeHighlightColor(propertyValue));
- assertEquals(layer.getHillshadeHighlightColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeHighlightColorAsIntConstant() {
- Timber.i("hillshade-highlight-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(hillshadeHighlightColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getHillshadeHighlightColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeAccentColorTransition() {
- Timber.i("hillshade-accent-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setHillshadeAccentColorTransition(options);
- assertEquals(layer.getHillshadeAccentColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeAccentColorAsConstant() {
- Timber.i("hillshade-accent-color");
- assertNotNull(layer);
- assertNull(layer.getHillshadeAccentColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(hillshadeAccentColor(propertyValue));
- assertEquals(layer.getHillshadeAccentColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testHillshadeAccentColorAsIntConstant() {
- Timber.i("hillshade-accent-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(hillshadeAccentColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getHillshadeAccentColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt
deleted file mode 100644
index eb45ab52c6..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style
-
-import android.graphics.Bitmap
-import android.graphics.drawable.BitmapDrawable
-import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.R
-import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
-import java.util.*
-import org.junit.Assert.assertNull
-import org.junit.Assert.assertTrue
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * CRUD tests around Image
- */
-@RunWith(AndroidJUnit4::class)
-class ImageTest : EspressoTest() {
-
- companion object {
- private const val IMAGE_ID = "test.image"
- }
-
- @Test
- fun testAddGetImage() {
- validateTestSetup()
- MapboxMapAction.invoke(mapboxMap) { uiController, mapboxMap ->
- val drawable = rule.activity.resources.getDrawable(R.drawable.ic_launcher_round)
- assertTrue(drawable is BitmapDrawable)
-
- val bitmapSet = (drawable as BitmapDrawable).bitmap
- mapboxMap.style!!.addImage(IMAGE_ID, bitmapSet)
-
- // adding an image requires converting the image with an asynctask
- uiController.loopMainThreadForAtLeast(200)
-
- val bitmapGet = mapboxMap.style!!.getImage(IMAGE_ID)
- assertTrue(bitmapGet!!.similarTo(bitmapSet))
-
- mapboxMap.style!!.removeImage(IMAGE_ID)
- assertNull(mapboxMap.style!!.getImage(IMAGE_ID))
- }
- }
-}
-
-/**
- * Alternative implementation of Bitmap.sameAs #14060
- */
-fun Bitmap.similarTo(other: Bitmap): Boolean {
- if (invalidConfig(other)) {
- return false
- }
-
- // Allocate arrays
- val argb = IntArray(width * height)
- val argbOther = IntArray(other.width * other.height)
- getPixels(argb, 0, width, 0, 0, width, height)
- other.getPixels(argbOther, 0, width, 0, 0, width, height)
-
- // Alpha channel special check
- if (config == Bitmap.Config.ALPHA_8) {
- // in this case we have to manually compare the alpha channel as the rest is garbage.
- val length = width * height
- for (i in 0 until length) {
- if (argb[i] and -0x1000000 != argbOther[i] and -0x1000000) {
- return false
- }
- }
- return true
- }
- return Arrays.equals(argb, argbOther)
-}
-
-fun Bitmap.invalidConfig(other: Bitmap): Boolean = this.config != other.config || this.width != other.width || this.height != other.height \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java
deleted file mode 100644
index b78a2d26e5..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.support.test.runner.AndroidJUnit4;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.style.light.Light;
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.style.light.Position;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
-import com.mapbox.mapboxsdk.testapp.activity.style.FillExtrusionStyleTestActivity;
-
-import timber.log.Timber;
-
-import org.hamcrest.Matcher;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
-import static com.mapbox.mapboxsdk.style.layers.Property.ANCHOR_MAP;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionBase;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity;
-
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-
-@RunWith(AndroidJUnit4.class)
-public class LightTest extends BaseTest {
-
- private Light light;
-
- @Test
- public void testAnchor() {
- validateTestSetup();
- setupLight();
- Timber.i("anchor");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- light.setAnchor(ANCHOR_MAP);
- assertEquals("Anchor should match", ANCHOR_MAP, light.getAnchor());
- });
- }
-
- @Test
- public void testPositionTransition() {
- validateTestSetup();
- setupLight();
- Timber.i("positionTransitionOptions");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- light.setPositionTransition(options);
- assertEquals("Transition options should match", options, light.getPositionTransition());
- });
- }
-
- @Test
- public void testPosition() {
- validateTestSetup();
- setupLight();
- Timber.i("position");
- invoke(mapboxMap,(uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- Position position = new Position(1, 2, 3);
- light.setPosition(position);
- assertEquals("Position should match", position, light.getPosition());
- });
- }
-
- @Test
- public void testColorTransition() {
- validateTestSetup();
- setupLight();
- Timber.i("colorTransitionOptions");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- light.setColorTransition(options);
- assertEquals("Transition options should match", options, light.getColorTransition());
- });
- }
-
- @Test
- public void testColor() {
- validateTestSetup();
- setupLight();
- Timber.i("color");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- light.setColor("rgba(255,128,0,0.7)");
- assertEquals("Color should match", "rgba(255,128,0,0.7)", light.getColor());
- });
- }
-
- @Test
- public void testIntensityTransition() {
- validateTestSetup();
- setupLight();
- Timber.i("intensityTransitionOptions");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- light.setIntensityTransition(options);
- assertEquals("Transition options should match", options, light.getIntensityTransition());
- });
- }
-
- @Test
- public void testIntensity() {
- validateTestSetup();
- setupLight();
- Timber.i("intensity");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- light.setIntensity(0.3f);
- assertEquals("Intensity should match", 0.3f, light.getIntensity());
- });
- }
-
- private void setupLight() {
- onView(withId(R.id.mapView)).perform(new ViewAction() {
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- light = mapboxMap.getStyle().getLight();
- FillExtrusionLayer fillExtrusionLayer = new FillExtrusionLayer("3d-buildings", "composite");
- fillExtrusionLayer.setSourceLayer("building");
- fillExtrusionLayer.setFilter(eq(Expression.get("extrude"), "true"));
- fillExtrusionLayer.setMinZoom(15);
- fillExtrusionLayer.setProperties(
- fillExtrusionColor(Color.LTGRAY),
- fillExtrusionHeight(Expression.get("height")),
- fillExtrusionBase(Expression.get("min_height")),
- fillExtrusionOpacity(0.6f)
- );
- mapboxMap.getStyle().addLayer(fillExtrusionLayer);
- }
- });
- }
-
- @Override
- protected Class getActivityClass() {
- return FillExtrusionStyleTestActivity.class;
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
deleted file mode 100644
index 4c8e70d3d1..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
+++ /dev/null
@@ -1,493 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.LineLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for LineLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class LineLayerTest extends BaseLayerTest {
-
- private LineLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new LineLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testSourceLayer() {
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- @UiThreadTest
- public void testFilter() {
- Timber.i("Filter");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getFilter(), null);
-
- // Set
- Expression filter = eq(get("undefined"), literal(1.0));
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
-
- // Set constant
- filter = literal(true);
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
- }
-
-
-
- @Test
- @UiThreadTest
- public void testLineCapAsConstant() {
- Timber.i("line-cap");
- assertNotNull(layer);
- assertNull(layer.getLineCap().getValue());
-
- // Set and Get
- String propertyValue = LINE_CAP_BUTT;
- layer.setProperties(lineCap(propertyValue));
- assertEquals(layer.getLineCap().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineJoinAsConstant() {
- Timber.i("line-join");
- assertNotNull(layer);
- assertNull(layer.getLineJoin().getValue());
-
- // Set and Get
- String propertyValue = LINE_JOIN_BEVEL;
- layer.setProperties(lineJoin(propertyValue));
- assertEquals(layer.getLineJoin().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineJoinAsExpression() {
- Timber.i("line-join-expression");
- assertNotNull(layer);
- assertNull(layer.getLineJoin().getExpression());
-
- // Set and Get
- Expression expression = string(Expression.get("undefined"));
- layer.setProperties(lineJoin(expression));
- assertEquals(layer.getLineJoin().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testLineMiterLimitAsConstant() {
- Timber.i("line-miter-limit");
- assertNotNull(layer);
- assertNull(layer.getLineMiterLimit().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(lineMiterLimit(propertyValue));
- assertEquals(layer.getLineMiterLimit().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineRoundLimitAsConstant() {
- Timber.i("line-round-limit");
- assertNotNull(layer);
- assertNull(layer.getLineRoundLimit().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(lineRoundLimit(propertyValue));
- assertEquals(layer.getLineRoundLimit().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineOpacityTransition() {
- Timber.i("line-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineOpacityTransition(options);
- assertEquals(layer.getLineOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineOpacityAsConstant() {
- Timber.i("line-opacity");
- assertNotNull(layer);
- assertNull(layer.getLineOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(lineOpacity(propertyValue));
- assertEquals(layer.getLineOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineOpacityAsExpression() {
- Timber.i("line-opacity-expression");
- assertNotNull(layer);
- assertNull(layer.getLineOpacity().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(lineOpacity(expression));
- assertEquals(layer.getLineOpacity().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testLineColorTransition() {
- Timber.i("line-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineColorTransition(options);
- assertEquals(layer.getLineColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineColorAsConstant() {
- Timber.i("line-color");
- assertNotNull(layer);
- assertNull(layer.getLineColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(lineColor(propertyValue));
- assertEquals(layer.getLineColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineColorAsExpression() {
- Timber.i("line-color-expression");
- assertNotNull(layer);
- assertNull(layer.getLineColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(lineColor(expression));
- assertEquals(layer.getLineColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testLineColorAsIntConstant() {
- Timber.i("line-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getLineColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testLineTranslateTransition() {
- Timber.i("line-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineTranslateTransition(options);
- assertEquals(layer.getLineTranslateTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineTranslateAsConstant() {
- Timber.i("line-translate");
- assertNotNull(layer);
- assertNull(layer.getLineTranslate().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(lineTranslate(propertyValue));
- assertEquals(layer.getLineTranslate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineTranslateAnchorAsConstant() {
- Timber.i("line-translate-anchor");
- assertNotNull(layer);
- assertNull(layer.getLineTranslateAnchor().getValue());
-
- // Set and Get
- String propertyValue = LINE_TRANSLATE_ANCHOR_MAP;
- layer.setProperties(lineTranslateAnchor(propertyValue));
- assertEquals(layer.getLineTranslateAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineWidthTransition() {
- Timber.i("line-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineWidthTransition(options);
- assertEquals(layer.getLineWidthTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineWidthAsConstant() {
- Timber.i("line-width");
- assertNotNull(layer);
- assertNull(layer.getLineWidth().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(lineWidth(propertyValue));
- assertEquals(layer.getLineWidth().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineWidthAsExpression() {
- Timber.i("line-width-expression");
- assertNotNull(layer);
- assertNull(layer.getLineWidth().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(lineWidth(expression));
- assertEquals(layer.getLineWidth().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testLineGapWidthTransition() {
- Timber.i("line-gap-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineGapWidthTransition(options);
- assertEquals(layer.getLineGapWidthTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineGapWidthAsConstant() {
- Timber.i("line-gap-width");
- assertNotNull(layer);
- assertNull(layer.getLineGapWidth().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(lineGapWidth(propertyValue));
- assertEquals(layer.getLineGapWidth().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineGapWidthAsExpression() {
- Timber.i("line-gap-width-expression");
- assertNotNull(layer);
- assertNull(layer.getLineGapWidth().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(lineGapWidth(expression));
- assertEquals(layer.getLineGapWidth().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testLineOffsetTransition() {
- Timber.i("line-offsetTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineOffsetTransition(options);
- assertEquals(layer.getLineOffsetTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineOffsetAsConstant() {
- Timber.i("line-offset");
- assertNotNull(layer);
- assertNull(layer.getLineOffset().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(lineOffset(propertyValue));
- assertEquals(layer.getLineOffset().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineBlurTransition() {
- Timber.i("line-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineBlurTransition(options);
- assertEquals(layer.getLineBlurTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineBlurAsConstant() {
- Timber.i("line-blur");
- assertNotNull(layer);
- assertNull(layer.getLineBlur().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(lineBlur(propertyValue));
- assertEquals(layer.getLineBlur().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLineBlurAsExpression() {
- Timber.i("line-blur-expression");
- assertNotNull(layer);
- assertNull(layer.getLineBlur().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(lineBlur(expression));
- assertEquals(layer.getLineBlur().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testLineDasharrayTransition() {
- Timber.i("line-dasharrayTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineDasharrayTransition(options);
- assertEquals(layer.getLineDasharrayTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLineDasharrayAsConstant() {
- Timber.i("line-dasharray");
- assertNotNull(layer);
- assertNull(layer.getLineDasharray().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {};
- layer.setProperties(lineDasharray(propertyValue));
- assertEquals(layer.getLineDasharray().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLinePatternTransition() {
- Timber.i("line-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLinePatternTransition(options);
- assertEquals(layer.getLinePatternTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testLinePatternAsConstant() {
- Timber.i("line-pattern");
- assertNotNull(layer);
- assertNull(layer.getLinePattern().getValue());
-
- // Set and Get
- String propertyValue = "pedestrian-polygon";
- layer.setProperties(linePattern(propertyValue));
- assertEquals(layer.getLinePattern().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testLinePatternAsExpression() {
- Timber.i("line-pattern-expression");
- assertNotNull(layer);
- assertNull(layer.getLinePattern().getExpression());
-
- // Set and Get
- Expression expression = image(string(Expression.get("undefined")));
- layer.setProperties(linePattern(expression));
- assertEquals(layer.getLinePattern().getExpression(), expression);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
deleted file mode 100644
index aa50b1fe52..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.RasterLayer;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for RasterLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class RasterLayerTest extends BaseLayerTest {
-
- private RasterLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new RasterLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testRasterOpacityTransition() {
- Timber.i("raster-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterOpacityTransition(options);
- assertEquals(layer.getRasterOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testRasterOpacityAsConstant() {
- Timber.i("raster-opacity");
- assertNotNull(layer);
- assertNull(layer.getRasterOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(rasterOpacity(propertyValue));
- assertEquals(layer.getRasterOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testRasterHueRotateTransition() {
- Timber.i("raster-hue-rotateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterHueRotateTransition(options);
- assertEquals(layer.getRasterHueRotateTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testRasterHueRotateAsConstant() {
- Timber.i("raster-hue-rotate");
- assertNotNull(layer);
- assertNull(layer.getRasterHueRotate().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(rasterHueRotate(propertyValue));
- assertEquals(layer.getRasterHueRotate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testRasterBrightnessMinTransition() {
- Timber.i("raster-brightness-minTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterBrightnessMinTransition(options);
- assertEquals(layer.getRasterBrightnessMinTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testRasterBrightnessMinAsConstant() {
- Timber.i("raster-brightness-min");
- assertNotNull(layer);
- assertNull(layer.getRasterBrightnessMin().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(rasterBrightnessMin(propertyValue));
- assertEquals(layer.getRasterBrightnessMin().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testRasterBrightnessMaxTransition() {
- Timber.i("raster-brightness-maxTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterBrightnessMaxTransition(options);
- assertEquals(layer.getRasterBrightnessMaxTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testRasterBrightnessMaxAsConstant() {
- Timber.i("raster-brightness-max");
- assertNotNull(layer);
- assertNull(layer.getRasterBrightnessMax().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(rasterBrightnessMax(propertyValue));
- assertEquals(layer.getRasterBrightnessMax().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testRasterSaturationTransition() {
- Timber.i("raster-saturationTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterSaturationTransition(options);
- assertEquals(layer.getRasterSaturationTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testRasterSaturationAsConstant() {
- Timber.i("raster-saturation");
- assertNotNull(layer);
- assertNull(layer.getRasterSaturation().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(rasterSaturation(propertyValue));
- assertEquals(layer.getRasterSaturation().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testRasterContrastTransition() {
- Timber.i("raster-contrastTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterContrastTransition(options);
- assertEquals(layer.getRasterContrastTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testRasterContrastAsConstant() {
- Timber.i("raster-contrast");
- assertNotNull(layer);
- assertNull(layer.getRasterContrast().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(rasterContrast(propertyValue));
- assertEquals(layer.getRasterContrast().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testRasterResamplingAsConstant() {
- Timber.i("raster-resampling");
- assertNotNull(layer);
- assertNull(layer.getRasterResampling().getValue());
-
- // Set and Get
- String propertyValue = RASTER_RESAMPLING_LINEAR;
- layer.setProperties(rasterResampling(propertyValue));
- assertEquals(layer.getRasterResampling().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testRasterFadeDurationAsConstant() {
- Timber.i("raster-fade-duration");
- assertNotNull(layer);
- assertNull(layer.getRasterFadeDuration().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(rasterFadeDuration(propertyValue));
- assertEquals(layer.getRasterFadeDuration().getValue(), propertyValue);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java
deleted file mode 100644
index 2d1fbf5fc4..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java
+++ /dev/null
@@ -1,370 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.graphics.PointF;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.support.test.runner.AndroidJUnit4;
-import android.view.View;
-import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException;
-import com.mapbox.mapboxsdk.style.layers.CircleLayer;
-import com.mapbox.mapboxsdk.style.layers.FillLayer;
-import com.mapbox.mapboxsdk.style.layers.Layer;
-import com.mapbox.mapboxsdk.style.layers.LineLayer;
-import com.mapbox.mapboxsdk.style.layers.Property;
-import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
-import com.mapbox.mapboxsdk.style.sources.CannotAddSourceException;
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
-import com.mapbox.mapboxsdk.style.sources.RasterSource;
-import com.mapbox.mapboxsdk.style.sources.Source;
-import com.mapbox.mapboxsdk.style.sources.VectorSource;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import junit.framework.Assert;
-import org.hamcrest.Matcher;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import timber.log.Timber;
-
-import java.util.List;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Basic smoke tests for Layer and Source
- */
-@RunWith(AndroidJUnit4.class)
-public class RuntimeStyleTests extends EspressoTest {
-
- @Test
- public void testListLayers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- List<Layer> layers = mapboxMap.getStyle().getLayers();
- assertNotNull(layers);
- assertTrue(layers.size() > 0);
- for (Layer layer : layers) {
- assertNotNull(layer);
- }
- }
-
- });
- }
-
- @Test
- public void testGetAddRemoveLayer() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new AddRemoveLayerAction());
- }
-
- @Test
- public void testAddLayerAbove() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
- @Override
- public void perform(UiController uiController, View view) {
- List<Layer> layers = mapboxMap.getStyle().getLayers();
- Source source = mapboxMap.getStyle().getSources().get(0);
-
- // Test inserting with invalid above-id
- try {
- mapboxMap.getStyle().addLayerAbove(
- new CircleLayer("invalid-id-layer-test", source.getId()), "no-such-layer-here-man"
- );
- fail("Should have thrown exception");
- } catch (CannotAddLayerException ex) {
- // Yeah
- assertNotNull(ex.getMessage());
- }
-
- // Insert as last
- CircleLayer last = new CircleLayer("this is the last one", source.getId());
- mapboxMap.getStyle().addLayerAbove(last, layers.get(layers.size() - 1).getId());
- layers = mapboxMap.getStyle().getLayers();
- assertEquals(last.getId(), layers.get(layers.size() - 1).getId());
-
- // Insert
- CircleLayer second = new CircleLayer("this is the second one", source.getId());
- mapboxMap.getStyle().addLayerAbove(second, layers.get(0).getId());
- layers = mapboxMap.getStyle().getLayers();
- assertEquals(second.getId(), layers.get(1).getId());
- }
- });
- }
-
- @Test
- public void testRemoveLayerAt() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- // Remove by index
- Layer firstLayer = mapboxMap.getStyle().getLayers().get(0);
- boolean removed = mapboxMap.getStyle().removeLayerAt(0);
- assertTrue(removed);
- assertNotNull(firstLayer);
-
- // Test remove by index bounds checks
- Timber.i("Remove layer at index > size");
- assertFalse(mapboxMap.getStyle().removeLayerAt(Integer.MAX_VALUE));
- }
- });
- }
-
- public void testAddLayerAt() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
- @Override
- public void perform(UiController uiController, View view) {
- List<Layer> layers = mapboxMap.getStyle().getLayers();
- Source source = mapboxMap.getStyle().getSources().get(0);
-
- // Test inserting out of range
- try {
- mapboxMap.getStyle().addLayerAt(new CircleLayer("invalid-id-layer-test", source.getId()), layers.size());
- fail("Should have thrown exception");
- } catch (CannotAddLayerException ex) {
- // Yeah
- assertNotNull(ex.getMessage());
- }
-
- // Insert at current last position
- CircleLayer last = new CircleLayer("this is the last one", source.getId());
- mapboxMap.getStyle().addLayerAt(last, layers.size() - 1);
- layers = mapboxMap.getStyle().getLayers();
- assertEquals(last.getId(), layers.get(layers.size() - 2).getId());
-
- // Insert at start
- CircleLayer second = new CircleLayer("this is the first one", source.getId());
- mapboxMap.getStyle().addLayerAt(second, 0);
- layers = mapboxMap.getStyle().getLayers();
- assertEquals(second.getId(), layers.get(0).getId());
- }
- });
- }
-
-
- @Test
- public void testListSources() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- List<Source> sources = mapboxMap.getStyle().getSources();
- assertNotNull(sources);
- assertTrue(sources.size() > 0);
- for (Source source : sources) {
- assertNotNull(source);
- }
- }
-
- });
- }
-
- @Test
- public void testAddRemoveSource() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- mapboxMap.getStyle().addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
- mapboxMap.getStyle().removeSource("my-source");
-
- // Add initial source
- mapboxMap.getStyle().addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
-
- // Remove
- boolean removeOk = mapboxMap.getStyle().removeSource("my-source");
- assertTrue(removeOk);
- assertNull(mapboxMap.getStyle().getLayer("my-source"));
-
- // Add
- Source source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.getStyle().addSource(source);
-
- // Remove, preserving the reference
- mapboxMap.getStyle().removeSource(source);
-
- // Re-add the reference...
- mapboxMap.getStyle().addSource(source);
-
- // Ensure it's there
- Assert.assertNotNull(mapboxMap.getStyle().getSource(source.getId()));
-
- // Test adding a duplicate source
- try {
- Source source2 = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.getStyle().addSource(source2);
- fail("Should not have been allowed to add a source with a duplicate id");
- } catch (CannotAddSourceException cannotAddSourceException) {
- // OK
- }
- });
-
- }
-
- @Test
- public void testVectorSourceUrlGetter() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- VectorSource source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.getStyle().addSource(source);
- assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUri());
- });
- }
-
- @Test
- public void testRasterSourceUrlGetter() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- RasterSource source = new RasterSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.getStyle().addSource(source);
- assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUri());
- });
- }
-
- @Test
- public void testGeoJsonSourceUrlGetter() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- GeoJsonSource source = new GeoJsonSource("my-source");
- mapboxMap.getStyle().addSource(source);
- assertNull(source.getUri());
- source.setUri("http://mapbox.com/my-file.json");
- assertEquals("http://mapbox.com/my-file.json", source.getUri());
- });
- }
-
- @Test
- public void testRemoveSourceInUse() {
- validateTestSetup();
-
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.getStyle().addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
- mapboxMap.getStyle().addLayer(new LineLayer("my-layer", "my-source"));
- mapboxMap.getStyle().removeSource("my-source");
- assertNotNull(mapboxMap.getStyle().getSource("my-source"));
- }
-
- });
- }
-
- @Test
- public void testRemoveNonExistingSource() {
- invoke(mapboxMap, (uiController, mapboxMap) -> mapboxMap.getStyle().removeSource("source"));
- }
-
- @Test
- public void testRemoveNonExistingLayer() {
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertFalse(mapboxMap.getStyle().removeLayer("layer"));
- assertFalse(mapboxMap.getStyle().removeLayerAt(mapboxMap.getStyle().getLayers().size() + 1));
- assertFalse(mapboxMap.getStyle().removeLayerAt(-1));
- });
- }
-
- @Test
- public void testRemoveExistingLayer() {
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- Layer firstLayer = mapboxMap.getStyle().getLayers().get(0);
- assertTrue(mapboxMap.getStyle().removeLayer(firstLayer));
-
- firstLayer = mapboxMap.getStyle().getLayers().get(0);
- assertTrue(mapboxMap.getStyle().removeLayer(firstLayer.getId()));
-
- assertTrue(mapboxMap.getStyle().removeLayerAt(0));
- });
- }
-
- /**
- * https://github.com/mapbox/mapbox-gl-native/issues/7973
- */
- @Test
- public void testQueryRenderedFeaturesInputHandling() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- String[] layerIds = new String[600];
- for (int i = 0; i < layerIds.length; i++) {
- layerIds[i] = "layer-" + i;
- }
- mapboxMap.queryRenderedFeatures(new PointF(100, 100), layerIds);
- }
-
- });
- }
-
- private class AddRemoveLayerAction extends BaseViewAction {
-
- @Override
- public void perform(UiController uiController, View view) {
- // Get initial
- assertNotNull(mapboxMap.getStyle().getLayer("building"));
-
- // Remove
- boolean removed = mapboxMap.getStyle().removeLayer("building");
- assertTrue(removed);
- assertNull(mapboxMap.getStyle().getLayer("building"));
-
- // Add
- FillLayer layer = new FillLayer("building", "composite");
- layer.setSourceLayer("building");
- mapboxMap.getStyle().addLayer(layer);
- assertNotNull(mapboxMap.getStyle().getLayer("building"));
-
- // Assure the reference still works
- layer.setProperties(PropertyFactory.visibility(Property.VISIBLE));
-
- // Remove, preserving the reference
- mapboxMap.getStyle().removeLayer(layer);
-
- // Property setters should still work
- layer.setProperties(PropertyFactory.fillColor(Color.RED));
-
- // Re-add the reference...
- mapboxMap.getStyle().addLayer(layer);
-
- // Ensure it's there
- Assert.assertNotNull(mapboxMap.getStyle().getLayer(layer.getId()));
-
- // Test adding a duplicate layer
- try {
- mapboxMap.getStyle().addLayer(new FillLayer("building", "composite"));
- fail("Should not have been allowed to add a layer with a duplicate id");
- } catch (CannotAddLayerException cannotAddLayerException) {
- // OK
- }
- }
- }
-
- public abstract class BaseViewAction implements ViewAction {
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java
deleted file mode 100644
index 4dd01d06cb..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTimingTestActivity;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Basic smoke tests for adding Layer and Source as early as possible (in onCreate)
- */
-@RunWith(AndroidJUnit4.class)
-public class RuntimeStyleTimingTests extends BaseTest {
-
- @Override
- protected Class getActivityClass() {
- return RuntimeStyleTimingTestActivity.class;
- }
-
- @Test
- public void testGetAddRemoveLayer() {
- validateTestSetup();
- // We're good if it didn't crash
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java
deleted file mode 100644
index 495b209831..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import com.mapbox.mapboxsdk.maps.MapView;
-import com.mapbox.mapboxsdk.maps.Style;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests around style loading
- */
-public class StyleLoaderTest extends EspressoTest {
-
- @Test
- public void testSetGetStyleJsonString() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- try {
- String expected = ResourceUtils.readRawResource(rule.getActivity(), R.raw.local_style);
- mapboxMap.setStyle(new Style.Builder().fromJson(expected));
- String actual = mapboxMap.getStyle().getJson();
- assertEquals("Style json should match", expected, actual);
- } catch (IOException exception) {
- exception.printStackTrace();
- }
- });
- }
-
- @Test
- public void testDefaultStyleLoadWithActivityLifecycleChange() {
- validateTestSetup();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- try {
- String expected = ResourceUtils.readRawResource(rule.getActivity(), R.raw.local_style);
- mapboxMap.setStyle(new Style.Builder().fromJson(expected));
-
- // fake activity stop/start
- MapView mapView = (MapView) rule.getActivity().findViewById(R.id.mapView);
- mapView.onPause();
- mapView.onStop();
-
- mapView.onStart();
- mapView.onResume();
-
- String actual = mapboxMap.getStyle().getJson();
- assertEquals("Style URL should be empty", "", mapboxMap.getStyle().getUri());
- assertEquals("Style json should match", expected, actual);
- } catch (IOException exception) {
- exception.printStackTrace();
- }
- });
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
deleted file mode 100644
index 02205b3c9e..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
+++ /dev/null
@@ -1,1313 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
-import com.mapbox.mapboxsdk.style.types.Formatted;
-import com.mapbox.mapboxsdk.style.types.FormattedSection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for SymbolLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class SymbolLayerTest extends BaseLayerTest {
-
- private SymbolLayer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
- layer = new SymbolLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- setupLayer(layer);
- }
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- @UiThreadTest
- public void testSourceLayer() {
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- @UiThreadTest
- public void testFilter() {
- Timber.i("Filter");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getFilter(), null);
-
- // Set
- Expression filter = eq(get("undefined"), literal(1.0));
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
-
- // Set constant
- filter = literal(true);
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
- }
-
-
-
- @Test
- @UiThreadTest
- public void testSymbolPlacementAsConstant() {
- Timber.i("symbol-placement");
- assertNotNull(layer);
- assertNull(layer.getSymbolPlacement().getValue());
-
- // Set and Get
- String propertyValue = SYMBOL_PLACEMENT_POINT;
- layer.setProperties(symbolPlacement(propertyValue));
- assertEquals(layer.getSymbolPlacement().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testSymbolSpacingAsConstant() {
- Timber.i("symbol-spacing");
- assertNotNull(layer);
- assertNull(layer.getSymbolSpacing().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(symbolSpacing(propertyValue));
- assertEquals(layer.getSymbolSpacing().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testSymbolAvoidEdgesAsConstant() {
- Timber.i("symbol-avoid-edges");
- assertNotNull(layer);
- assertNull(layer.getSymbolAvoidEdges().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(symbolAvoidEdges(propertyValue));
- assertEquals(layer.getSymbolAvoidEdges().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testSymbolSortKeyAsConstant() {
- Timber.i("symbol-sort-key");
- assertNotNull(layer);
- assertNull(layer.getSymbolSortKey().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(symbolSortKey(propertyValue));
- assertEquals(layer.getSymbolSortKey().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testSymbolSortKeyAsExpression() {
- Timber.i("symbol-sort-key-expression");
- assertNotNull(layer);
- assertNull(layer.getSymbolSortKey().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(symbolSortKey(expression));
- assertEquals(layer.getSymbolSortKey().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testSymbolZOrderAsConstant() {
- Timber.i("symbol-z-order");
- assertNotNull(layer);
- assertNull(layer.getSymbolZOrder().getValue());
-
- // Set and Get
- String propertyValue = SYMBOL_Z_ORDER_AUTO;
- layer.setProperties(symbolZOrder(propertyValue));
- assertEquals(layer.getSymbolZOrder().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconAllowOverlapAsConstant() {
- Timber.i("icon-allow-overlap");
- assertNotNull(layer);
- assertNull(layer.getIconAllowOverlap().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(iconAllowOverlap(propertyValue));
- assertEquals(layer.getIconAllowOverlap().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconIgnorePlacementAsConstant() {
- Timber.i("icon-ignore-placement");
- assertNotNull(layer);
- assertNull(layer.getIconIgnorePlacement().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(iconIgnorePlacement(propertyValue));
- assertEquals(layer.getIconIgnorePlacement().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconOptionalAsConstant() {
- Timber.i("icon-optional");
- assertNotNull(layer);
- assertNull(layer.getIconOptional().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(iconOptional(propertyValue));
- assertEquals(layer.getIconOptional().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconRotationAlignmentAsConstant() {
- Timber.i("icon-rotation-alignment");
- assertNotNull(layer);
- assertNull(layer.getIconRotationAlignment().getValue());
-
- // Set and Get
- String propertyValue = ICON_ROTATION_ALIGNMENT_MAP;
- layer.setProperties(iconRotationAlignment(propertyValue));
- assertEquals(layer.getIconRotationAlignment().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconSizeAsConstant() {
- Timber.i("icon-size");
- assertNotNull(layer);
- assertNull(layer.getIconSize().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(iconSize(propertyValue));
- assertEquals(layer.getIconSize().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconSizeAsExpression() {
- Timber.i("icon-size-expression");
- assertNotNull(layer);
- assertNull(layer.getIconSize().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(iconSize(expression));
- assertEquals(layer.getIconSize().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconTextFitAsConstant() {
- Timber.i("icon-text-fit");
- assertNotNull(layer);
- assertNull(layer.getIconTextFit().getValue());
-
- // Set and Get
- String propertyValue = ICON_TEXT_FIT_NONE;
- layer.setProperties(iconTextFit(propertyValue));
- assertEquals(layer.getIconTextFit().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconTextFitPaddingAsConstant() {
- Timber.i("icon-text-fit-padding");
- assertNotNull(layer);
- assertNull(layer.getIconTextFitPadding().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f, 0f, 0f};
- layer.setProperties(iconTextFitPadding(propertyValue));
- assertEquals(layer.getIconTextFitPadding().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconImageAsConstant() {
- Timber.i("icon-image");
- assertNotNull(layer);
- assertNull(layer.getIconImage().getValue());
-
- // Set and Get
- String propertyValue = "undefined";
- layer.setProperties(iconImage(propertyValue));
- assertEquals(layer.getIconImage().getValue(), propertyValue);
-
- layer.setProperties(iconImage("{token}"));
- assertEquals(layer.getIconImage().getExpression(), image(Expression.toString(Expression.get("token"))));
- }
-
- @Test
- @UiThreadTest
- public void testIconImageAsExpression() {
- Timber.i("icon-image-expression");
- assertNotNull(layer);
- assertNull(layer.getIconImage().getExpression());
-
- // Set and Get
- Expression expression = image(string(Expression.get("undefined")));
- layer.setProperties(iconImage(expression));
- assertEquals(layer.getIconImage().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconRotateAsConstant() {
- Timber.i("icon-rotate");
- assertNotNull(layer);
- assertNull(layer.getIconRotate().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(iconRotate(propertyValue));
- assertEquals(layer.getIconRotate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconRotateAsExpression() {
- Timber.i("icon-rotate-expression");
- assertNotNull(layer);
- assertNull(layer.getIconRotate().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(iconRotate(expression));
- assertEquals(layer.getIconRotate().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconPaddingAsConstant() {
- Timber.i("icon-padding");
- assertNotNull(layer);
- assertNull(layer.getIconPadding().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(iconPadding(propertyValue));
- assertEquals(layer.getIconPadding().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconKeepUprightAsConstant() {
- Timber.i("icon-keep-upright");
- assertNotNull(layer);
- assertNull(layer.getIconKeepUpright().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(iconKeepUpright(propertyValue));
- assertEquals(layer.getIconKeepUpright().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconOffsetAsConstant() {
- Timber.i("icon-offset");
- assertNotNull(layer);
- assertNull(layer.getIconOffset().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(iconOffset(propertyValue));
- assertEquals(layer.getIconOffset().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconAnchorAsConstant() {
- Timber.i("icon-anchor");
- assertNotNull(layer);
- assertNull(layer.getIconAnchor().getValue());
-
- // Set and Get
- String propertyValue = ICON_ANCHOR_CENTER;
- layer.setProperties(iconAnchor(propertyValue));
- assertEquals(layer.getIconAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconAnchorAsExpression() {
- Timber.i("icon-anchor-expression");
- assertNotNull(layer);
- assertNull(layer.getIconAnchor().getExpression());
-
- // Set and Get
- Expression expression = string(Expression.get("undefined"));
- layer.setProperties(iconAnchor(expression));
- assertEquals(layer.getIconAnchor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconPitchAlignmentAsConstant() {
- Timber.i("icon-pitch-alignment");
- assertNotNull(layer);
- assertNull(layer.getIconPitchAlignment().getValue());
-
- // Set and Get
- String propertyValue = ICON_PITCH_ALIGNMENT_MAP;
- layer.setProperties(iconPitchAlignment(propertyValue));
- assertEquals(layer.getIconPitchAlignment().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextPitchAlignmentAsConstant() {
- Timber.i("text-pitch-alignment");
- assertNotNull(layer);
- assertNull(layer.getTextPitchAlignment().getValue());
-
- // Set and Get
- String propertyValue = TEXT_PITCH_ALIGNMENT_MAP;
- layer.setProperties(textPitchAlignment(propertyValue));
- assertEquals(layer.getTextPitchAlignment().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextRotationAlignmentAsConstant() {
- Timber.i("text-rotation-alignment");
- assertNotNull(layer);
- assertNull(layer.getTextRotationAlignment().getValue());
-
- // Set and Get
- String propertyValue = TEXT_ROTATION_ALIGNMENT_MAP;
- layer.setProperties(textRotationAlignment(propertyValue));
- assertEquals(layer.getTextRotationAlignment().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextFieldAsConstant() {
- Timber.i("text-field");
- assertNotNull(layer);
- assertNull(layer.getTextField().getValue());
-
- // Set and Get
- Formatted propertyValue = new Formatted(new FormattedSection("default"));
- layer.setProperties(textField("default"));
- assertEquals(layer.getTextField().getValue(), propertyValue);
- layer.setProperties(textField(propertyValue));
- assertEquals(layer.getTextField().getValue(), propertyValue);
-
- layer.setProperties(textField("{token}"));
- assertEquals(layer.getTextField().getExpression(), format(Expression.formatEntry(Expression.toString(Expression.get("token")))));
- }
-
- @Test
- @UiThreadTest
- public void testTextFieldAsExpression() {
- Timber.i("text-field-expression");
- assertNotNull(layer);
- assertNull(layer.getTextField().getExpression());
-
- // Set and Get
- Expression expression = format(Expression.formatEntry(Expression.get("undefined"), FormatOption.formatFontScale(2.0), FormatOption.formatTextFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})));
- layer.setProperties(textField(expression));
- assertEquals(layer.getTextField().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextFontAsConstant() {
- Timber.i("text-font");
- assertNotNull(layer);
- assertNull(layer.getTextFont().getValue());
-
- // Set and Get
- String[] propertyValue = new String[]{"Open Sans Regular", "Arial Unicode MS Regular"};
- layer.setProperties(textFont(propertyValue));
- assertEquals(layer.getTextFont().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextSizeAsConstant() {
- Timber.i("text-size");
- assertNotNull(layer);
- assertNull(layer.getTextSize().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textSize(propertyValue));
- assertEquals(layer.getTextSize().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextSizeAsExpression() {
- Timber.i("text-size-expression");
- assertNotNull(layer);
- assertNull(layer.getTextSize().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(textSize(expression));
- assertEquals(layer.getTextSize().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextMaxWidthAsConstant() {
- Timber.i("text-max-width");
- assertNotNull(layer);
- assertNull(layer.getTextMaxWidth().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textMaxWidth(propertyValue));
- assertEquals(layer.getTextMaxWidth().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextMaxWidthAsExpression() {
- Timber.i("text-max-width-expression");
- assertNotNull(layer);
- assertNull(layer.getTextMaxWidth().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(textMaxWidth(expression));
- assertEquals(layer.getTextMaxWidth().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextLineHeightAsConstant() {
- Timber.i("text-line-height");
- assertNotNull(layer);
- assertNull(layer.getTextLineHeight().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textLineHeight(propertyValue));
- assertEquals(layer.getTextLineHeight().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextLetterSpacingAsConstant() {
- Timber.i("text-letter-spacing");
- assertNotNull(layer);
- assertNull(layer.getTextLetterSpacing().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textLetterSpacing(propertyValue));
- assertEquals(layer.getTextLetterSpacing().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextLetterSpacingAsExpression() {
- Timber.i("text-letter-spacing-expression");
- assertNotNull(layer);
- assertNull(layer.getTextLetterSpacing().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(textLetterSpacing(expression));
- assertEquals(layer.getTextLetterSpacing().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextJustifyAsConstant() {
- Timber.i("text-justify");
- assertNotNull(layer);
- assertNull(layer.getTextJustify().getValue());
-
- // Set and Get
- String propertyValue = TEXT_JUSTIFY_AUTO;
- layer.setProperties(textJustify(propertyValue));
- assertEquals(layer.getTextJustify().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextJustifyAsExpression() {
- Timber.i("text-justify-expression");
- assertNotNull(layer);
- assertNull(layer.getTextJustify().getExpression());
-
- // Set and Get
- Expression expression = string(Expression.get("undefined"));
- layer.setProperties(textJustify(expression));
- assertEquals(layer.getTextJustify().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextRadialOffsetAsConstant() {
- Timber.i("text-radial-offset");
- assertNotNull(layer);
- assertNull(layer.getTextRadialOffset().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textRadialOffset(propertyValue));
- assertEquals(layer.getTextRadialOffset().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextVariableAnchorAsConstant() {
- Timber.i("text-variable-anchor");
- assertNotNull(layer);
- assertNull(layer.getTextVariableAnchor().getValue());
-
- // Set and Get
- String[] propertyValue = new String[0];
- layer.setProperties(textVariableAnchor(propertyValue));
- assertEquals(layer.getTextVariableAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextAnchorAsConstant() {
- Timber.i("text-anchor");
- assertNotNull(layer);
- assertNull(layer.getTextAnchor().getValue());
-
- // Set and Get
- String propertyValue = TEXT_ANCHOR_CENTER;
- layer.setProperties(textAnchor(propertyValue));
- assertEquals(layer.getTextAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextAnchorAsExpression() {
- Timber.i("text-anchor-expression");
- assertNotNull(layer);
- assertNull(layer.getTextAnchor().getExpression());
-
- // Set and Get
- Expression expression = string(Expression.get("undefined"));
- layer.setProperties(textAnchor(expression));
- assertEquals(layer.getTextAnchor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextMaxAngleAsConstant() {
- Timber.i("text-max-angle");
- assertNotNull(layer);
- assertNull(layer.getTextMaxAngle().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textMaxAngle(propertyValue));
- assertEquals(layer.getTextMaxAngle().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextWritingModeAsConstant() {
- Timber.i("text-writing-mode");
- assertNotNull(layer);
- assertNull(layer.getTextWritingMode().getValue());
-
- // Set and Get
- String[] propertyValue = new String[0];
- layer.setProperties(textWritingMode(propertyValue));
- assertEquals(layer.getTextWritingMode().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextRotateAsConstant() {
- Timber.i("text-rotate");
- assertNotNull(layer);
- assertNull(layer.getTextRotate().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textRotate(propertyValue));
- assertEquals(layer.getTextRotate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextRotateAsExpression() {
- Timber.i("text-rotate-expression");
- assertNotNull(layer);
- assertNull(layer.getTextRotate().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(textRotate(expression));
- assertEquals(layer.getTextRotate().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextPaddingAsConstant() {
- Timber.i("text-padding");
- assertNotNull(layer);
- assertNull(layer.getTextPadding().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textPadding(propertyValue));
- assertEquals(layer.getTextPadding().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextKeepUprightAsConstant() {
- Timber.i("text-keep-upright");
- assertNotNull(layer);
- assertNull(layer.getTextKeepUpright().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(textKeepUpright(propertyValue));
- assertEquals(layer.getTextKeepUpright().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextTransformAsConstant() {
- Timber.i("text-transform");
- assertNotNull(layer);
- assertNull(layer.getTextTransform().getValue());
-
- // Set and Get
- String propertyValue = TEXT_TRANSFORM_NONE;
- layer.setProperties(textTransform(propertyValue));
- assertEquals(layer.getTextTransform().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextTransformAsExpression() {
- Timber.i("text-transform-expression");
- assertNotNull(layer);
- assertNull(layer.getTextTransform().getExpression());
-
- // Set and Get
- Expression expression = string(Expression.get("undefined"));
- layer.setProperties(textTransform(expression));
- assertEquals(layer.getTextTransform().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextOffsetAsConstant() {
- Timber.i("text-offset");
- assertNotNull(layer);
- assertNull(layer.getTextOffset().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(textOffset(propertyValue));
- assertEquals(layer.getTextOffset().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextAllowOverlapAsConstant() {
- Timber.i("text-allow-overlap");
- assertNotNull(layer);
- assertNull(layer.getTextAllowOverlap().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(textAllowOverlap(propertyValue));
- assertEquals(layer.getTextAllowOverlap().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextIgnorePlacementAsConstant() {
- Timber.i("text-ignore-placement");
- assertNotNull(layer);
- assertNull(layer.getTextIgnorePlacement().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(textIgnorePlacement(propertyValue));
- assertEquals(layer.getTextIgnorePlacement().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextOptionalAsConstant() {
- Timber.i("text-optional");
- assertNotNull(layer);
- assertNull(layer.getTextOptional().getValue());
-
- // Set and Get
- Boolean propertyValue = true;
- layer.setProperties(textOptional(propertyValue));
- assertEquals(layer.getTextOptional().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconOpacityTransition() {
- Timber.i("icon-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconOpacityTransition(options);
- assertEquals(layer.getIconOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testIconOpacityAsConstant() {
- Timber.i("icon-opacity");
- assertNotNull(layer);
- assertNull(layer.getIconOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(iconOpacity(propertyValue));
- assertEquals(layer.getIconOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconOpacityAsExpression() {
- Timber.i("icon-opacity-expression");
- assertNotNull(layer);
- assertNull(layer.getIconOpacity().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(iconOpacity(expression));
- assertEquals(layer.getIconOpacity().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconColorTransition() {
- Timber.i("icon-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconColorTransition(options);
- assertEquals(layer.getIconColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testIconColorAsConstant() {
- Timber.i("icon-color");
- assertNotNull(layer);
- assertNull(layer.getIconColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(iconColor(propertyValue));
- assertEquals(layer.getIconColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconColorAsExpression() {
- Timber.i("icon-color-expression");
- assertNotNull(layer);
- assertNull(layer.getIconColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(iconColor(expression));
- assertEquals(layer.getIconColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconColorAsIntConstant() {
- Timber.i("icon-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getIconColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloColorTransition() {
- Timber.i("icon-halo-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconHaloColorTransition(options);
- assertEquals(layer.getIconHaloColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloColorAsConstant() {
- Timber.i("icon-halo-color");
- assertNotNull(layer);
- assertNull(layer.getIconHaloColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(iconHaloColor(propertyValue));
- assertEquals(layer.getIconHaloColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloColorAsExpression() {
- Timber.i("icon-halo-color-expression");
- assertNotNull(layer);
- assertNull(layer.getIconHaloColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(iconHaloColor(expression));
- assertEquals(layer.getIconHaloColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloColorAsIntConstant() {
- Timber.i("icon-halo-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconHaloColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getIconHaloColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloWidthTransition() {
- Timber.i("icon-halo-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconHaloWidthTransition(options);
- assertEquals(layer.getIconHaloWidthTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloWidthAsConstant() {
- Timber.i("icon-halo-width");
- assertNotNull(layer);
- assertNull(layer.getIconHaloWidth().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(iconHaloWidth(propertyValue));
- assertEquals(layer.getIconHaloWidth().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloWidthAsExpression() {
- Timber.i("icon-halo-width-expression");
- assertNotNull(layer);
- assertNull(layer.getIconHaloWidth().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(iconHaloWidth(expression));
- assertEquals(layer.getIconHaloWidth().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloBlurTransition() {
- Timber.i("icon-halo-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconHaloBlurTransition(options);
- assertEquals(layer.getIconHaloBlurTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloBlurAsConstant() {
- Timber.i("icon-halo-blur");
- assertNotNull(layer);
- assertNull(layer.getIconHaloBlur().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(iconHaloBlur(propertyValue));
- assertEquals(layer.getIconHaloBlur().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconHaloBlurAsExpression() {
- Timber.i("icon-halo-blur-expression");
- assertNotNull(layer);
- assertNull(layer.getIconHaloBlur().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(iconHaloBlur(expression));
- assertEquals(layer.getIconHaloBlur().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testIconTranslateTransition() {
- Timber.i("icon-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconTranslateTransition(options);
- assertEquals(layer.getIconTranslateTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testIconTranslateAsConstant() {
- Timber.i("icon-translate");
- assertNotNull(layer);
- assertNull(layer.getIconTranslate().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(iconTranslate(propertyValue));
- assertEquals(layer.getIconTranslate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testIconTranslateAnchorAsConstant() {
- Timber.i("icon-translate-anchor");
- assertNotNull(layer);
- assertNull(layer.getIconTranslateAnchor().getValue());
-
- // Set and Get
- String propertyValue = ICON_TRANSLATE_ANCHOR_MAP;
- layer.setProperties(iconTranslateAnchor(propertyValue));
- assertEquals(layer.getIconTranslateAnchor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextOpacityTransition() {
- Timber.i("text-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextOpacityTransition(options);
- assertEquals(layer.getTextOpacityTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testTextOpacityAsConstant() {
- Timber.i("text-opacity");
- assertNotNull(layer);
- assertNull(layer.getTextOpacity().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textOpacity(propertyValue));
- assertEquals(layer.getTextOpacity().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextOpacityAsExpression() {
- Timber.i("text-opacity-expression");
- assertNotNull(layer);
- assertNull(layer.getTextOpacity().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(textOpacity(expression));
- assertEquals(layer.getTextOpacity().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextColorTransition() {
- Timber.i("text-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextColorTransition(options);
- assertEquals(layer.getTextColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testTextColorAsConstant() {
- Timber.i("text-color");
- assertNotNull(layer);
- assertNull(layer.getTextColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(textColor(propertyValue));
- assertEquals(layer.getTextColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextColorAsExpression() {
- Timber.i("text-color-expression");
- assertNotNull(layer);
- assertNull(layer.getTextColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(textColor(expression));
- assertEquals(layer.getTextColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextColorAsIntConstant() {
- Timber.i("text-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getTextColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloColorTransition() {
- Timber.i("text-halo-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextHaloColorTransition(options);
- assertEquals(layer.getTextHaloColorTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloColorAsConstant() {
- Timber.i("text-halo-color");
- assertNotNull(layer);
- assertNull(layer.getTextHaloColor().getValue());
-
- // Set and Get
- String propertyValue = "rgba(255,128,0,0.7)";
- layer.setProperties(textHaloColor(propertyValue));
- assertEquals(layer.getTextHaloColor().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloColorAsExpression() {
- Timber.i("text-halo-color-expression");
- assertNotNull(layer);
- assertNull(layer.getTextHaloColor().getExpression());
-
- // Set and Get
- Expression expression = toColor(Expression.get("undefined"));
- layer.setProperties(textHaloColor(expression));
- assertEquals(layer.getTextHaloColor().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloColorAsIntConstant() {
- Timber.i("text-halo-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textHaloColor(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.getTextHaloColorAsInt(), Color.argb(127, 255, 127, 0));
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloWidthTransition() {
- Timber.i("text-halo-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextHaloWidthTransition(options);
- assertEquals(layer.getTextHaloWidthTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloWidthAsConstant() {
- Timber.i("text-halo-width");
- assertNotNull(layer);
- assertNull(layer.getTextHaloWidth().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textHaloWidth(propertyValue));
- assertEquals(layer.getTextHaloWidth().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloWidthAsExpression() {
- Timber.i("text-halo-width-expression");
- assertNotNull(layer);
- assertNull(layer.getTextHaloWidth().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(textHaloWidth(expression));
- assertEquals(layer.getTextHaloWidth().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloBlurTransition() {
- Timber.i("text-halo-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextHaloBlurTransition(options);
- assertEquals(layer.getTextHaloBlurTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloBlurAsConstant() {
- Timber.i("text-halo-blur");
- assertNotNull(layer);
- assertNull(layer.getTextHaloBlur().getValue());
-
- // Set and Get
- Float propertyValue = 0.3f;
- layer.setProperties(textHaloBlur(propertyValue));
- assertEquals(layer.getTextHaloBlur().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextHaloBlurAsExpression() {
- Timber.i("text-halo-blur-expression");
- assertNotNull(layer);
- assertNull(layer.getTextHaloBlur().getExpression());
-
- // Set and Get
- Expression expression = number(Expression.get("undefined"));
- layer.setProperties(textHaloBlur(expression));
- assertEquals(layer.getTextHaloBlur().getExpression(), expression);
- }
-
- @Test
- @UiThreadTest
- public void testTextTranslateTransition() {
- Timber.i("text-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextTranslateTransition(options);
- assertEquals(layer.getTextTranslateTransition(), options);
- }
-
- @Test
- @UiThreadTest
- public void testTextTranslateAsConstant() {
- Timber.i("text-translate");
- assertNotNull(layer);
- assertNull(layer.getTextTranslate().getValue());
-
- // Set and Get
- Float[] propertyValue = new Float[] {0f, 0f};
- layer.setProperties(textTranslate(propertyValue));
- assertEquals(layer.getTextTranslate().getValue(), propertyValue);
- }
-
- @Test
- @UiThreadTest
- public void testTextTranslateAnchorAsConstant() {
- Timber.i("text-translate-anchor");
- assertNotNull(layer);
- assertNull(layer.getTextTranslateAnchor().getValue());
-
- // Set and Get
- String propertyValue = TEXT_TRANSLATE_ANCHOR_MAP;
- layer.setProperties(textTranslateAnchor(propertyValue));
- assertEquals(layer.getTextTranslateAnchor().getValue(), propertyValue);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
deleted file mode 100644
index 141114c1a0..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
+++ /dev/null
@@ -1,199 +0,0 @@
-<%
- const type = locals.type;
- const properties = locals.properties;
--%>
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.maps.BaseLayerTest;
-import org.junit.Before;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.<%- camelize(type) %>Layer;
-<% if (type === 'symbol') { -%>
-import com.mapbox.mapboxsdk.style.types.Formatted;
-import com.mapbox.mapboxsdk.style.types.FormattedSection;
-<% } -%>
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-
-/**
- * Basic smoke tests for <%- camelize(type) %>Layer
- */
-@RunWith(AndroidJUnit4.class)
-public class <%- camelize(type) %>LayerTest extends BaseLayerTest {
-
- private <%- camelize(type) %>Layer layer;
-
- @Before
- @UiThreadTest
- public void beforeTest(){
- super.before();
-<% if (type === 'background') { -%>
- layer = new <%- camelize(type) %>Layer("my-layer");
-<% } else { -%>
- layer = new <%- camelize(type) %>Layer("my-layer", "composite");
- layer.setSourceLayer("composite");
-<% } -%>
- setupLayer(layer);
- }
-<% if (type !== 'background') { -%>
-
- @Test
- @UiThreadTest
- public void testSourceId() {
- Timber.i("SourceId");
- assertNotNull(layer);
- assertEquals(layer.getSourceId(), "composite");
- }
-<% } -%>
-
- @Test
- @UiThreadTest
- public void testSetVisibility() {
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-<% if (!(type === 'background' || type === 'raster' || type === 'hillshade')) { -%>
-
- @Test
- @UiThreadTest
- public void testSourceLayer() {
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- @UiThreadTest
- public void testFilter() {
- Timber.i("Filter");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getFilter(), null);
-
- // Set
- Expression filter = eq(get("undefined"), literal(1.0));
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
-
- // Set constant
- filter = literal(true);
- layer.setFilter(filter);
- assertEquals(layer.getFilter().toString(), filter.toString());
- }
-
-
-<% } -%>
-<% for (const property of properties) { -%>
-<% if (property['property-type'] !== 'color-ramp') { -%>
-<% if (property.transition) { -%>
-
- @Test
- @UiThreadTest
- public void test<%- camelize(property.name) %>Transition() {
- Timber.i("<%- property.name %>TransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.set<%- camelize(property.name) %>Transition(options);
- assertEquals(layer.get<%- camelize(property.name) %>Transition(), options);
- }
-<% } -%>
-
- @Test
- @UiThreadTest
- public void test<%- camelize(property.name) %>AsConstant() {
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
- assertNull(layer.get<%- camelize(property.name) %>().getValue());
-
- // Set and Get
- <%- propertyType(property) %> propertyValue = <%- defaultValueJava(property) %>;
-<% if (property.type === 'formatted') { -%>
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>("default"));
- assertEquals(layer.get<%- camelize(property.name) %>().getValue(), propertyValue);
-<% } -%>
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(propertyValue));
- assertEquals(layer.get<%- camelize(property.name) %>().getValue(), propertyValue);
-<% if (property.tokens) { -%>
-
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>("{token}"));
-<% if (property.type === 'formatted') { -%>
- assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), <%- defaultExpressionJava(property) %>(Expression.formatEntry(Expression.toString(Expression.get("token")))));
-<% } else if (property.type === 'resolvedImage') {-%>
- assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), <%- defaultExpressionJava(property) %>(Expression.toString(Expression.get("token"))));
-<% } else {-%>
- assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), Expression.toString(Expression.get("token")));
-<% } -%>
-<% } -%>
- }
-<% if (property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven') { -%>
-<% if (!(property.name.endsWith("-font")||property.name.endsWith("-offset"))) { -%>
-
- @Test
- @UiThreadTest
- public void test<%- camelize(property.name) %>AsExpression() {
- Timber.i("<%- property.name %>-expression");
- assertNotNull(layer);
- assertNull(layer.get<%- camelize(property.name) %>().getExpression());
-
- // Set and Get
-<% if (property.type === 'formatted') { -%>
- Expression expression = <%- defaultExpressionJava(property) %>(Expression.formatEntry(Expression.get("undefined"), FormatOption.formatFontScale(2.0), FormatOption.formatTextFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})));
-<% } else if (property.type === 'resolvedImage') { -%>
- Expression expression = <%- defaultExpressionJava(property) %>(string(Expression.get("undefined")));
-<% } else { -%>
- Expression expression = <%- defaultExpressionJava(property) %>(Expression.get("undefined"));
-<% } -%>
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(expression));
- assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), expression);
- }
-<% } -%>
-<% } -%>
-<% if (property.type == 'color') { -%>
-
- @Test
- @UiThreadTest
- public void test<%- camelize(property.name) %>AsIntConstant() {
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(Color.argb(127, 255, 127, 0)));
- assertEquals(layer.get<%- camelize(property.name) %>AsInt(), Color.argb(127, 255, 127, 0));
- }
-<% } -%>
-<% } -%>
-<% } -%>
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs
deleted file mode 100644
index 9bc77b202b..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs
+++ /dev/null
@@ -1,132 +0,0 @@
-<%
- const properties = locals.properties;
--%>
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.support.test.runner.AndroidJUnit4;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.style.light.Light;
-import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.style.light.Position;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
-import com.mapbox.mapboxsdk.testapp.activity.style.FillExtrusionStyleTestActivity;
-
-import timber.log.Timber;
-
-import org.hamcrest.Matcher;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
-import static com.mapbox.mapboxsdk.style.layers.Property.ANCHOR_MAP;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionBase;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity;
-
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-
-@RunWith(AndroidJUnit4.class)
-public class LightTest extends BaseTest {
-
- private Light light;
-<% for (const property of properties) { -%>
-<% if (property.transition) { -%>
-
- @Test
- public void test<%- camelize(property.name) %>Transition() {
- validateTestSetup();
- setupLight();
- Timber.i("<%- property.name %>TransitionOptions");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- light.set<%- camelize(property.name) %>Transition(options);
- assertEquals("Transition options should match", options, light.get<%- camelize(property.name) %>Transition());
- });
- }
-<% } -%>
-<% if (property.name == "position") { -%>
-
- @Test
- public void test<%- camelize(property.name) %>() {
- validateTestSetup();
- setupLight();
- Timber.i("<%- property.name %>");
- invoke(mapboxMap,(uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- Position position = new Position(1, 2, 3);
- light.set<%- camelize(property.name) %>(position);
- assertEquals("Position should match", position, light.get<%- camelize(property.name) %>());
- });
- }
-<% } else { -%>
-
- @Test
- public void test<%- camelize(property.name) %>() {
- validateTestSetup();
- setupLight();
- Timber.i("<%- property.name %>");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(light);
- // Set and Get
- light.set<%- camelize(property.name) %>(<%- defaultValueJava(property) %>);
-<% if (property.name == 'color') { -%>
- assertEquals("<%- camelize(property.name) %> should match", <%- defaultValueJava(property) %>, light.get<%- camelize(property.name) %>());
-<% } else { -%>
- assertEquals("<%- camelize(property.name) %> should match", <%- defaultValueJava(property) %>, light.get<%- camelize(property.name) %>());
-<% } -%>
- });
- }
-<% } -%>
-<% } -%>
-
- private void setupLight() {
- onView(withId(R.id.mapView)).perform(new ViewAction() {
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- light = mapboxMap.getStyle().getLight();
- FillExtrusionLayer fillExtrusionLayer = new FillExtrusionLayer("3d-buildings", "composite");
- fillExtrusionLayer.setSourceLayer("building");
- fillExtrusionLayer.setFilter(eq(Expression.get("extrude"), "true"));
- fillExtrusionLayer.setMinZoom(15);
- fillExtrusionLayer.setProperties(
- fillExtrusionColor(Color.LTGRAY),
- fillExtrusionHeight(Expression.get("height")),
- fillExtrusionBase(Expression.get("min_height")),
- fillExtrusionOpacity(0.6f)
- );
- mapboxMap.getStyle().addLayer(fillExtrusionLayer);
- }
- });
- }
-
- @Override
- protected Class getActivityClass() {
- return FillExtrusionStyleTestActivity.class;
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/SnapshotterIdlingResource.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/SnapshotterIdlingResource.java
deleted file mode 100644
index e0da683e6d..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/SnapshotterIdlingResource.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.utils;
-
-import android.support.test.espresso.IdlingResource;
-
-import com.mapbox.mapboxsdk.testapp.activity.render.RenderTestActivity;
-
-public class SnapshotterIdlingResource implements IdlingResource, RenderTestActivity.OnRenderTestCompletionListener {
-
- private IdlingResource.ResourceCallback resourceCallback;
- private boolean isSnapshotReady;
-
- public SnapshotterIdlingResource(RenderTestActivity activity) {
- activity.setOnRenderTestCompletionListener(this);
- }
-
- @Override
- public String getName() {
- return "SnapshotterIdlingResource";
- }
-
- @Override
- public boolean isIdleNow() {
- return isSnapshotReady;
- }
-
- @Override
- public void registerIdleTransitionCallback(ResourceCallback resourceCallback) {
- this.resourceCallback = resourceCallback;
- }
-
- @Override
- public void onFinish() {
- isSnapshotReady = true;
- if (resourceCallback != null) {
- resourceCallback.onTransitionToIdle();
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestConstants.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestConstants.java
deleted file mode 100644
index 255d1e1e7d..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestConstants.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.utils;
-
-public class TestConstants {
- public static final double LAT_LNG_DELTA = 0.1;
- public static final double BEARING_DELTA = 0.1;
- public static final double TILT_DELTA = 0.3;
- public static final double ZOOM_DELTA = 0.3;
- public static final double PADDING_DELTA = 0.0001;
-
- public static final String TEXT_MARKER_TITLE = "Marker";
- public static final String TEXT_MARKER_SNIPPET = "Snippet";
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestingAsyncUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestingAsyncUtils.kt
deleted file mode 100644
index 7c23d8d63c..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/TestingAsyncUtils.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.utils
-
-import android.support.test.espresso.UiController
-import com.mapbox.mapboxsdk.maps.MapView
-
-object TestingAsyncUtils {
- private const val DEFAULT_TIMEOUT = 15_000L
-
- fun waitForLayer(uiController: UiController, mapView: MapView) {
- val start = System.nanoTime() / 1E6
- var isIdle = false
- mapView.addOnDidBecomeIdleListener { isIdle = true }
-
- while (!isIdle && System.nanoTime() / 1E6 - start < DEFAULT_TIMEOUT) {
- uiController.loopMainThreadForAtLeast(100)
- }
- }
-} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/utils/FontUtilsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/utils/FontUtilsTest.java
deleted file mode 100644
index fa068cb973..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/utils/FontUtilsTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.mapbox.mapboxsdk.utils;
-
-import android.support.test.runner.AndroidJUnit4;
-import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-@RunWith(AndroidJUnit4.class)
-public class FontUtilsTest {
-
- @Test
- public void testExtractedFontShouldMatchDefault() {
- String[] fonts = new String[] {"foo", "bar"};
- String actual = FontUtils.extractValidFont(fonts);
- assertEquals("Selected font should match", MapboxConstants.DEFAULT_FONT, actual);
- }
-
- @Test
- public void testExtractedFontShouldMatchMonospace() {
- String expected = "monospace";
- String[] fonts = new String[] {"foo", expected};
- String actual = FontUtils.extractValidFont(fonts);
- assertEquals("Selected font should match", expected, actual);
- }
-
- @Test
- public void testExtractedFontArrayShouldBeNull() {
- String[] fonts = null;
- String actual = FontUtils.extractValidFont(fonts);
- assertNull(actual);
- }
-
- @Test
- public void testExtractedFontShouldBeNull() {
- String actual = FontUtils.extractValidFont(null);
- assertNull(actual);
- }
-}