Android Instrumentation Tests Improvements (#2321)
This commit is contained in:
@@ -3,15 +3,14 @@ package org.maplibre.android.testapp.activity.espresso
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import org.maplibre.android.maps.MapView
|
||||
import org.maplibre.android.maps.MapLibreMap
|
||||
import org.maplibre.android.maps.OnMapReadyCallback
|
||||
import org.maplibre.android.maps.Style
|
||||
import org.maplibre.android.testapp.R
|
||||
import timber.log.Timber
|
||||
|
||||
class DeviceIndependentTestActivity : AppCompatActivity() {
|
||||
private val TAG = "DeviceIndependentTestActivity"
|
||||
|
||||
class DeviceIndependentTestActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
lateinit var mapView: MapView
|
||||
lateinit var maplibreMap: MapLibreMap
|
||||
protected set
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@@ -20,12 +19,10 @@ class DeviceIndependentTestActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
// Initialize map as normal
|
||||
mapView = findViewById(R.id.mapView)
|
||||
mapView.onCreate(savedInstanceState)
|
||||
mapView.getMapAsync(this)
|
||||
}
|
||||
|
||||
override fun onMapReady(map: MapLibreMap) {
|
||||
maplibreMap = map
|
||||
maplibreMap.setStyle(Style.getPredefinedStyle("Streets"))
|
||||
mapView.getMapAsync {
|
||||
Timber.i(TAG, "Setting style")
|
||||
it.setStyle(Style.getPredefinedStyles()[0].url)
|
||||
}
|
||||
}
|
||||
|
||||
public override fun onResume() {
|
||||
|
||||
@@ -26,7 +26,8 @@ class PixelTestActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
|
||||
override fun onMapReady(map: MapLibreMap) {
|
||||
maplibreMap = map
|
||||
maplibreMap.setStyle(Style.getPredefinedStyle("Streets"))
|
||||
val styleURL = Style.getPredefinedStyles()[0].url
|
||||
maplibreMap.setStyle(styleURL)
|
||||
}
|
||||
|
||||
public override fun onResume() {
|
||||
|
||||
@@ -45,6 +45,8 @@ class OfflineActivity : AppCompatActivity(), DownloadRegionDialogListener {
|
||||
private var downloadRegion: Button? = null
|
||||
private var listRegions: Button? = null
|
||||
private var isEndNotified = false
|
||||
val STYLE_URL: String
|
||||
get() = Style.getPredefinedStyle("Streets")
|
||||
|
||||
/*
|
||||
* Offline objects
|
||||
@@ -312,8 +314,5 @@ class OfflineActivity : AppCompatActivity(), DownloadRegionDialogListener {
|
||||
// JSON encoding/decoding
|
||||
val JSON_CHARSET = Charsets.UTF_8
|
||||
const val JSON_FIELD_REGION_NAME = "FIELD_REGION_NAME"
|
||||
|
||||
// Style URL
|
||||
val STYLE_URL = Style.getPredefinedStyle("Streets")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class GridSourceActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
)
|
||||
map.setStyle(
|
||||
Style.Builder()
|
||||
.fromUri(Style.getPredefinedStyle("Streets"))
|
||||
.fromUri(Style.getPredefinedStyles()[0].url)
|
||||
.withLayer(layer!!)
|
||||
.withSource(source!!)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user