diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-14 17:07:00 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-16 16:25:59 +0300 |
commit | a1904e802c61e5b5a0cef8cc9de9bf7c2c617552 (patch) | |
tree | e5c71ef187ca93be40a8228b59295358261873bf /render-test/parser.cpp | |
parent | 1165f62df6dd344d83f88a6396cfba153e9271f3 (diff) | |
download | qtlocation-mapboxgl-a1904e802c61e5b5a0cef8cc9de9bf7c2c617552.tar.gz |
[test-runner] Introduce mapbox-gl-native test expectations
The `mapbox-gl-native`-specific render tests expected results will
be stored at the `render-test/expected/` subfolder.
Test runner will automatically put new expected results there if
invoked with `UPDATE=true`.
Diffstat (limited to 'render-test/parser.cpp')
-rw-r--r-- | render-test/parser.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/render-test/parser.cpp b/render-test/parser.cpp index fd048f08c6..49f084465c 100644 --- a/render-test/parser.cpp +++ b/render-test/parser.cpp @@ -15,6 +15,7 @@ #include "parser.hpp" #include "metadata.hpp" +#include "runner.hpp" #include <sstream> #include <regex> @@ -243,17 +244,18 @@ ArgumentsTuple parseArguments(int argc, char** argv) { std::vector<std::string> ids; for (const auto& id : args::get(testNameValues)) { - ids.emplace_back(testDefaultPath + "/" + id); + ids.emplace_back(TestRunner::getBasePath() + "/" + id); } if (ids.empty()) { - ids.emplace_back(testDefaultPath); + ids.emplace_back(TestRunner::getBasePath()); } return ArgumentsTuple { recycleMapFlag ? args::get(recycleMapFlag) : false, shuffleFlag ? args::get(shuffleFlag) : false, seedValue ? args::get(seedValue) : 1u, - testPathValue ? args::get(testPathValue) : testDefaultPath, ids + testPathValue ? args::get(testPathValue) : testDefaultPath, + std::move(ids) }; } @@ -288,13 +290,13 @@ std::vector<std::pair<std::string, std::string>> parseIgnores() { return ignores; } -TestMetadata parseTestMetadata(const mbgl::filesystem::path& path) { +TestMetadata parseTestMetadata(const TestPaths& paths) { TestMetadata metadata; - metadata.path = path; + metadata.paths = paths; - auto maybeJson = readJson(path.string()); + auto maybeJson = readJson(paths.stylePath.string()); if (!maybeJson.is<mbgl::JSDocument>()) { // NOLINT - metadata.errorMessage = std::string("Unable to parse: ") + path.string(); + metadata.errorMessage = std::string("Unable to parse: ") + metadata.paths.stylePath.string(); return metadata; } @@ -303,14 +305,14 @@ TestMetadata parseTestMetadata(const mbgl::filesystem::path& path) { if (!metadata.document.HasMember("metadata")) { mbgl::Log::Warning(mbgl::Event::ParseStyle, "Style has no 'metadata': %s", - path.c_str()); + paths.stylePath.c_str()); return metadata; } const mbgl::JSValue& metadataValue = metadata.document["metadata"]; if (!metadataValue.HasMember("test")) { mbgl::Log::Warning(mbgl::Event::ParseStyle, "Style has no 'metadata.test': %s", - path.c_str()); + paths.stylePath.c_str()); return metadata; } |