diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-02-25 18:06:48 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-02-25 23:15:47 +0200 |
commit | c85e7cbce01d655424906750aeb6288e3ecf586d (patch) | |
tree | 1b2ea277c358d96db392596c54437f8e2d9f0a71 /test/src/mbgl | |
parent | 7c48611f9ee04e1320e1667ea0dae7c355a9935b (diff) | |
download | qtlocation-mapboxgl-c85e7cbce01d655424906750aeb6288e3ecf586d.tar.gz |
Add OfflineDownload.NoFreezingOnCachedTilesAndNewStyle unit test
Diffstat (limited to 'test/src/mbgl')
-rw-r--r-- | test/src/mbgl/test/stub_file_source.cpp | 9 | ||||
-rw-r--r-- | test/src/mbgl/test/stub_file_source.hpp | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/src/mbgl/test/stub_file_source.cpp b/test/src/mbgl/test/stub_file_source.cpp index 8870a45bdc..f1fb79bea3 100644 --- a/test/src/mbgl/test/stub_file_source.cpp +++ b/test/src/mbgl/test/stub_file_source.cpp @@ -70,6 +70,15 @@ void StubFileSource::remove(AsyncRequest* req) { } } +void StubFileSource::setProperty(const std::string& key, const mapbox::base::Value& value) { + properties[key] = value; +} + +mapbox::base::Value StubFileSource::getProperty(const std::string& key) const { + auto it = properties.find(key); + return (it != properties.end()) ? it->second : mapbox::base::Value(); +} + optional<Response> StubFileSource::defaultResponse(const Resource& resource) { switch (resource.kind) { case Resource::Kind::Style: diff --git a/test/src/mbgl/test/stub_file_source.hpp b/test/src/mbgl/test/stub_file_source.hpp index 46bb33d5e2..b88adc93df 100644 --- a/test/src/mbgl/test/stub_file_source.hpp +++ b/test/src/mbgl/test/stub_file_source.hpp @@ -5,6 +5,7 @@ #include <mbgl/storage/resource.hpp> #include <mbgl/util/timer.hpp> +#include <map> #include <unordered_map> namespace mbgl { @@ -22,6 +23,8 @@ public: std::unique_ptr<AsyncRequest> request(const Resource&, Callback) override; bool canRequest(const Resource&) const override { return true; } void remove(AsyncRequest*); + void setProperty(const std::string&, const mapbox::base::Value&) override; + mapbox::base::Value getProperty(const std::string&) const override; using ResponseFunction = std::function<optional<Response> (const Resource&)>; @@ -48,6 +51,7 @@ private: std::unordered_map<AsyncRequest*, std::tuple<Resource, ResponseFunction, Callback>> pending; ResponseType type; util::Timer timer; + std::map<std::string, mapbox::base::Value> properties; }; } // namespace mbgl |