From ca4f0bbcc58046498966daf4c695bc7977c85e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Fri, 22 Sep 2017 14:15:33 +0200 Subject: [PATCH] [test] add test for rendering a 204 No Content tile --- test/fixtures/map/nocontent/expected.png | Bin 0 -> 1685 bytes test/map/map.test.cpp | 42 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 test/fixtures/map/nocontent/expected.png diff --git a/test/fixtures/map/nocontent/expected.png b/test/fixtures/map/nocontent/expected.png new file mode 100644 index 0000000000000000000000000000000000000000..8fa3f0f5db7e671b6a9be553b043aa739b6590a0 GIT binary patch literal 1685 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G!U;i$lZxy-8q?;3=C}ko-U3d z6^w7MF!C}e@Gu{2tUvG2)MMY&7&m>L@#lT+4Gw_`;?Adi8V-mXFz7WpL>ypfIW0c7 zfw6#@0UJjPE04pDnv0wg z4CW3BItdJio_6~kVA#RPl*q^|pch}l#CCvJfP-72q2T8tVFQM|hEXd<18OuyjpmEd f0%Qo5wBl>OG5_10B6Aj4&oFqp`njxgN@xNAq(%Fv literal 0 HcmV?d00001 diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 98f840270..50d5e50ab 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 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); +}