Update generate-style-code and add sort key api for LineLayer and FillLayer. (#209)

This commit is contained in:
Kevin Li
2020-03-06 16:59:32 +08:00
committed by GitHub
parent 77b2ac8ef7
commit 04722fdefd
26 changed files with 201 additions and 28 deletions

View File

@@ -10,11 +10,13 @@ import com.mapbox.mapboxsdk.maps.BaseLayerTest;
import org.junit.Before;
import timber.log.Timber;
import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.layers.BackgroundLayer;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
import static org.junit.Assert.*;
import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;

View File

@@ -99,6 +99,32 @@ public class FillLayerTest extends BaseLayerTest {
@Test
@UiThreadTest
public void testFillSortKeyAsConstant() {
Timber.i("fill-sort-key");
assertNotNull(layer);
assertNull(layer.getFillSortKey().getValue());
// Set and Get
Float propertyValue = 0.3f;
layer.setProperties(fillSortKey(propertyValue));
assertEquals(layer.getFillSortKey().getValue(), propertyValue);
}
@Test
@UiThreadTest
public void testFillSortKeyAsExpression() {
Timber.i("fill-sort-key-expression");
assertNotNull(layer);
assertNull(layer.getFillSortKey().getExpression());
// Set and Get
Expression expression = number(Expression.get("undefined"));
layer.setProperties(fillSortKey(expression));
assertEquals(layer.getFillSortKey().getExpression(), expression);
}
@Test
@UiThreadTest
public void testFillAntialiasAsConstant() {

View File

@@ -2,6 +2,7 @@
package com.mapbox.mapboxsdk.testapp.style;
import android.graphics.Color;
import androidx.test.annotation.UiThreadTest;
import androidx.test.ext.junit.runners.AndroidJUnit4;

View File

@@ -10,11 +10,13 @@ import com.mapbox.mapboxsdk.maps.BaseLayerTest;
import org.junit.Before;
import timber.log.Timber;
import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.layers.HillshadeLayer;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
import static org.junit.Assert.*;
import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;

View File

@@ -164,6 +164,32 @@ public class LineLayerTest extends BaseLayerTest {
assertEquals(layer.getLineRoundLimit().getValue(), propertyValue);
}
@Test
@UiThreadTest
public void testLineSortKeyAsConstant() {
Timber.i("line-sort-key");
assertNotNull(layer);
assertNull(layer.getLineSortKey().getValue());
// Set and Get
Float propertyValue = 0.3f;
layer.setProperties(lineSortKey(propertyValue));
assertEquals(layer.getLineSortKey().getValue(), propertyValue);
}
@Test
@UiThreadTest
public void testLineSortKeyAsExpression() {
Timber.i("line-sort-key-expression");
assertNotNull(layer);
assertNull(layer.getLineSortKey().getExpression());
// Set and Get
Expression expression = number(Expression.get("undefined"));
layer.setProperties(lineSortKey(expression));
assertEquals(layer.getLineSortKey().getExpression(), expression);
}
@Test
@UiThreadTest
public void testLineOpacityTransition() {

View File

@@ -2,6 +2,7 @@
package com.mapbox.mapboxsdk.testapp.style;
import android.graphics.Color;
import androidx.test.annotation.UiThreadTest;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -9,11 +10,13 @@ import com.mapbox.mapboxsdk.maps.BaseLayerTest;
import org.junit.Before;
import timber.log.Timber;
import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.layers.RasterLayer;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
import static org.junit.Assert.*;
import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;

View File

@@ -7,7 +7,7 @@
package com.mapbox.mapboxsdk.testapp.style;
import android.graphics.Color;
import android.support.test.annotation.UiThreadTest;
import androidx.test.annotation.UiThreadTest;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.mapbox.mapboxsdk.maps.BaseLayerTest;

View File

@@ -4,8 +4,8 @@
package com.mapbox.mapboxsdk.testapp.style;
import android.graphics.Color;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import androidx.test.espresso.UiController;
import androidx.test.espresso.ViewAction;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import android.view.View;
@@ -24,9 +24,9 @@ import org.hamcrest.Matcher;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
import static com.mapbox.mapboxsdk.style.layers.Property.ANCHOR_MAP;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionBase;