summaryrefslogtreecommitdiff
path: root/test/util
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-19 16:57:36 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-20 21:30:08 +0200
commitd5868d3da822f2bf3297229bd879e76853108a63 (patch)
treeb3d28aab92b938cf541f917f1027d2bbd06d9780 /test/util
parentd1762d7111b39d45430bd7bb75ea60b7a5d85bd2 (diff)
downloadqtlocation-mapboxgl-d5868d3da822f2bf3297229bd879e76853108a63.tar.gz
[core] Remove file source from public Map ctor
Diffstat (limited to 'test/util')
-rw-r--r--test/util/memory.test.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp
index 36bed57ab5..c1ae597986 100644
--- a/test/util/memory.test.cpp
+++ b/test/util/memory.test.cpp
@@ -1,8 +1,8 @@
#include <mbgl/test/stub_file_source.hpp>
#include <mbgl/test/getrss.hpp>
#include <mbgl/test/util.hpp>
+#include <mbgl/test/map_adapter.hpp>
-#include <mbgl/map/map.hpp>
#include <mbgl/map/map_options.hpp>
#include <mbgl/gl/headless_frontend.hpp>
#include <mbgl/util/default_thread_pool.hpp>
@@ -16,6 +16,7 @@
#include <string>
#include <unordered_map>
#include <utility>
+#include <memory>
#include <cstdlib>
#include <unistd.h>
@@ -26,16 +27,16 @@ using namespace std::literals::string_literals;
class MemoryTest {
public:
MemoryTest() {
- fileSource.styleResponse = [&](const Resource& res) { return response("style_" + getType(res) + ".json");};
- fileSource.tileResponse = [&](const Resource& res) { return response(getType(res) + ".tile"); };
- fileSource.sourceResponse = [&](const Resource& res) { return response("source_" + getType(res) + ".json"); };
- fileSource.glyphsResponse = [&](const Resource&) { return response("glyphs.pbf"); };
- fileSource.spriteJSONResponse = [&](const Resource&) { return response("sprite.json"); };
- fileSource.spriteImageResponse = [&](const Resource&) { return response("sprite.png"); };
+ fileSource->styleResponse = [&](const Resource& res) { return response("style_" + getType(res) + ".json");};
+ fileSource->tileResponse = [&](const Resource& res) { return response(getType(res) + ".tile"); };
+ fileSource->sourceResponse = [&](const Resource& res) { return response("source_" + getType(res) + ".json"); };
+ fileSource->glyphsResponse = [&](const Resource&) { return response("glyphs.pbf"); };
+ fileSource->spriteJSONResponse = [&](const Resource&) { return response("sprite.json"); };
+ fileSource->spriteImageResponse = [&](const Resource&) { return response("sprite.png"); };
}
util::RunLoop runLoop;
- StubFileSource fileSource;
+ std::shared_ptr<StubFileSource> fileSource = std::make_shared<StubFileSource>();
ThreadPool threadPool { 4 };
private:
@@ -72,8 +73,8 @@ TEST(Memory, Vector) {
float ratio { 2 };
HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool };
- Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
- test.threadPool, MapOptions().withMapMode(MapMode::Static));
+ MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
+ test.threadPool, MapOptions().withMapMode(MapMode::Static));
map.jumpTo(CameraOptions().withZoom(16));
map.getStyle().loadURL("mapbox://streets");
@@ -85,8 +86,8 @@ TEST(Memory, Raster) {
float ratio { 2 };
HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool };
- Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
- test.threadPool, MapOptions().withMapMode(MapMode::Static));
+ MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
+ test.threadPool, MapOptions().withMapMode(MapMode::Static));
map.getStyle().loadURL("mapbox://satellite");
frontend.render(map);
@@ -131,7 +132,7 @@ TEST(Memory, Footprint) {
}
HeadlessFrontend frontend;
- Map map;
+ MapAdapter map;
};
// Warm up buffers and cache.