Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Add Map.Issue15342 unit test
Browse files Browse the repository at this point in the history
The newly added test checks the fix for constant repaint,
caused by `RenderSource::hasFadingTiles()` returning `true` all the time.
  • Loading branch information
pozdnyakov committed Sep 11, 2019
1 parent 5360bad commit 69fee77
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
49 changes: 49 additions & 0 deletions test/map/map.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,4 +877,53 @@ TEST(Map, Issue15216) {
test.map.getStyle().addLayer(std::make_unique<RasterLayer>("RasterLayer", "ImageSource"));
// Passes, if there is no assertion hit.
test.runLoop.runOnce();
}

// https://github.com/mapbox/mapbox-gl-native/issues/15342
// Tests the fix for constant repaint caused by `RenderSource::hasFadingTiles()` returning `true` all the time.
TEST(Map, Issue15342) {
MapTest<> test { 1, MapMode::Continuous };

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.map.jumpTo(CameraOptions().withZoom(3.0));
test.map.getStyle().loadJSON(R"STYLE({
"version": 8,
"sources": {
"mapbox": {
"type": "vector",
"tiles": ["http://example.com/{z}-{x}-{y}.vector.pbf"]
}
},
"layers": [{
"id": "water",
"type": "fill",
"source": "mapbox",
"source-layer": "water"
}]
})STYLE");

test.observer.didFinishLoadingMapCallback = [&]() {
test.map.getStyle().loadJSON(R"STYLE({
"version": 8,
"sources": {
"mapbox": {
"type": "vector",
"tiles": ["http://example.com/{z}-{x}-{y}.vector.pbf"]
}
},
"layers": []
})STYLE");
test.map.jumpTo(CameraOptions().withZoom(20.0));
test.observer.didFinishRenderingFrameCallback = [&] (MapObserver::RenderFrameStatus status) {
if (!status.needsRepaint) {
test.runLoop.stop();
}
};
};

test.runLoop.run();
}
4 changes: 2 additions & 2 deletions test/storage/offline_download.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,8 @@ TEST(OfflineDownload, ResourceOfflineUsageUnset) {
};

StubMapObserver mapObserver;
mapObserver.didFinishRenderingFrameCallback = [&] (MapObserver::RenderMode mode) {
if (mode == MapObserver::RenderMode::Full) {
mapObserver.didFinishRenderingFrameCallback = [&] (MapObserver::RenderFrameStatus status) {
if (status.mode == MapObserver::RenderMode::Full) {
test.loop.stop();
}
};
Expand Down

0 comments on commit 69fee77

Please sign in to comment.