summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-09-22 14:15:33 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-09-22 19:24:42 +0200
commitca4f0bbcc58046498966daf4c695bc7977c85e44 (patch)
tree2d0a45ec9927b88b5b277bd6a6d98d55c604ee9c /test
parent796386473e8f0f361a69e6dcf0f85fa6a656ccc3 (diff)
downloadqtlocation-mapboxgl-ca4f0bbcc58046498966daf4c695bc7977c85e44.tar.gz
[test] add test for rendering a 204 No Content tile
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/map/nocontent/expected.pngbin0 -> 1685 bytes
-rw-r--r--test/map/map.test.cpp42
2 files changed, 42 insertions, 0 deletions
diff --git a/test/fixtures/map/nocontent/expected.png b/test/fixtures/map/nocontent/expected.png
new file mode 100644
index 0000000000..8fa3f0f5db
--- /dev/null
+++ b/test/fixtures/map/nocontent/expected.png
Binary files differ
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 98f8402706..50d5e50abb 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -584,3 +584,45 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
runLoop.run();
}
+
+TEST(Map, NoContentTiles) {
+ MapTest<DefaultFileSource> test {":memory:", "."};
+
+ using namespace std::chrono_literals;
+
+ // Insert a 204 No Content response for the 0/0/0 tile
+ Response response;
+ response.noContent = true;
+ response.expires = util::now() + 1h;
+ test.fileSource.put(Resource::tile("http://example.com/{z}-{x}-{y}.vector.pbf", 1.0, 0, 0, 0,
+ Tileset::Scheme::XYZ),
+ response);
+
+ test.map.getStyle().loadJSON(R"STYLE({
+ "version": 8,
+ "name": "Water",
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "tiles": ["http://example.com/{z}-{x}-{y}.vector.pbf"]
+ }
+ },
+ "layers": [{
+ "id": "background",
+ "type": "background",
+ "paint": {
+ "background-color": "red"
+ }
+ }, {
+ "id": "water",
+ "type": "fill",
+ "source": "mapbox",
+ "source-layer": "water"
+ }]
+ })STYLE");
+
+ test::checkImage("test/fixtures/map/nocontent",
+ test.frontend.render(test.map),
+ 0.0015,
+ 0.1);
+}