summaryrefslogtreecommitdiff
path: root/render-test/manifest_parser.cpp
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2019-11-19 20:45:30 +0200
committerGitHub <noreply@github.com>2019-11-19 20:45:30 +0200
commit1b58e87f154bf7d3d5f38ef32cc4b171362f73a2 (patch)
treecf692c1fbee906e2370ec0f6d684d5b5bb838e61 /render-test/manifest_parser.cpp
parentabdd32d11fcd9cebe0631afbfd2aba9e78c7d790 (diff)
downloadqtlocation-mapboxgl-1b58e87f154bf7d3d5f38ef32cc4b171362f73a2.tar.gz
[render-test] Wrap test data inside RenderTestRunner App + Add a new test app (#15887)
* [render-test] Wrap test resources inside app * [render-test] Add test app * fix test app failure * [render-test]add callback + add javaObjectWrapper
Diffstat (limited to 'render-test/manifest_parser.cpp')
-rw-r--r--render-test/manifest_parser.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/render-test/manifest_parser.cpp b/render-test/manifest_parser.cpp
index 3f1f9f3866..6bba33754a 100644
--- a/render-test/manifest_parser.cpp
+++ b/render-test/manifest_parser.cpp
@@ -34,9 +34,15 @@ const std::vector<std::pair<std::string, std::string>>& Manifest::getIgnores() c
const std::string& Manifest::getTestRootPath() const {
return testRootPath;
}
+const std::string& Manifest::getAssetPath() const {
+ return assetPath;
+}
const std::string& Manifest::getManifestPath() const {
return manifestPath;
}
+const std::string& Manifest::getResultPath() const {
+ return resultPath;
+}
void Manifest::doShuffle(uint32_t seed) {
std::seed_seq sequence{seed};
@@ -239,7 +245,7 @@ mbgl::filesystem::path getValidPath(const std::string& manifestPath, const std::
result = BasePath / result;
}
if (mbgl::filesystem::exists(result)) {
- return result;
+ return result.lexically_normal();
}
mbgl::Log::Warning(mbgl::Event::General, "Invalid path is provoided inside the manifest file: %s", path.c_str());
return mbgl::filesystem::path{};
@@ -285,6 +291,18 @@ mbgl::optional<Manifest> ManifestParser::parseManifest(const std::string& manife
return mbgl::nullopt;
}
}
+ if (document.HasMember("result_path")) {
+ const auto& resultPathValue = document["result_path"];
+ if (!resultPathValue.IsString()) {
+ mbgl::Log::Warning(
+ mbgl::Event::General, "Invalid assetPath is provoided inside the manifest file: %s", filePath.c_str());
+ return mbgl::nullopt;
+ }
+ manifest.resultPath = (getValidPath(manifest.manifestPath, resultPathValue.GetString()) / "").string();
+ if (manifest.resultPath.empty()) {
+ return mbgl::nullopt;
+ }
+ }
mbgl::filesystem::path baseTestPath;
if (document.HasMember("base_test_path")) {
const auto& testPathValue = document["base_test_path"];
@@ -366,6 +384,11 @@ mbgl::optional<Manifest> ManifestParser::parseManifest(const std::string& manife
if (manifest.manifestPath.back() == '/') {
manifest.manifestPath.pop_back();
}
+ if (manifest.resultPath.empty()) {
+ manifest.resultPath = manifest.manifestPath;
+ } else if (manifest.resultPath.back() == '/') {
+ manifest.resultPath.pop_back();
+ }
std::vector<mbgl::filesystem::path> paths;
for (const auto& id : testNames) {