Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Allow literal property arguments #12018

Merged
merged 1 commit into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3582,6 +3582,12 @@ Object toValue() {
return literal;
}

@NonNull
@Override
public Object[] toArray() {
return new Object[] {"literal", literal};
}

/**
* Returns a string representation of the expression literal.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.support.annotation.NonNull;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.utils.ThreadUtils;
Expand All @@ -27,7 +26,7 @@ public Layer() {
/**
* Validates if layer interaction is happening on the UI thread
*/
protected void checkThread(){
protected void checkThread() {
ThreadUtils.checkThread("Layer");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ public void testCompositeFunction() {
});
}

@Test
public void testLiteralProperty() {
validateTestSetup();
setupStyle();
invoke(mapboxMap, (uiController, mapboxMap) -> {
layer.setProperties(
fillColor(literal("#4286f4"))
);
});
}

private void setupStyle() {
invoke(mapboxMap, (uiController, mapboxMap) -> {
// Add a source
Expand Down