From 4dc96276f52448cb459f3ea3a6d32c7e49835d83 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 31 Oct 2018 10:16:13 +0100 Subject: [android] - remove wait for layer in expression tests --- .../mapboxsdk/testapp/style/ExpressionTest.java | 39 ---------------------- 1 file changed, 39 deletions(-) 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 index 0574f3e8e4..3fc4d73d22 100644 --- 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 @@ -290,9 +290,6 @@ public class ExpressionTest extends BaseActivityTest { formatEntry("test") ); layer.setProperties(textField(expression)); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") - .isEmpty()); assertNull(layer.getTextField().getExpression()); assertEquals("test", layer.getTextField().getValue()); @@ -318,9 +315,6 @@ public class ExpressionTest extends BaseActivityTest { formatEntry("test", formatFontScale(1.75)) ); layer.setProperties(textField(expression)); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") - .isEmpty()); assertNull(layer.getTextField().getExpression()); assertEquals("test", layer.getTextField().getValue()); @@ -350,10 +344,6 @@ public class ExpressionTest extends BaseActivityTest { ) ); layer.setProperties(textField(expression)); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse( - mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty() - ); assertNull(layer.getTextField().getExpression()); assertEquals("test", layer.getTextField().getValue()); @@ -384,10 +374,6 @@ public class ExpressionTest extends BaseActivityTest { ) ); layer.setProperties(textField(expression)); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse( - mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty() - ); assertNull(layer.getTextField().getExpression()); assertEquals("test", layer.getTextField().getValue()); @@ -417,10 +403,6 @@ public class ExpressionTest extends BaseActivityTest { formatEntry("\ntest2", formatFontScale(2)) ); layer.setProperties(textField(expression)); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse( - mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty() - ); assertNull(layer.getTextField().getExpression()); assertEquals("test\ntest2", layer.getTextField().getValue()); @@ -454,9 +436,6 @@ public class ExpressionTest extends BaseActivityTest { ) ); layer.setProperties(textField(expression)); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") - .isEmpty()); assertEquals(expression, layer.getTextField().getExpression()); assertNull(layer.getTextField().getValue()); @@ -487,9 +466,6 @@ public class ExpressionTest extends BaseActivityTest { formatEntry("\ntest2", formatFontScale(2)) ); layer.setProperties(textField(expression)); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") - .isEmpty()); assertEquals(expression, layer.getTextField().getExpression()); assertNull(layer.getTextField().getValue()); @@ -509,9 +485,6 @@ public class ExpressionTest extends BaseActivityTest { mapboxMap.addLayer(layer); layer.setProperties(textField("test")); - waitForLayer(uiController, mapboxMap, latLng); - assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") - .isEmpty()); assertNull(layer.getTextField().getExpression()); assertEquals("test", layer.getTextField().getValue()); @@ -522,18 +495,6 @@ public class ExpressionTest extends BaseActivityTest { }); } - private static final long WAIT_TIMEOUT = 5000; - private static final long WAIT_DELAY = 150; - - private static void waitForLayer(UiController uiController, MapboxMap mapboxMap, LatLng latLng) { - int i = 0; - while (mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()) { - i++; - assertFalse("Waiting for layer timed out", i * WAIT_DELAY > WAIT_TIMEOUT); - uiController.loopMainThreadForAtLeast(WAIT_DELAY); - } - } - private void setupStyle() { invoke(mapboxMap, (uiController, mapboxMap) -> { // Add a source -- cgit v1.2.1