summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-15 14:09:06 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-16 12:26:35 -0700
commitcc1ea759a681cadcfd06fd7bdda79ca6deb38c62 (patch)
tree97ece422b0516b11979c84b8136f95aeabb1aa91 /test/api
parentc0f6e5ccefc67dbdaa6ab7c7ea75a2a2d0c3f2ae (diff)
downloadqtlocation-mapboxgl-cc1ea759a681cadcfd06fd7bdda79ca6deb38c62.tar.gz
[core, node, darwin, android, qt] Make image ID part of Image
More like Source and Layer.
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.test.cpp28
-rw-r--r--test/api/query.test.cpp2
2 files changed, 15 insertions, 15 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index 100187c587..9e85a74c5b 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -17,8 +17,8 @@ using namespace mbgl;
namespace {
std::unique_ptr<style::Image> namedMarker(const std::string& name) {
- PremultipliedImage image = decodeImage(util::read_file("test/fixtures/sprites/" + name));
- return std::make_unique<style::Image>(std::move(image), 1.0);
+ PremultipliedImage image = decodeImage(util::read_file("test/fixtures/sprites/" + name + ".png"));
+ return std::make_unique<style::Image>(name, std::move(image), 1.0);
}
class AnnotationTest {
@@ -43,7 +43,7 @@ TEST(Annotations, SymbolAnnotation) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.addAnnotation(SymbolAnnotation { Point<double>(0, 0), "default_marker" });
test.checkRendering("point_annotation");
@@ -148,7 +148,7 @@ TEST(Annotations, AddMultiple) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.addAnnotation(SymbolAnnotation { Point<double> { -10, 0 }, "default_marker" });
test::render(test.map, test.view);
@@ -175,8 +175,8 @@ TEST(Annotations, UpdateSymbolAnnotationGeometry) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
- test.map.addAnnotationImage("flipped_marker", namedMarker("flipped_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
+ test.map.addAnnotationImage(namedMarker("flipped_marker"));
AnnotationID point = test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" });
test::render(test.map, test.view);
@@ -189,8 +189,8 @@ TEST(Annotations, UpdateSymbolAnnotationIcon) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
- test.map.addAnnotationImage("flipped_marker", namedMarker("flipped_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
+ test.map.addAnnotationImage(namedMarker("flipped_marker"));
AnnotationID point = test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" });
test::render(test.map, test.view);
@@ -271,7 +271,7 @@ TEST(Annotations, RemovePoint) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
AnnotationID point = test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" });
test::render(test.map, test.view);
@@ -310,7 +310,7 @@ TEST(Annotations, SwitchStyle) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" });
test::render(test.map, test.view);
@@ -323,7 +323,7 @@ TEST(Annotations, QueryRenderedFeatures) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" });
test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 50 }, "default_marker" });
@@ -347,7 +347,7 @@ TEST(Annotations, QueryFractionalZoomLevels) {
auto box = ScreenBox { {}, { double(viewSize.width), double(viewSize.height) } };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
std::vector<mbgl::AnnotationID> ids;
for (int longitude = 0; longitude < 10; ++longitude) {
@@ -379,7 +379,7 @@ TEST(Annotations, VisibleFeatures) {
auto box = ScreenBox { {}, { double(viewSize.width), double(viewSize.height) } };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.setLatLngZoom({ 5, 5 }, 3);
std::vector<mbgl::AnnotationID> ids;
@@ -432,7 +432,7 @@ TEST(Annotations, DebugSparse) {
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.setDebug(MapDebugOptions::TileBorders);
test.map.setZoom(1);
- test.map.addAnnotationImage("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.addAnnotation(SymbolAnnotation { Point<double>(10, 10), "default_marker" });
test.checkRendering("debug_sparse");
diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp
index c509753d2d..5b7f7c00ff 100644
--- a/test/api/query.test.cpp
+++ b/test/api/query.test.cpp
@@ -20,7 +20,7 @@ class QueryTest {
public:
QueryTest() {
map.setStyleJSON(util::read_file("test/fixtures/api/query_style.json"));
- map.addImage("test-icon", std::make_unique<style::Image>(
+ map.addImage(std::make_unique<style::Image>("test-icon",
decodeImage(util::read_file("test/fixtures/sprites/default_marker.png")), 1.0));
test::render(map, view);