summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesExecutionTimeTest.java
blob: 534291d8aba2cf70a8a6f6dc4b3b39e30496fdb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.mapbox.mapboxsdk.testapp.feature;

import android.graphics.PointF;
import android.support.test.espresso.UiController;

import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.style.CircleLayerActivity;

import org.junit.Test;

import timber.log.Timber;

public class QueryRenderedFeaturesExecutionTimeTest extends BaseActivityTest {

  @Override
  protected Class getActivityClass() {
    return CircleLayerActivity.class;
  }

  @Test
  public void testQueryRenderedFeaturesExecutionTime() {
    validateTestSetup();
    MapboxMapAction.invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
      @Override
      public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
        PointF point = new PointF(519.4336f, 1086.6211f);

        long startTime = System.currentTimeMillis();
        mapboxMap.queryRenderedFeatures(point, true);
        long stopTime = System.currentTimeMillis();
        long elapsedTime = stopTime - startTime;
        Timber.e("Execution time with testQueryRenderedFeaturesExecutionTime: %s", elapsedTime);

        startTime = System.currentTimeMillis();
        mapboxMap.queryRenderedFeatures(point, false);
        stopTime = System.currentTimeMillis();
        elapsedTime = stopTime - startTime;
        Timber.e("Execution time with testQueryRenderedFeaturesWithoutGeometryExecutionTime: %s", elapsedTime);
      }
    });
  }
}