[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
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user