summaryrefslogtreecommitdiff
path: root/test/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixtures')
-rw-r--r--test/fixtures/annotations/update_icon/expected.pngbin0 -> 2949 bytes
-rw-r--r--test/fixtures/annotations/update_point/expected.pngbin2949 -> 2504 bytes
-rw-r--r--test/fixtures/offline/0-0-0.vector.pbf (renamed from test/fixtures/stale/0-0-0.vector.pbf)bin482553 -> 482553 bytes
-rw-r--r--test/fixtures/offline/empty.style.json5
-rw-r--r--test/fixtures/offline/expected.pngbin0 -> 47842 bytes
-rw-r--r--test/fixtures/offline/geojson.json4
-rw-r--r--test/fixtures/offline/geojson_source.style.json10
-rw-r--r--test/fixtures/offline/glyph.pbf (renamed from test/fixtures/stale/glyph.pbf)bin74722 -> 74722 bytes
-rw-r--r--test/fixtures/offline/inline_source.style.json17
-rw-r--r--test/fixtures/offline/sprite.json (renamed from test/fixtures/stale/sprite.json)0
-rw-r--r--test/fixtures/offline/sprite.png (renamed from test/fixtures/stale/sprite.png)bin3351 -> 3351 bytes
-rw-r--r--test/fixtures/offline/streets.json (renamed from test/fixtures/stale/streets.json)2
-rw-r--r--test/fixtures/offline/style.json (renamed from test/fixtures/stale/style_and_glyphs.json)10
-rw-r--r--test/fixtures/stale/stale_style/expected.pngbin13447 -> 0 bytes
-rw-r--r--test/fixtures/stale/stale_style_and_glyphs/expected.pngbin36120 -> 0 bytes
-rw-r--r--test/fixtures/stale/stale_style_and_sprite/expected.pngbin26859 -> 0 bytes
-rw-r--r--test/fixtures/stale/stale_style_and_tilejson/expected.pngbin13447 -> 0 bytes
-rw-r--r--test/fixtures/stale/style.json25
-rw-r--r--test/fixtures/stale/style_and_sprite.json26
-rw-r--r--test/fixtures/stale/style_and_tilejson.json25
-rw-r--r--test/fixtures/stub_file_source.cpp11
-rw-r--r--test/fixtures/stub_file_source.hpp18
-rw-r--r--test/fixtures/style_parser/font_stacks.json38
-rw-r--r--test/fixtures/style_parser/tilejson.raster.json2
-rw-r--r--test/fixtures/style_parser/tilejson.vector.json2
-rw-r--r--test/fixtures/util.cpp12
-rw-r--r--test/fixtures/util.hpp4
27 files changed, 103 insertions, 108 deletions
diff --git a/test/fixtures/annotations/update_icon/expected.png b/test/fixtures/annotations/update_icon/expected.png
new file mode 100644
index 0000000000..3b6ca22747
--- /dev/null
+++ b/test/fixtures/annotations/update_icon/expected.png
Binary files differ
diff --git a/test/fixtures/annotations/update_point/expected.png b/test/fixtures/annotations/update_point/expected.png
index 3b6ca22747..02cf77df8d 100644
--- a/test/fixtures/annotations/update_point/expected.png
+++ b/test/fixtures/annotations/update_point/expected.png
Binary files differ
diff --git a/test/fixtures/stale/0-0-0.vector.pbf b/test/fixtures/offline/0-0-0.vector.pbf
index a0f049ad43..a0f049ad43 100644
--- a/test/fixtures/stale/0-0-0.vector.pbf
+++ b/test/fixtures/offline/0-0-0.vector.pbf
Binary files differ
diff --git a/test/fixtures/offline/empty.style.json b/test/fixtures/offline/empty.style.json
new file mode 100644
index 0000000000..61a8fadcdb
--- /dev/null
+++ b/test/fixtures/offline/empty.style.json
@@ -0,0 +1,5 @@
+{
+ "version": 8,
+ "sources": {},
+ "layers": []
+}
diff --git a/test/fixtures/offline/expected.png b/test/fixtures/offline/expected.png
new file mode 100644
index 0000000000..1b1c2be4c6
--- /dev/null
+++ b/test/fixtures/offline/expected.png
Binary files differ
diff --git a/test/fixtures/offline/geojson.json b/test/fixtures/offline/geojson.json
new file mode 100644
index 0000000000..8b3698faf7
--- /dev/null
+++ b/test/fixtures/offline/geojson.json
@@ -0,0 +1,4 @@
+{
+ "type": "FeatureCollection",
+ "features": []
+}
diff --git a/test/fixtures/offline/geojson_source.style.json b/test/fixtures/offline/geojson_source.style.json
new file mode 100644
index 0000000000..511fca9fd0
--- /dev/null
+++ b/test/fixtures/offline/geojson_source.style.json
@@ -0,0 +1,10 @@
+{
+ "version": 8,
+ "sources": {
+ "geojson": {
+ "type": "geojson",
+ "data": "http://127.0.0.1:3000/offline/geojson.json"
+ }
+ },
+ "layers": []
+}
diff --git a/test/fixtures/stale/glyph.pbf b/test/fixtures/offline/glyph.pbf
index 0d160f7898..0d160f7898 100644
--- a/test/fixtures/stale/glyph.pbf
+++ b/test/fixtures/offline/glyph.pbf
Binary files differ
diff --git a/test/fixtures/offline/inline_source.style.json b/test/fixtures/offline/inline_source.style.json
new file mode 100644
index 0000000000..87155d07d8
--- /dev/null
+++ b/test/fixtures/offline/inline_source.style.json
@@ -0,0 +1,17 @@
+{
+ "version": 8,
+ "sources": {
+ "inline": {
+ "type": "vector",
+ "maxzoom": 15,
+ "minzoom": 0,
+ "tiles": [ "http://127.0.0.1:3000/offline/{z}-{x}-{y}.vector.pbf" ]
+ }
+ },
+ "layers": [{
+ "id": "fill",
+ "type": "fill",
+ "source": "inline",
+ "source-layer": "water"
+ }]
+}
diff --git a/test/fixtures/stale/sprite.json b/test/fixtures/offline/sprite.json
index e640365519..e640365519 100644
--- a/test/fixtures/stale/sprite.json
+++ b/test/fixtures/offline/sprite.json
diff --git a/test/fixtures/stale/sprite.png b/test/fixtures/offline/sprite.png
index a02d8eb542..a02d8eb542 100644
--- a/test/fixtures/stale/sprite.png
+++ b/test/fixtures/offline/sprite.png
Binary files differ
diff --git a/test/fixtures/stale/streets.json b/test/fixtures/offline/streets.json
index 11cb5c8557..805bd68f45 100644
--- a/test/fixtures/stale/streets.json
+++ b/test/fixtures/offline/streets.json
@@ -10,5 +10,5 @@
"name": "Streets",
"scheme": "xyz",
"tilejson": "2.0.0",
- "tiles": [ "asset://test/fixtures/stale/{z}-{x}-{y}.vector.pbf" ]
+ "tiles": [ "http://127.0.0.1:3000/offline/{z}-{x}-{y}.vector.pbf" ]
}
diff --git a/test/fixtures/stale/style_and_glyphs.json b/test/fixtures/offline/style.json
index adf91705fb..c34ee59893 100644
--- a/test/fixtures/stale/style_and_glyphs.json
+++ b/test/fixtures/offline/style.json
@@ -4,10 +4,11 @@
"sources": {
"mapbox": {
"type": "vector",
- "url": "asset://test/fixtures/stale/streets.json"
+ "url": "http://127.0.0.1:3000/offline/streets.json"
}
},
- "glyphs": "http://127.0.0.1:3000/stale/{fontstack}/{range}.pbf",
+ "glyphs": "http://127.0.0.1:3000/offline/{fontstack}/{range}.pbf",
+ "sprite": "http://127.0.0.1:3000/offline/sprite",
"layers": [{
"id": "background",
"type": "background",
@@ -20,7 +21,7 @@
"source": "mapbox",
"source-layer": "water",
"paint": {
- "fill-color": "blue"
+ "fill-pattern": "noise"
}
}, {
"id": "admin",
@@ -28,7 +29,8 @@
"source": "mapbox",
"source-layer": "admin",
"layout": {
- "text-field": "Text"
+ "text-font": ["Helvetica"],
+ "text-field": "Text"
},
"paint": {
"text-color": "black",
diff --git a/test/fixtures/stale/stale_style/expected.png b/test/fixtures/stale/stale_style/expected.png
deleted file mode 100644
index d3c6ef3cd5..0000000000
--- a/test/fixtures/stale/stale_style/expected.png
+++ /dev/null
Binary files differ
diff --git a/test/fixtures/stale/stale_style_and_glyphs/expected.png b/test/fixtures/stale/stale_style_and_glyphs/expected.png
deleted file mode 100644
index d8dbda1092..0000000000
--- a/test/fixtures/stale/stale_style_and_glyphs/expected.png
+++ /dev/null
Binary files differ
diff --git a/test/fixtures/stale/stale_style_and_sprite/expected.png b/test/fixtures/stale/stale_style_and_sprite/expected.png
deleted file mode 100644
index 171599bf5c..0000000000
--- a/test/fixtures/stale/stale_style_and_sprite/expected.png
+++ /dev/null
Binary files differ
diff --git a/test/fixtures/stale/stale_style_and_tilejson/expected.png b/test/fixtures/stale/stale_style_and_tilejson/expected.png
deleted file mode 100644
index d3c6ef3cd5..0000000000
--- a/test/fixtures/stale/stale_style_and_tilejson/expected.png
+++ /dev/null
Binary files differ
diff --git a/test/fixtures/stale/style.json b/test/fixtures/stale/style.json
deleted file mode 100644
index ca86503d4f..0000000000
--- a/test/fixtures/stale/style.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "version": 8,
- "name": "Water",
- "sources": {
- "mapbox": {
- "type": "vector",
- "url": "asset://test/fixtures/stale/streets.json"
- }
- },
- "layers": [{
- "id": "background",
- "type": "background",
- "paint": {
- "background-color": "red"
- }
- }, {
- "id": "water",
- "type": "fill",
- "source": "mapbox",
- "source-layer": "water",
- "paint": {
- "fill-color": "blue"
- }
- }]
-}
diff --git a/test/fixtures/stale/style_and_sprite.json b/test/fixtures/stale/style_and_sprite.json
deleted file mode 100644
index 61e3214a5e..0000000000
--- a/test/fixtures/stale/style_and_sprite.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "version": 8,
- "name": "Water",
- "sources": {
- "mapbox": {
- "type": "vector",
- "url": "asset://test/fixtures/stale/streets.json"
- }
- },
- "sprite": "http://127.0.0.1:3000/stale/sprite",
- "layers": [{
- "id": "background",
- "type": "background",
- "paint": {
- "background-color": "red"
- }
- }, {
- "id": "water",
- "type": "fill",
- "source": "mapbox",
- "source-layer": "water",
- "paint": {
- "fill-pattern": "noise"
- }
- }]
-}
diff --git a/test/fixtures/stale/style_and_tilejson.json b/test/fixtures/stale/style_and_tilejson.json
deleted file mode 100644
index f2a4fddd0b..0000000000
--- a/test/fixtures/stale/style_and_tilejson.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "version": 8,
- "name": "Water",
- "sources": {
- "mapbox": {
- "type": "vector",
- "url": "http://127.0.0.1:3000/stale/streets.json"
- }
- },
- "layers": [{
- "id": "background",
- "type": "background",
- "paint": {
- "background-color": "red"
- }
- }, {
- "id": "water",
- "type": "fill",
- "source": "mapbox",
- "source-layer": "water",
- "paint": {
- "fill-color": "blue"
- }
- }]
-}
diff --git a/test/fixtures/stub_file_source.cpp b/test/fixtures/stub_file_source.cpp
index 9eb37b7928..b41eded084 100644
--- a/test/fixtures/stub_file_source.cpp
+++ b/test/fixtures/stub_file_source.cpp
@@ -19,11 +19,12 @@ public:
StubFileSource::StubFileSource() {
timer.start(10ms, 10ms, [this] {
- // Explicit move to avoid iterator invalidation if ~StubFileRequest gets called within the loop.
- auto pending_ = std::move(pending);
+ // Explicit copy to avoid iterator invalidation if ~StubFileRequest gets called within the loop.
+ auto pending_ = pending;
for (auto& pair : pending_) {
- if (pair.second.first) {
- pair.second.second(*pair.second.first);
+ optional<Response> res = std::get<1>(pair.second)(std::get<0>(pair.second));
+ if (res) {
+ std::get<2>(pair.second)(*res);
}
}
});
@@ -33,7 +34,7 @@ StubFileSource::~StubFileSource() = default;
std::unique_ptr<FileRequest> StubFileSource::request(const Resource& resource, Callback callback) {
auto req = std::make_unique<StubFileRequest>(*this);
- pending.emplace(req.get(), std::make_pair(response(resource), callback));
+ pending.emplace(req.get(), std::make_tuple(resource, response, callback));
return std::move(req);
}
diff --git a/test/fixtures/stub_file_source.hpp b/test/fixtures/stub_file_source.hpp
index 344dff6073..dbb584fdcc 100644
--- a/test/fixtures/stub_file_source.hpp
+++ b/test/fixtures/stub_file_source.hpp
@@ -15,18 +15,20 @@ public:
std::unique_ptr<FileRequest> request(const Resource&, Callback) override;
+ using ResponseFunction = std::function<optional<Response> (const Resource&)>;
+
// You can set the response callback on a global level by assigning this callback:
- std::function<optional<Response> (const Resource&)> response = [this] (const Resource& resource) {
+ ResponseFunction response = [this] (const Resource& resource) {
return defaultResponse(resource);
};
// Or set per-kind responses by setting these callbacks:
- std::function<optional<Response> (const Resource&)> styleResponse;
- std::function<optional<Response> (const Resource&)> sourceResponse;
- std::function<optional<Response> (const Resource&)> tileResponse;
- std::function<optional<Response> (const Resource&)> glyphsResponse;
- std::function<optional<Response> (const Resource&)> spriteJSONResponse;
- std::function<optional<Response> (const Resource&)> spriteImageResponse;
+ ResponseFunction styleResponse;
+ ResponseFunction sourceResponse;
+ ResponseFunction tileResponse;
+ ResponseFunction glyphsResponse;
+ ResponseFunction spriteJSONResponse;
+ ResponseFunction spriteImageResponse;
private:
friend class StubFileRequest;
@@ -34,7 +36,7 @@ private:
// The default behavior is to throw if no per-kind callback has been set.
optional<Response> defaultResponse(const Resource&);
- std::unordered_map<FileRequest*, std::pair<optional<Response>, Callback>> pending;
+ std::unordered_map<FileRequest*, std::tuple<Resource, ResponseFunction, Callback>> pending;
util::Timer timer;
};
diff --git a/test/fixtures/style_parser/font_stacks.json b/test/fixtures/style_parser/font_stacks.json
new file mode 100644
index 0000000000..07fe223d46
--- /dev/null
+++ b/test/fixtures/style_parser/font_stacks.json
@@ -0,0 +1,38 @@
+{
+ "version": 8,
+ "sources": {
+ "source": {
+ "type": "vector",
+ "tiles": []
+ }
+ },
+ "layers": [{
+ "id": "a",
+ "type": "symbol",
+ "source": "source",
+ "source-layer": "source-layer",
+ "layout": {
+ "text-font": ["a"]
+ }
+ }, {
+ "id": "a,b",
+ "type": "symbol",
+ "source": "source",
+ "source-layer": "source-layer",
+ "layout": {
+ "text-font": {
+ "stops": [[0, ["a", "b"]]]
+ }
+ }
+ }, {
+ "id": "a,b;a,b,c",
+ "type": "symbol",
+ "source": "source",
+ "source-layer": "source-layer",
+ "layout": {
+ "text-font": {
+ "stops": [[0, ["a", "b"]], [1, ["a", "b", "c"]]]
+ }
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/tilejson.raster.json b/test/fixtures/style_parser/tilejson.raster.json
index 2eb0971a03..3fc819f292 100644
--- a/test/fixtures/style_parser/tilejson.raster.json
+++ b/test/fixtures/style_parser/tilejson.raster.json
@@ -4,5 +4,5 @@
"center": [ 1, 2, 3 ],
"bounds": [ 4, 5, 6, 7 ],
"attribution": "attribution",
- "tiles": [ "http://a.tiles.mapbox.com/mapbox.satellite/{z}-{x}-{y}.png?access_token=key" ]
+ "tiles": [ "http://a.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=key" ]
}
diff --git a/test/fixtures/style_parser/tilejson.vector.json b/test/fixtures/style_parser/tilejson.vector.json
index ea7d4bc352..9144bd502c 100644
--- a/test/fixtures/style_parser/tilejson.vector.json
+++ b/test/fixtures/style_parser/tilejson.vector.json
@@ -4,5 +4,5 @@
"center": [ 1, 2, 3 ],
"bounds": [ 4, 5, 6, 7 ],
"attribution": "attribution",
- "tiles": [ "http://a.tiles.mapbox.com/mapbox.streets/{z}-{x}-{y}.vector.pbf?access_token=key" ]
+ "tiles": [ "http://a.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.vector.pbf?access_token=key" ]
}
diff --git a/test/fixtures/util.cpp b/test/fixtures/util.cpp
index fcb6abed4e..5617b15e8b 100644
--- a/test/fixtures/util.cpp
+++ b/test/fixtures/util.cpp
@@ -106,20 +106,12 @@ uint64_t crc64(const PremultipliedImage &image) {
return crc64(reinterpret_cast<const char*>(image.data.get()), image.size());
}
-PremultipliedImage render(Map& map, Milliseconds timeout) {
+PremultipliedImage render(Map& map) {
std::promise<PremultipliedImage> promise;
map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) {
promise.set_value(std::move(image));
});
-
- // Limit maximum wait time.
- auto future = promise.get_future();
- if (future.wait_for(timeout) != std::future_status::ready) {
- // Alas, we didn't get the promised future :(
- Log::Error(Event::Image, "Failed to generate image within %dms", timeout.count());
- return { 0, 0 };
- }
- return future.get();
+ return promise.get_future().get();
}
void checkImage(const std::string& base,
diff --git a/test/fixtures/util.hpp b/test/fixtures/util.hpp
index b93d822a83..2e27e5bf0f 100644
--- a/test/fixtures/util.hpp
+++ b/test/fixtures/util.hpp
@@ -4,7 +4,6 @@
#include <mbgl/util/image.hpp>
#include <mbgl/util/chrono.hpp>
-#include <chrono>
#include <cstdint>
#include <gtest/gtest.h>
@@ -36,12 +35,13 @@ uint64_t crc64(const char*, size_t);
uint64_t crc64(const std::string&);
uint64_t crc64(const PremultipliedImage&);
-PremultipliedImage render(Map&, Milliseconds timeout = Milliseconds(1000));
+PremultipliedImage render(Map&);
void checkImage(const std::string& base,
const PremultipliedImage& actual,
double imageThreshold = 0,
double pixelThreshold = 0);
+
}
}