summaryrefslogtreecommitdiff
path: root/render-test/runner.cpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-01-03 14:31:49 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-01-08 13:07:12 +0200
commitaf8092a86fc5465de3fe0bb2c9e1c24f3fec5965 (patch)
tree2925a8bf49759626ba1bf914b1562174a17c8d83 /render-test/runner.cpp
parentf0d2a2f636bf45889cf8082ba42e0d22875c1e3a (diff)
downloadqtlocation-mapboxgl-af8092a86fc5465de3fe0bb2c9e1c24f3fec5965.tar.gz
[render-test] Use image from the cache for addImage operation
Instead of trying to read it from the filesystem.
Diffstat (limited to 'render-test/runner.cpp')
-rw-r--r--render-test/runner.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/render-test/runner.cpp b/render-test/runner.cpp
index eaf1934125..0492868051 100644
--- a/render-test/runner.cpp
+++ b/render-test/runner.cpp
@@ -651,9 +651,10 @@ uint32_t getImageTileOffset(const std::set<uint32_t>& dims, uint32_t dim) {
} // namespace
-TestRunner::Impl::Impl(const TestMetadata& metadata, const Manifest& manifest)
+TestRunner::Impl::Impl(const TestMetadata& metadata, const mbgl::ResourceOptions& resourceOptions)
: observer(std::make_unique<TestRunnerMapObserver>()),
frontend(metadata.size, metadata.pixelRatio, swapBehavior(metadata.mapMode)),
+ fileSource(mbgl::FileSource::getSharedFileSource(resourceOptions)),
map(frontend,
*observer.get(),
mbgl::MapOptions()
@@ -661,7 +662,7 @@ TestRunner::Impl::Impl(const TestMetadata& metadata, const Manifest& manifest)
.withSize(metadata.size)
.withPixelRatio(metadata.pixelRatio)
.withCrossSourceCollisions(metadata.crossSourceCollisions),
- mbgl::ResourceOptions().withCachePath(manifest.getCachePath()).withAccessToken(manifest.getAccessToken())) {}
+ resourceOptions) {}
TestRunner::Impl::~Impl() {}
@@ -680,6 +681,12 @@ void TestRunner::run(TestMetadata& metadata) {
assert(runnerImpl);
return runnerImpl->map;
}
+
+ FileSource& getFileSource() override {
+ assert(runnerImpl);
+ return *runnerImpl->fileSource;
+ }
+
TestRunnerMapObserver& getObserver() override {
assert(runnerImpl);
return *runnerImpl->observer;
@@ -703,7 +710,9 @@ void TestRunner::run(TestMetadata& metadata) {
mbgl::util::toString(uint32_t(metadata.crossSourceCollisions));
if (maps.find(key) == maps.end()) {
- maps[key] = std::make_unique<TestRunner::Impl>(metadata, manifest);
+ maps[key] = std::make_unique<TestRunner::Impl>(
+ metadata,
+ mbgl::ResourceOptions().withCachePath(manifest.getCachePath()).withAccessToken(manifest.getAccessToken()));
}
ctx.runnerImpl = maps[key].get();