Updated Android SDK, all dependencies, and did the gradle migarion, fixed unit tests and ktlint (#627)
Co-authored-by: Artak Kalantarian <artak@amazon.com>
This commit is contained in:
committed by
GitHub
parent
c6dd558665
commit
b038aeddb0
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:tools="http://schemas.android.com/tools" package="${applicationId}">
|
||||
<manifest xmlns:tools="http://schemas.android.com/tools">
|
||||
<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator"/>
|
||||
</manifest>
|
||||
@@ -2,7 +2,7 @@ package com.mapbox.mapboxsdk.camera
|
||||
|
||||
import android.graphics.PointF
|
||||
import androidx.test.annotation.UiThreadTest
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseTest
|
||||
@@ -13,7 +13,7 @@ import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class CameraUpdateFactoryTest : BaseTest() {
|
||||
|
||||
override fun getActivityClass(): Class<*> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import androidx.test.uiautomator.UiSelector
|
||||
import com.mapbox.mapboxsdk.testapp.activity.fragment.FragmentBackStackActivity
|
||||
@@ -12,7 +12,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates MapFragment integration on the backstack
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class FragmentBackStackTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
|
||||
import org.junit.Rule
|
||||
@@ -11,7 +11,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates reopening an Activity with a GLSurfaceView
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class GLSurfaceViewReopenTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity
|
||||
import org.junit.Rule
|
||||
@@ -11,7 +11,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates if a GLSurfaceView surface can be recreated without crashing.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class GLSurfaceViewReuseTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class OrientationChangeTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxCountActivity
|
||||
import org.junit.Rule
|
||||
@@ -11,7 +11,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates reopening an Activity and querying the map before surface recreation #14394
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class QueryRenderedFeaturesBoxCountTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.testapp.activity.textureview.TextureViewDebugModeActivity
|
||||
import org.junit.Rule
|
||||
@@ -11,7 +11,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates reopening an Activity with a TextureView
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class TextureViewReopenTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.testapp.activity.maplayout.TextureRecyclerViewActivity
|
||||
import org.junit.Rule
|
||||
@@ -11,7 +11,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates if a GLSurfaceView surface can be recreated without crashing.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class TextureViewReuseTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.integration
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import androidx.test.uiautomator.UiSelector
|
||||
import com.mapbox.mapboxsdk.testapp.activity.fragment.ViewPagerActivity
|
||||
@@ -12,7 +12,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates MapFragment integration with a ViewPager
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class ViewPagerScrollTest : BaseIntegrationTest() {
|
||||
|
||||
@get:Rule
|
||||
|
||||
@@ -11,7 +11,7 @@ import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.UiController
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.*
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import com.mapbox.geojson.Point
|
||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
|
||||
@@ -35,7 +35,7 @@ import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class LocationComponentTest : EspressoTest() {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.location;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.BaseLayerTest;
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
@@ -39,7 +39,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for LocationIndicatorLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class LocationIndicatorLayerTest extends BaseLayerTest {
|
||||
|
||||
private LocationIndicatorLayer layer;
|
||||
|
||||
@@ -11,7 +11,7 @@ import androidx.test.espresso.UiController
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import androidx.test.rule.GrantPermissionRule.grant
|
||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
|
||||
@@ -40,7 +40,7 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import kotlin.math.abs
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class LocationLayerControllerTest : EspressoTest() {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.mapbox.mapboxsdk.maps
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.style.layers.Layer
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
abstract class BaseLayerTest : AppCenter() {
|
||||
private lateinit var nativeMapView: NativeMap
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.mapbox.mapboxsdk.maps
|
||||
|
||||
import androidx.test.annotation.UiThreadTest
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.Mapbox
|
||||
import com.mapbox.mapboxsdk.WellKnownTileServer
|
||||
import com.mapbox.mapboxsdk.storage.FileSource
|
||||
import com.mapbox.mapboxsdk.testapp.MapboxApplication
|
||||
import com.mapbox.mapboxsdk.util.TileServerOptions
|
||||
import org.junit.*
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class BootstrapTest : AppCenter() {
|
||||
|
||||
var apiKeyBackup: String? = null
|
||||
@@ -27,7 +26,7 @@ class BootstrapTest : AppCenter() {
|
||||
@UiThreadTest
|
||||
fun after() {
|
||||
val context = InstrumentationRegistry.getInstrumentation().context
|
||||
Mapbox.getInstance(context, apiKeyBackup, MapboxApplication.TILE_SERVER)
|
||||
Mapbox.getInstance(context)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.maps;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.AppCenter;
|
||||
import com.mapbox.mapboxsdk.Mapbox;
|
||||
@@ -18,7 +18,7 @@ import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertSame;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class MapboxTest extends AppCenter {
|
||||
|
||||
private static final String API_KEY = "pk.0000000001";
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mapbox.mapboxsdk.maps
|
||||
import android.content.Context
|
||||
import android.graphics.PointF
|
||||
import androidx.test.annotation.UiThreadTest
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.Mapbox
|
||||
@@ -14,7 +14,6 @@ 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.MapboxApplication
|
||||
import com.mapbox.mapboxsdk.testapp.utils.TestConstants
|
||||
import junit.framework.Assert.*
|
||||
import org.junit.After
|
||||
@@ -23,7 +22,7 @@ import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class NativeMapViewTest : AppCenter() {
|
||||
|
||||
private lateinit var nativeMapView: NativeMap
|
||||
@@ -55,7 +54,7 @@ class NativeMapViewTest : AppCenter() {
|
||||
fun after() {
|
||||
val context = InstrumentationRegistry.getInstrumentation().context
|
||||
val apiKey = Mapbox.getApiKey()
|
||||
Mapbox.getInstance(context, apiKey, MapboxApplication.TILE_SERVER)
|
||||
Mapbox.getInstance(context)
|
||||
nativeMapView.destroy()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.offline
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.geojson.Point
|
||||
import com.mapbox.mapboxsdk.log.Logger
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.TimeoutException
|
||||
/**
|
||||
* Integration test that validates downloading an offline region from a point geometry at zoomlevel 17
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class OfflineDownloadTest : OfflineRegion.OfflineRegionObserver {
|
||||
|
||||
@Rule
|
||||
@@ -42,7 +42,7 @@ class OfflineDownloadTest : OfflineRegion.OfflineRegionObserver {
|
||||
override fun onError(error: String) {
|
||||
Logger.e(TAG, "Error while creating offline region: $error")
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class OfflineDownloadTest : OfflineRegion.OfflineRegionObserver {
|
||||
17.0,
|
||||
17.0,
|
||||
1.0f,
|
||||
false
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.snapshotter
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.TimeoutException
|
||||
/**
|
||||
* Integration test that validates if a snapshotter creation
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class MapSnapshotterTest {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// 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 androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.<%- subPackage %>.<%- activity %>;
|
||||
@@ -17,7 +17,7 @@ import org.junit.runner.RunWith;
|
||||
/**
|
||||
* Sanity test for <%- activity %>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class <%- activity %>Test extends BaseTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -4,8 +4,8 @@ import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.testapp.R
|
||||
@@ -18,7 +18,7 @@ import org.junit.runner.RunWith
|
||||
/**
|
||||
* Regression test that validates that a map inside a DialogFragment can be opened and closed.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
@LargeTest
|
||||
class MapDialogFragmentTest : AppCenter() {
|
||||
|
||||
@@ -26,7 +26,7 @@ class MapDialogFragmentTest : AppCenter() {
|
||||
var activityRule: ActivityTestRule<MapInDialogActivity> = ActivityTestRule(MapInDialogActivity::class.java)
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Ignore("Probably does not work")
|
||||
fun openCloseDialog() {
|
||||
onView(withId(R.id.button_open_dialog)).perform(click())
|
||||
Thread.sleep(2500)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.testapp.maps
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.maps.MapView
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeoutException
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class ImageMissingTest : AppCenter() {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.maps
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeoutException
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class RemoveUnusedImagesTest : AppCenter() {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mapbox.mapboxsdk.testapp.maps
|
||||
import android.view.TextureView
|
||||
import android.view.ViewGroup
|
||||
import androidx.test.annotation.UiThreadTest
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.maps.MapView
|
||||
@@ -17,7 +17,7 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class RenderViewGetterTest : AppCenter() {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.maps
|
||||
|
||||
import android.graphics.PointF
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng
|
||||
@@ -17,7 +17,7 @@ import org.junit.runner.RunWith
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class ScreenCoordinateConversion : AppCenter() {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.maps
|
||||
|
||||
import androidx.test.espresso.UiController
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap
|
||||
import com.mapbox.mapboxsdk.maps.Style
|
||||
import com.mapbox.mapboxsdk.style.layers.SymbolLayer
|
||||
@@ -12,7 +12,7 @@ import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class StyleLoadTest : EspressoTest() {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.offline
|
||||
|
||||
import android.content.Context
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.offline.OfflineManager
|
||||
import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
|
||||
@@ -11,7 +11,7 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class CacheTest {
|
||||
|
||||
@Rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.offline
|
||||
|
||||
import android.content.Context
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.offline.OfflineManager
|
||||
@@ -18,7 +18,7 @@ import java.io.IOException
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class OfflineManagerTest : AppCenter() {
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.testapp.offline;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.AppCenter;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.OfflineUtils;
|
||||
@@ -15,7 +15,7 @@ import static com.mapbox.mapboxsdk.testapp.activity.offline.OfflineActivity.JSON
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class OfflineUtilsTest extends AppCenter {
|
||||
|
||||
private static final String REGION_NAME = "hello world";
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.Manifest;
|
||||
import androidx.test.espresso.IdlingPolicies;
|
||||
import androidx.test.espresso.IdlingRegistry;
|
||||
import androidx.test.espresso.IdlingResourceTimeoutException;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.rule.GrantPermissionRule;
|
||||
|
||||
@@ -32,7 +32,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
/**
|
||||
* Instrumentation render tests
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class RenderTest extends AppCenter {
|
||||
|
||||
private static final int RENDER_TEST_TIMEOUT = 30;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.storage
|
||||
|
||||
import androidx.test.annotation.UiThreadTest
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.storage.FileSource
|
||||
@@ -15,7 +15,7 @@ import org.junit.rules.TestName
|
||||
import org.junit.runner.RunWith
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
open class FileSourceMapTest : AppCenter() {
|
||||
|
||||
private lateinit var fileSourceTestUtils: FileSourceTestUtils
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.storage
|
||||
|
||||
import androidx.test.annotation.UiThreadTest
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import com.mapbox.mapboxsdk.AppCenter
|
||||
import com.mapbox.mapboxsdk.storage.FileSource
|
||||
@@ -12,7 +12,7 @@ import org.junit.runner.RunWith
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class FileSourceStandaloneTest : AppCenter() {
|
||||
|
||||
private lateinit var fileSourceTestUtils: FileSourceTestUtils
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.testapp.string;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
|
||||
|
||||
@@ -15,7 +15,7 @@ import static junit.framework.Assert.assertEquals;
|
||||
* See core test in https://github.com/mapbox/mapbox-gl-native/blob/master/test/util/text_conversions.test.cpp
|
||||
* </p>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class UppperLowerCaseTest extends EspressoTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.maps.BaseLayerTest;
|
||||
@@ -34,7 +34,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for BackgroundLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class BackgroundLayerTest extends BaseLayerTest {
|
||||
|
||||
private BackgroundLayer layer;
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.LineString;
|
||||
import com.mapbox.geojson.MultiLineString;
|
||||
@@ -61,7 +61,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for CircleLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class CircleLayerTest extends BaseLayerTest {
|
||||
|
||||
private CircleLayer layer;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import com.mapbox.geojson.Feature;
|
||||
import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
@@ -25,9 +21,11 @@ import com.mapbox.mapboxsdk.utils.ColorUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.IOException;
|
||||
import android.graphics.Color;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.FormatOption.formatFontScale;
|
||||
@@ -70,9 +68,8 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class ExpressionTest extends EspressoTest {
|
||||
|
||||
private FillLayer layer;
|
||||
|
||||
@Test
|
||||
@@ -87,7 +84,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
|
||||
// set color expression
|
||||
layer.setProperties(
|
||||
fillColor(inputExpression)
|
||||
fillColor(inputExpression)
|
||||
);
|
||||
|
||||
// get color value
|
||||
@@ -110,7 +107,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
|
||||
// set get expression
|
||||
layer.setProperties(
|
||||
fillColor(inputExpression)
|
||||
fillColor(inputExpression)
|
||||
);
|
||||
|
||||
// get actual expression
|
||||
@@ -133,15 +130,15 @@ public class ExpressionTest extends EspressoTest {
|
||||
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))
|
||||
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)
|
||||
fillColor(inputExpression)
|
||||
);
|
||||
|
||||
// get camera function expression
|
||||
@@ -164,7 +161,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
|
||||
// set camera function expression
|
||||
layer.setProperties(
|
||||
fillColor(inputExpression)
|
||||
fillColor(inputExpression)
|
||||
);
|
||||
|
||||
// get camera function expression
|
||||
@@ -184,22 +181,22 @@ public class ExpressionTest extends EspressoTest {
|
||||
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)
|
||||
))
|
||||
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)
|
||||
fillColor(inputExpression)
|
||||
);
|
||||
|
||||
// get camera function expression
|
||||
@@ -216,7 +213,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
setupStyle();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
layer.setProperties(
|
||||
fillColor(literal("#4286f4"))
|
||||
fillColor(literal("#4286f4"))
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -227,14 +224,14 @@ public class ExpressionTest extends EspressoTest {
|
||||
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"))
|
||||
stop("1", get("1")),
|
||||
stop("2", get("2")),
|
||||
stop("3", get("3")),
|
||||
stop("4", get("4"))
|
||||
);
|
||||
|
||||
layer.setProperties(
|
||||
fillColor(expression)
|
||||
fillColor(expression)
|
||||
);
|
||||
expression.toArray();
|
||||
});
|
||||
@@ -248,43 +245,43 @@ public class ExpressionTest extends EspressoTest {
|
||||
|
||||
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")));
|
||||
literal(1)), literal("en")));
|
||||
Expression expression3 = eq(literal("Łukasz"), literal("lukasz"), collator(literal(false), eq(literal(2),
|
||||
literal(1))));
|
||||
literal(1))));
|
||||
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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))
|
||||
)
|
||||
));
|
||||
.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());
|
||||
.isEmpty());
|
||||
|
||||
layer.setProperties(circleColor(
|
||||
switchCase(
|
||||
expression2, literal(ColorUtils.colorToRgbaString(Color.GREEN)),
|
||||
literal(ColorUtils.colorToRgbaString(Color.RED))
|
||||
)
|
||||
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());
|
||||
.isEmpty());
|
||||
|
||||
layer.setProperties(circleColor(
|
||||
switchCase(
|
||||
expression3, literal(ColorUtils.colorToRgbaString(Color.GREEN)),
|
||||
literal(ColorUtils.colorToRgbaString(Color.RED))
|
||||
)
|
||||
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());
|
||||
.isEmpty());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -294,18 +291,18 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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")
|
||||
formatEntry("test")
|
||||
);
|
||||
layer.setProperties(textField(expression));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(new FormattedSection("test")), layer.getTextField().getValue());
|
||||
});
|
||||
@@ -317,18 +314,18 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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))
|
||||
formatEntry("test", formatFontScale(1.75))
|
||||
);
|
||||
layer.setProperties(textField(expression));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(new FormattedSection("test", 1.75)), layer.getTextField().getValue());
|
||||
});
|
||||
@@ -340,26 +337,26 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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"})
|
||||
)
|
||||
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()
|
||||
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"})
|
||||
new FormattedSection("test",
|
||||
new String[]{"DIN Offc Pro Regular", "Arial Unicode MS Regular"})
|
||||
), layer.getTextField().getValue());
|
||||
});
|
||||
}
|
||||
@@ -370,25 +367,25 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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"))
|
||||
)
|
||||
formatEntry(
|
||||
literal("test"),
|
||||
formatTextColor(literal("yellow"))
|
||||
)
|
||||
);
|
||||
layer.setProperties(textField(expression));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(
|
||||
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
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)")
|
||||
new FormattedSection("test", null, null, "rgba(255,255,0,1)")
|
||||
), layer.getTextField().getValue());
|
||||
});
|
||||
}
|
||||
@@ -399,30 +396,30 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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))
|
||||
)
|
||||
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()
|
||||
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)")
|
||||
new FormattedSection("test",
|
||||
0.5,
|
||||
new String[]{"DIN Offc Pro Regular", "Arial Unicode MS Regular"},
|
||||
"rgba(126,0,0,1)")
|
||||
), layer.getTextField().getValue());
|
||||
});
|
||||
}
|
||||
@@ -433,31 +430,33 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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)"))))
|
||||
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()
|
||||
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)")
|
||||
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());
|
||||
});
|
||||
}
|
||||
@@ -476,18 +475,18 @@ public class ExpressionTest extends EspressoTest {
|
||||
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")))
|
||||
)
|
||||
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());
|
||||
.isEmpty());
|
||||
assertEquals(expression, layer.getTextField().getExpression());
|
||||
assertNull(layer.getTextField().getValue());
|
||||
});
|
||||
@@ -507,19 +506,19 @@ public class ExpressionTest extends EspressoTest {
|
||||
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))
|
||||
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());
|
||||
.isEmpty());
|
||||
assertEquals(expression, layer.getTextField().getExpression());
|
||||
assertNull(layer.getTextField().getValue());
|
||||
});
|
||||
@@ -531,7 +530,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
@@ -539,10 +538,10 @@ public class ExpressionTest extends EspressoTest {
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(
|
||||
new FormattedSection("test")), layer.getTextField().getValue());
|
||||
new FormattedSection("test")), layer.getTextField().getValue());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -552,20 +551,21 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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)")
|
||||
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());
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(formatted, layer.getTextField().getValue());
|
||||
});
|
||||
@@ -577,19 +577,19 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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"))
|
||||
)
|
||||
textField(
|
||||
numberFormat(12.345, locale("en-US"), currency("USD"))
|
||||
)
|
||||
);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("$12.35", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -602,19 +602,19 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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))
|
||||
)
|
||||
textField(
|
||||
numberFormat(12.34567890, maxFractionDigits(5), minFractionDigits(0))
|
||||
)
|
||||
);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("12.34568", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -627,19 +627,19 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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))
|
||||
)
|
||||
textField(
|
||||
numberFormat(12.0000001, maxFractionDigits(5), minFractionDigits(0))
|
||||
)
|
||||
);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("12", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -652,19 +652,20 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
.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))
|
||||
)
|
||||
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()
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("12,0", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -688,17 +689,17 @@ public class ExpressionTest extends EspressoTest {
|
||||
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")))
|
||||
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()
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
|
||||
assertNotNull(layer.getTextField().getExpression());
|
||||
@@ -706,10 +707,10 @@ public class ExpressionTest extends EspressoTest {
|
||||
// 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]);
|
||||
assertEquals("Number format should match", returnExpression[0], setExpression[0]);
|
||||
assertArrayEquals("Get value expression should match",
|
||||
(Object[]) returnExpression[1],
|
||||
(Object[]) setExpression[1]
|
||||
(Object[]) returnExpression[1],
|
||||
(Object[]) setExpression[1]
|
||||
);
|
||||
|
||||
// number format objects
|
||||
@@ -717,18 +718,18 @@ public class ExpressionTest extends EspressoTest {
|
||||
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")
|
||||
(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")
|
||||
(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")
|
||||
(Object[]) returnMap.get("locale"),
|
||||
(Object[]) setMap.get("locale")
|
||||
);
|
||||
});
|
||||
|
||||
@@ -743,16 +744,16 @@ public class ExpressionTest extends EspressoTest {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle().addSource(
|
||||
new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()))
|
||||
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))
|
||||
Expression input = interpolate(
|
||||
exponential(0.5f), zoom(),
|
||||
stop(-0.1, color(Color.RED)),
|
||||
stop(0, color(Color.BLUE))
|
||||
);
|
||||
|
||||
layer.setProperties(circleColor(input));
|
||||
@@ -766,21 +767,17 @@ public class ExpressionTest extends EspressoTest {
|
||||
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;
|
||||
}
|
||||
source = new GeoJsonSource("amsterdam-parks-source",
|
||||
ResourceUtils.readRawResource(rule.getActivity(), R.raw.amsterdam));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
|
||||
// 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)
|
||||
)
|
||||
.withProperties(
|
||||
fillColor(rgba(0.0f, 0.0f, 0.0f, 0.5f)),
|
||||
fillOutlineColor(rgb(0, 0, 255)),
|
||||
fillAntialias(true)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.LineString;
|
||||
import com.mapbox.geojson.MultiLineString;
|
||||
@@ -57,7 +57,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for FillExtrusionLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class FillExtrusionLayerTest extends BaseLayerTest {
|
||||
|
||||
private FillExtrusionLayer layer;
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.LineString;
|
||||
import com.mapbox.geojson.MultiLineString;
|
||||
@@ -57,7 +57,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for FillLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class FillLayerTest extends BaseLayerTest {
|
||||
|
||||
private FillLayer layer;
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.RawRes;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import com.mapbox.geojson.Feature;
|
||||
import com.mapbox.geojson.FeatureCollection;
|
||||
import com.mapbox.geojson.Point;
|
||||
@@ -23,11 +17,14 @@ import org.hamcrest.Matcher;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.IOException;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import timber.log.Timber;
|
||||
import androidx.annotation.RawRes;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -35,7 +32,7 @@ import static org.junit.Assert.assertEquals;
|
||||
/**
|
||||
* Tests for {@link GeoJsonSource}
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class GeoJsonSourceTests extends EspressoTest {
|
||||
|
||||
@Test
|
||||
@@ -43,12 +40,8 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
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);
|
||||
}
|
||||
source = new GeoJsonSource("source", FeatureCollection
|
||||
.fromJson(ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_collection)));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
@@ -69,12 +62,8 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
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);
|
||||
}
|
||||
source = new GeoJsonSource("source",
|
||||
ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_properties));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
@@ -90,17 +79,13 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
|
||||
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(ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_properties));
|
||||
|
||||
source.setGeoJson(Point.fromLngLat(20, 55));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
assertEquals(1, mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(
|
||||
new LatLng(55, 20)), "layer").size());
|
||||
mapboxMap.getProjection().toScreenLocation(
|
||||
new LatLng(55, 20)), "layer").size());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -163,11 +148,7 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
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);
|
||||
}
|
||||
source.setGeoJson(Feature.fromJson(ResourceUtils.readRawResource(rule.getActivity(), resource)));
|
||||
|
||||
mapboxMap.getStyle().removeLayer(layer);
|
||||
mapboxMap.getStyle().removeSource(source);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.LineString;
|
||||
import com.mapbox.geojson.MultiLineString;
|
||||
@@ -47,7 +47,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for HeatmapLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class HeatmapLayerTest extends BaseLayerTest {
|
||||
|
||||
private HeatmapLayer layer;
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.maps.BaseLayerTest;
|
||||
@@ -38,7 +38,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for HillshadeLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class HillshadeLayerTest extends BaseLayerTest {
|
||||
|
||||
private HillshadeLayer layer;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mapbox.mapboxsdk.testapp.style
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
|
||||
import com.mapbox.mapboxsdk.testapp.R
|
||||
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction
|
||||
import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
|
||||
@@ -15,7 +15,7 @@ import java.util.*
|
||||
/**
|
||||
* CRUD tests around Image
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@RunWith(AndroidJUnit4ClassRunner::class)
|
||||
class ImageTest : EspressoTest() {
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.view.View;
|
||||
|
||||
import androidx.test.espresso.UiController;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
|
||||
@@ -35,7 +35,7 @@ import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class LightTest extends BaseTest {
|
||||
|
||||
private Light light;
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.LineString;
|
||||
import com.mapbox.geojson.MultiLineString;
|
||||
@@ -66,7 +66,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for LineLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class LineLayerTest extends BaseLayerTest {
|
||||
|
||||
private LineLayer layer;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.maps.BaseLayerTest;
|
||||
@@ -38,7 +38,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for RasterLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class RasterLayerTest extends BaseLayerTest {
|
||||
|
||||
private RasterLayer layer;
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.view.View;
|
||||
|
||||
import androidx.test.espresso.UiController;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException;
|
||||
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
|
||||
@@ -47,7 +47,7 @@ import static org.junit.Assert.fail;
|
||||
/**
|
||||
* Basic smoke tests for Layer and Source
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class RuntimeStyleTests extends EspressoTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTimingTestActivity;
|
||||
@@ -11,7 +11,7 @@ import org.junit.runner.RunWith;
|
||||
/**
|
||||
* Basic smoke tests for adding Layer and Source as early as possible (in onCreate)
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class RuntimeStyleTimingTests extends BaseTest {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.LineString;
|
||||
import com.mapbox.geojson.MultiLineString;
|
||||
@@ -120,7 +120,7 @@ import static org.junit.Assert.assertNull;
|
||||
/**
|
||||
* Basic smoke tests for SymbolLayer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class SymbolLayerTest extends BaseLayerTest {
|
||||
|
||||
private SymbolLayer layer;
|
||||
|
||||
@@ -12,7 +12,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import android.graphics.Color;
|
||||
import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.geojson.LineString;
|
||||
import com.mapbox.geojson.MultiLineString;
|
||||
@@ -53,7 +53,7 @@ import java.util.List;
|
||||
/**
|
||||
* Basic smoke tests for <%- camelize(type) %>Layer
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class <%- camelize(type) %>LayerTest extends BaseLayerTest {
|
||||
|
||||
private <%- camelize(type) %>Layer layer;
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.mapbox.mapboxsdk.testapp.style;
|
||||
import android.graphics.Color;
|
||||
import androidx.test.espresso.UiController;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
import android.view.View;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.light.Light;
|
||||
@@ -38,7 +38,7 @@ import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class LightTest extends BaseTest {
|
||||
|
||||
private Light light;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.utils;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
|
||||
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.junit.runner.RunWith;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(AndroidJUnit4ClassRunner.class)
|
||||
public class FontUtilsTest {
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user