-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed typo in static map annotations and added tests for map annotations
- Loading branch information
“osana”
committed
Jul 24, 2018
1 parent
0dfbee7
commit e28b5f7
Showing
2 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...ticmap/src/test/java/com/mapbox/api/staticmap/v1/models/StaticPolylineAnnotationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.mapbox.api.staticmap.v1.models; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
public class StaticPolylineAnnotationTest { | ||
|
||
@Rule | ||
public final ExpectedException exception = ExpectedException.none(); | ||
|
||
@Test | ||
public void sanity() throws Exception { | ||
StaticPolylineAnnotation staticPolylineAnnotation = StaticPolylineAnnotation.builder() | ||
.polyline("test-polylineAnnotation") | ||
.build(); | ||
|
||
System.err.print(">>>>>>>> url=" +staticPolylineAnnotation.url()); | ||
|
||
// path-strokeWidth+strokeColor-strokeOpacity+fillColor-fillOpacity(polylineName) | ||
// assertTrue(staticPolylineAnnotation.url().contains("path-10.0+646464-0.5+323232-0.75(test-polylineAnnotation)")); | ||
} | ||
|
||
@Test | ||
public void polyline_ispresent() throws Exception { | ||
exception.expect(IllegalStateException.class); | ||
StaticPolylineAnnotation staticPolylineAnnotation = StaticPolylineAnnotation.builder() | ||
.build(); | ||
} | ||
|
||
@Test | ||
public void url_annotations() throws Exception { | ||
StaticPolylineAnnotation staticPolylineAnnotation = StaticPolylineAnnotation.builder() | ||
.polyline("test-polylineAnnotation") | ||
.strokeColor(100, 100, 100) | ||
.strokeWidth(10.0) | ||
.strokeOpacity(0.5f) | ||
.fillColor(50, 50, 50) | ||
.fillOpacity(0.75f) | ||
.build(); | ||
|
||
// path-{strokeWidth}+{strokeColor}-{strokeOpacity}+{fillColor}-{fillOpacity}({polyline}) | ||
assertTrue(staticPolylineAnnotation.url().contains("path-10.0+646464-0.5+323232-0.75(test-polylineAnnotation)")); | ||
} | ||
|
||
@Test | ||
public void url_annotations_stroke() throws Exception { | ||
StaticPolylineAnnotation staticPolylineAnnotation = StaticPolylineAnnotation.builder() | ||
.polyline("test-polylineAnnotation") | ||
.strokeColor(100, 100, 100) | ||
.strokeWidth(10.0) | ||
.strokeOpacity(0.5f) | ||
.build(); | ||
|
||
// path-{strokeWidth}+{strokeColor}-{strokeOpacity}+{fillColor}-{fillOpacity}({polyline}) | ||
assertTrue(staticPolylineAnnotation.url().contains("path-10.0+646464-0.5(test-polylineAnnotation)")); | ||
} | ||
|
||
@Test | ||
public void url_annotations_fill() throws Exception { | ||
StaticPolylineAnnotation staticPolylineAnnotation = StaticPolylineAnnotation.builder() | ||
.polyline("test-polylineAnnotation") | ||
.fillColor(50, 50, 50) | ||
.fillOpacity(0.75f) | ||
.build(); | ||
|
||
// path-{strokeWidth}+{strokeColor}-{strokeOpacity}+{fillColor}-{fillOpacity}({polyline}) | ||
assertTrue(staticPolylineAnnotation.url().contains("path+323232-0.75(test-polylineAnnotation)")); | ||
} | ||
} |