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/runner.cpp | |
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/runner.cpp')
-rw-r--r-- | render-test/runner.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/render-test/runner.cpp b/render-test/runner.cpp index 4c0967a9e9..e882e394be 100644 --- a/render-test/runner.cpp +++ b/render-test/runner.cpp @@ -101,7 +101,15 @@ std::string simpleDiff(const Value& result, const Value& expected) { return diff.str(); } -TestRunner::TestRunner(const std::string& testRootPath_) : maps(), testRootPath(testRootPath_) {} +TestRunner::TestRunner(Manifest manifest_) : manifest(std::move(manifest_)) {} + +const Manifest& TestRunner::getManifest() const { + return manifest; +} + +void TestRunner::doShuffle(uint32_t seed) { + manifest.doShuffle(seed); +} bool TestRunner::checkQueryTestResults(mbgl::PremultipliedImage&& actualImage, std::vector<mbgl::Feature>&& features, @@ -487,7 +495,7 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) { std::string imagePath = operationArray[2].GetString(); imagePath.erase(std::remove(imagePath.begin(), imagePath.end(), '"'), imagePath.end()); - const mbgl::filesystem::path filePath = mbgl::filesystem::path(getTestPath(testRootPath)) / imagePath; + const mbgl::filesystem::path filePath = mbgl::filesystem::path(manifest.getTestRootPath()) / imagePath; mbgl::optional<std::string> maybeImage = mbgl::util::readFile(filePath.string()); if (!maybeImage) { @@ -507,15 +515,15 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) { // setStyle assert(operationArray.Size() >= 2u); if (operationArray[1].IsString()) { - std::string stylePath = localizeURL(operationArray[1].GetString(), testRootPath); + std::string stylePath = manifest.localizeURL(operationArray[1].GetString()); auto maybeStyle = readJson(stylePath); if (maybeStyle.is<mbgl::JSDocument>()) { auto& style = maybeStyle.get<mbgl::JSDocument>(); - localizeStyleURLs((mbgl::JSValue&)style, style, testRootPath); + manifest.localizeStyleURLs((mbgl::JSValue&)style, style); map.getStyle().loadJSON(serializeJsonValue(style)); } } else { - localizeStyleURLs(operationArray[1], metadata.document, testRootPath); + manifest.localizeStyleURLs(operationArray[1], metadata.document); map.getStyle().loadJSON(serializeJsonValue(operationArray[1])); } } else if (operationArray[0].GetString() == setCenterOp) { @@ -616,7 +624,7 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) { assert(operationArray[1].IsString()); assert(operationArray[2].IsObject()); - localizeSourceURLs(operationArray[2], metadata.document, testRootPath); + manifest.localizeSourceURLs(operationArray[2], metadata.document); mbgl::style::conversion::Error error; auto converted = mbgl::style::conversion::convert<std::unique_ptr<mbgl::style::Source>>(operationArray[2], error, operationArray[1].GetString()); |