summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-10-26 12:24:03 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-10-26 12:25:40 +0300
commitff3af7284d384facbf47da67109c547e70f11173 (patch)
tree98731608e78e7cad99df96109f28e1fe816a5710
parenta803d66eed9177b9f2aa7474d31dfd684da7033d (diff)
downloadqtlocation-mapboxgl-upstream/mikhail_pending_image_requests.tar.gz
[core] Add Map.NoHangOnMissingImage unit testupstream/mikhail_pending_image_requests
-rw-r--r--test/map/map.test.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 3f3145059a..6f4b14a681 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -1009,3 +1009,54 @@ TEST(Map, UniversalStyleGetter) {
ASSERT_TRUE(lineCap.getValue().getString());
EXPECT_EQ(std::string("butt"), *lineCap.getValue().getString());
}
+
+TEST(Map, NoHangOnMissingImage) {
+ MapTest<> test;
+
+ test.fileSource->tileResponse = [&](const Resource&) {
+ Response result;
+ result.data = std::make_shared<std::string>(util::read_file("test/fixtures/map/issue12432/0-0-0.mvt"));
+ return result;
+ };
+
+ test.fileSource->spriteImageResponse = [&](const Resource&) {
+ Response result;
+ result.data = std::make_shared<std::string>(util::read_file("test/fixtures/resources/sprite.png"));
+ return result;
+ };
+
+ test.fileSource->spriteJSONResponse = [&](const Resource&) {
+ Response result;
+ result.data = std::make_shared<std::string>(util::read_file("test/fixtures/resources/sprite.json"));
+ return result;
+ };
+
+ const std::string style{R"STYLE({
+ "version": 8,
+ "sprite": "http://example.com/sprites/sprite",
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "tiles": ["http://example.com/{z}-{x}-{y}.vector.pbf"]
+ }
+ },
+ "layers": [{
+ "id": "background",
+ "type": "background",
+ "paint": {"background-color": "white"}
+ },{
+ "id": "water",
+ "type": "fill",
+ "source": "mapbox",
+ "source-layer": "water",
+ "paint": {"fill-pattern": "missing"}
+ }]
+ })STYLE"};
+ test.map.getStyle().loadJSON(style);
+ test.frontend.render(test.map);
+
+ test.map.getStyle().loadJSON(style);
+ test.map.jumpTo(test.map.getStyle().getDefaultCamera());
+ // The test passes if the following call does not hang.
+ test.frontend.render(test.map);
+} \ No newline at end of file