summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/render/RenderTestDefinition.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/render/RenderTestDefinition.java')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/render/RenderTestDefinition.java86
1 files changed, 65 insertions, 21 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/render/RenderTestDefinition.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/render/RenderTestDefinition.java
index 502fb93080..72549f6143 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/render/RenderTestDefinition.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/render/RenderTestDefinition.java
@@ -1,35 +1,79 @@
package com.mapbox.mapboxsdk.testapp.activity.render;
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.snapshotter.MapSnapshotter;
public class RenderTestDefinition {
- private String name;
- private int width;
- private int height;
- private double[] center;
- private double zoom;
- private double tilt;
- private double bearing;
- private String styleUrl;
+ private final static int DEFAULT_WIDTH = 512;
+ private final static int DEFAULT_HEIGHT = 512;
+
+ private String category; // eg. background-color
+ private String name; // eg. colorSpace-hcl
+ private String styleJson;
+ private RenderTestStyleDefinition definition;
+
+ RenderTestDefinition(String category, String name, String styleJson, RenderTestStyleDefinition definition) {
+ this.category = category;
+ this.name = name;
+ this.styleJson = styleJson;
+ this.definition = definition;
+ }
public String getName() {
- return name.replaceAll(" ", "_").toLowerCase();
+ return name;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public int getWidth() {
+ RenderTestStyleDefinition.Test test = getTest();
+ if (test != null) {
+ Integer testWidth = test.getWidth();
+ if (testWidth != null && testWidth > 0) {
+ return testWidth;
+ }
+ }
+ return DEFAULT_WIDTH;
+ }
+
+ public int getHeight() {
+ RenderTestStyleDefinition.Test test = getTest();
+ if (test != null) {
+ Integer testHeight = test.getHeight();
+ if (testHeight != null && testHeight > 0) {
+ return testHeight;
+ }
+ }
+ return DEFAULT_HEIGHT;
+ }
+
+ public String getStyleJson() {
+ return styleJson;
+ }
+
+ public boolean hasOperations() {
+ return getTest().getOperations() != null;
+ }
+
+ public RenderTestStyleDefinition.Test getTest() {
+ return definition.getMetadata().getTest();
}
public MapSnapshotter.Options toOptions() {
return new MapSnapshotter
- .Options(width, height)
- .withStyle(styleUrl)
- .withCameraPosition(
- new CameraPosition.Builder()
- .target(new LatLng(center[0], center[1]))
- .zoom(zoom)
- .tilt(tilt)
- .bearing(bearing)
- .build()
- );
+ .Options(getWidth(), getHeight())
+ .withStyleJson(styleJson)
+ .withLogo(false);
+ }
+
+ @Override
+ public String toString() {
+ return "RenderTestDefinition{" +
+ "category='" + category + '\'' +
+ ", name='" + name + '\'' +
+ ", styleJson='" + styleJson + '\'' +
+ '}';
}
}