[render-test] Use image from the cache for addImage operation

Instead of trying to read it from the filesystem.
This commit is contained in:
Thiago Marcos P. Santos
2020-01-03 14:31:49 +02:00
parent f0d2a2f636
commit af8092a86f
4 changed files with 38 additions and 12 deletions

View File

@@ -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();