[android] - instrumentation tests upgrade, move view checking to utility class, remove inheritance in runtime style test (#6803)

update gitignore for generated tests

add camera move test

add realtime geojson to be excluded when generating Activity sanity tests

by default show workaround for showing a MapView in a dialog

add annotation tests

remove older camera tests, introduce tests for move, ease and animate, bring back setLatLng and getLatLng on MapView, add tests for internal camera API.

compass view tests

add tests for attribution and logo.

fix annotation tests

Rename Actiivity test class, split up annotation tests, added MarkerView tests, added infowindow tests, added MyLocationView tests

fix addRemoveLayer test by integrating map interactions inside a ViewAction
This commit is contained in:
Tobrun
2016-11-09 12:56:49 +01:00
committed by GitHub
parent 2411ec83b1
commit 33aa14c939
62 changed files with 2241 additions and 1342 deletions

View File

@@ -446,9 +446,10 @@
android:value="@string/category_maplayout" />
</activity>
<!-- For Unit tests -->
<!-- For Instrumentation tests -->
<activity android:name=".activity.style.RuntimeStyleTestActivity" />
<activity android:name=".activity.style.RuntimeStyleTimingTestActivity" />
<activity android:name=".activity.espresso.EspressoTestActivity" />
<!-- Configuration Settings -->
<meta-data

View File

@@ -327,12 +327,12 @@ public class MarkerViewActivity extends AppCompatActivity {
/**
* Adapts a MarkerView to display text in a TextView.
*/
private static class TextAdapter extends MapboxMap.MarkerViewAdapter<TextMarkerView> {
public static class TextAdapter extends MapboxMap.MarkerViewAdapter<TextMarkerView> {
private LayoutInflater inflater;
private MapboxMap mapboxMap;
TextAdapter(@NonNull Context context, @NonNull MapboxMap mapboxMap) {
public TextAdapter(@NonNull Context context, @NonNull MapboxMap mapboxMap) {
super(context);
this.inflater = LayoutInflater.from(context);
this.mapboxMap = mapboxMap;

View File

@@ -0,0 +1,80 @@
package com.mapbox.mapboxsdk.testapp.activity.espresso;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.testapp.R;
/**
* Base activity for instrumentation testing
*/
public class EspressoTestActivity extends AppCompatActivity implements OnMapReadyCallback {
public MapView mapView;
protected MapboxMap mapboxMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera_test);
//Initialize map as normal
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
@Override
public void onMapReady(MapboxMap map) {
mapboxMap = map;
}
public MapboxMap getMapboxMap() {
return mapboxMap;
}
@Override
public void onResume() {
super.onResume();
mapView.onResume();
}
@Override
protected void onStart() {
super.onStart();
mapView.onStart();
}
@Override
public void onPause() {
super.onPause();
mapView.onPause();
}
@Override
protected void onStop() {
super.onStop();
mapView.onStop();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapView.onLowMemory();
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/primary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<!-- TODO remove zoom #6747-->
<com.mapbox.mapboxsdk.maps.MapView
android:id="@id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
app:mapbox_cameraZoom="1" />
</RelativeLayout>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -12,7 +11,8 @@
android:layout_height="match_parent"
mapbox:mapbox_cameraTargetLat="47.6077"
mapbox:mapbox_cameraTargetLng="-122.3421"
mapbox:mapbox_styleUrl="mapbox://styles/mapbox/streets-v9"
mapbox:mapbox_cameraZoom="11"/>
mapbox:mapbox_cameraZoom="11"
mapbox:mapbox_renderTextureMode="true"
mapbox:mapbox_styleUrl="mapbox://styles/mapbox/streets-v9" />
</LinearLayout>