Add ClientOptions to be able to pass around client name and version (#365)

* ClientOptions and Qt user agent

* Update CHANGELOG.md

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
This commit is contained in:
Tadej Novak
2022-08-13 15:36:50 +02:00
committed by GitHub
parent c2d91477b1
commit 1341f33ba4
71 changed files with 830 additions and 249 deletions

View File

@@ -101,10 +101,10 @@ void TestRunner::registerProxyFileSource() {
auto resourceLoaderFactory =
fileSourceManager->unRegisterFileSourceFactory(mbgl::FileSourceType::ResourceLoader);
auto factory = [defaultFactory = std::move(resourceLoaderFactory)](const mbgl::ResourceOptions& options) {
auto factory = [defaultFactory = std::move(resourceLoaderFactory)](const mbgl::ResourceOptions& resourceOptions, const mbgl::ClientOptions& clientOptions) {
assert(defaultFactory);
std::shared_ptr<FileSource> fileSource = defaultFactory(options);
return std::make_unique<ProxyFileSource>(std::move(fileSource), options);
std::shared_ptr<FileSource> fileSource = defaultFactory(resourceOptions, clientOptions);
return std::make_unique<ProxyFileSource>(std::move(fileSource), resourceOptions, clientOptions);
};
fileSourceManager->registerFileSourceFactory(mbgl::FileSourceType::ResourceLoader, std::move(factory));
@@ -677,10 +677,10 @@ uint32_t getImageTileOffset(const std::set<uint32_t>& dims, uint32_t dim, float
} // namespace
TestRunner::Impl::Impl(const TestMetadata& metadata, const mbgl::ResourceOptions& resourceOptions)
TestRunner::Impl::Impl(const TestMetadata& metadata, const mbgl::ResourceOptions& resourceOptions, const mbgl::ClientOptions& clientOptions)
: observer(std::make_unique<TestRunnerMapObserver>()),
frontend(metadata.size, metadata.pixelRatio, swapBehavior(metadata.mapMode)),
fileSource(mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::ResourceLoader, resourceOptions)),
fileSource(mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::ResourceLoader, resourceOptions, clientOptions)),
map(frontend,
*observer.get(),
mbgl::MapOptions()
@@ -688,7 +688,8 @@ TestRunner::Impl::Impl(const TestMetadata& metadata, const mbgl::ResourceOptions
.withSize(metadata.size)
.withPixelRatio(metadata.pixelRatio)
.withCrossSourceCollisions(metadata.crossSourceCollisions),
resourceOptions) {}
resourceOptions,
clientOptions) {}
TestRunner::Impl::~Impl() {}
@@ -738,7 +739,8 @@ void TestRunner::run(TestMetadata& metadata) {
if (maps.find(key) == maps.end()) {
maps[key] = std::make_unique<TestRunner::Impl>(
metadata,
mbgl::ResourceOptions().withCachePath(manifest.getCachePath()).withApiKey(manifest.getApiKey()));
mbgl::ResourceOptions().withCachePath(manifest.getCachePath()).withApiKey(manifest.getApiKey()),
mbgl::ClientOptions());
}
ctx.runnerImpl = maps[key].get();