summaryrefslogtreecommitdiff
path: root/test/map
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-12 17:23:02 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-12 20:43:24 +0200
commitefb7dd0b7b942d3bcccae599f42dcc76bfd824ae (patch)
treed6297a6a8caa148423afe443fd94d14cab46f4ee /test/map
parentacd45edd2f4ac7888c13287f63d9a1b1a5edf7a9 (diff)
downloadqtlocation-mapboxgl-efb7dd0b7b942d3bcccae599f42dcc76bfd824ae.tar.gz
[core] Use atomic int in Map.PrefetchDelta* unit tests
Diffstat (limited to 'test/map')
-rw-r--r--test/map/map.test.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 54dbccdafc..e00f84eff0 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -30,6 +30,8 @@
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
+#include <atomic>
+
using namespace mbgl;
using namespace mbgl::style;
using namespace std::literals::string_literals;
@@ -1148,7 +1150,7 @@ TEST(Map, PrefetchDeltaOverride) {
vectorSource->setPrefetchZoomDelta(0);
test.map.getStyle().addSource(std::move(vectorSource));
- unsigned requestedTiles = 0u;
+ std::atomic_int requestedTiles(0);
test.fileSource->tileResponse = [&](const Resource&) {
++requestedTiles;
Response res;
@@ -1176,7 +1178,7 @@ TEST(Map, PrefetchDeltaOverride) {
// 2 sources x 4 tiles
EXPECT_EQ(8, requestedTiles);
- requestedTiles = 0u;
+ requestedTiles = 0;
// Should request z12 tiles when delta is set back to default, that is 4.
test.observer.didFinishRenderingFrameCallback = [&](MapObserver::RenderFrameStatus status) {
@@ -1210,7 +1212,7 @@ TEST(Map, PrefetchDeltaOverrideCustomSource) {
}]
})STYLE");
- unsigned requestedTiles = 0u;
+ std::atomic_int requestedTiles(0);
auto makeCustomSource = [&requestedTiles, &test] {
CustomGeometrySource::Options options;
@@ -1233,7 +1235,7 @@ TEST(Map, PrefetchDeltaOverrideCustomSource) {
test.observer.didFinishLoadingMapCallback = [&] { test.runLoop.stop(); };
test.runLoop.run();
EXPECT_EQ(4, requestedTiles);
- requestedTiles = 0u;
+ requestedTiles = 0;
test.observer.didFinishRenderingFrameCallback = [&](MapObserver::RenderFrameStatus status) {
if (status.mode == MapObserver::RenderMode::Full) {