summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-09-11 19:11:40 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-09-12 00:40:08 +0300
commit6899337f86625f78929c04de22351d1021947f5b (patch)
tree20fd4fb8133eb95f205cd3224cdc80387bcf6f3f
parent8af78ddbb9744f61d14f9e611aeffc08edd9ac0c (diff)
downloadqtlocation-mapboxgl-6899337f86625f78929c04de22351d1021947f5b.tar.gz
[core] Add Map.Issue15342 unit test
The newly added test checks the fix for constant repaint, caused by `RenderSource::hasFadingTiles()` returning `true` all the time.
-rw-r--r--test/map/map.test.cpp49
-rw-r--r--test/storage/offline_download.test.cpp4
2 files changed, 51 insertions, 2 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index c2a79f5f1b..09e1b92336 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -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();
} \ No newline at end of file
diff --git a/test/storage/offline_download.test.cpp b/test/storage/offline_download.test.cpp
index 4e967c297c..ebe3f82ee9 100644
--- a/test/storage/offline_download.test.cpp
+++ b/test/storage/offline_download.test.cpp
@@ -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();
}
};