diff options
author | zmiao <miao.zhao@mapbox.com> | 2019-10-29 20:59:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-29 20:59:29 +0200 |
commit | c8576e089f12438a2384a4fe822af650e94ace74 (patch) | |
tree | ad69be13bc00c2dbece7cceedd5007b7532fe173 /render-test/manifest_parser.hpp | |
parent | 84f2ff1084ccaec68c7a26243367ae657f6ebe60 (diff) | |
download | qtlocation-mapboxgl-c8576e089f12438a2384a4fe822af650e94ace74.tar.gz |
[render-test] Add manifest parser for render-test-runner (#15861)
* [render-test] Add manifest parser for render-test-runner
* [render-test] Refactory manifest parser
* [render-test] Parse full manifest file through CLI
* [render-test] Add linux probe manifest
Diffstat (limited to 'render-test/manifest_parser.hpp')
-rw-r--r-- | render-test/manifest_parser.hpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/render-test/manifest_parser.hpp b/render-test/manifest_parser.hpp new file mode 100644 index 0000000000..bc5adf1091 --- /dev/null +++ b/render-test/manifest_parser.hpp @@ -0,0 +1,55 @@ +#pragma once + +#include "metadata.hpp" + +#include <mbgl/util/optional.hpp> +#include <mbgl/util/rapidjson.hpp> + +#include <regex> +#include <string> +#include <utility> +#include <vector> + +class Manifest { +public: + Manifest(); + ~Manifest(); + const std::vector<std::pair<std::string, std::string>>& getIgnores() const; + const std::vector<TestPaths>& getTestPaths() const; + const std::string& getTestRootPath() const; + const std::string& getManifestPath() const; + void doShuffle(uint32_t seed); + + std::string localizeURL(const std::string& url) const; + void localizeSourceURLs(mbgl::JSValue& root, mbgl::JSDocument& document) const; + void localizeStyleURLs(mbgl::JSValue& root, mbgl::JSDocument& document) const; + +private: + friend class ManifestParser; + mbgl::optional<std::string> localizeLocalURL(const std::string& url, bool glyphsPath = false) const; + mbgl::optional<std::string> localizeHttpURL(const std::string& url) const; + mbgl::optional<std::string> localizeMapboxSpriteURL(const std::string& url) const; + mbgl::optional<std::string> localizeMapboxFontsURL(const std::string& url) const; + mbgl::optional<std::string> localizeMapboxTilesURL(const std::string& url) const; + mbgl::optional<std::string> localizeMapboxTilesetURL(const std::string& url) const; + mbgl::optional<std::string> getVendorPath(const std::string& url, + const std::regex& regex, + bool glyphsPath = false) const; + mbgl::optional<std::string> getIntegrationPath(const std::string& url, + const std::string& parent, + const std::regex& regex, + bool glyphsPath = false) const; + std::string manifestPath; + std::string testRootPath; + std::string vendorPath; + std::string assetPath; + std::vector<std::pair<std::string, std::string>> ignores; + std::vector<TestPaths> testPaths; +}; + +class ManifestParser { +public: + static mbgl::optional<Manifest> parseManifest(const std::string& manifestPath, + const std::vector<std::string>& testNames, + const std::string& testFilter); +}; |