[render-test] Add configurable rootPath, ignorePath via CLI arguments (#15832)
* [render-test] Add configurable path via CLI arguments * [render-test] Change ignore path config
This commit is contained in:
@@ -57,12 +57,6 @@ public:
|
||||
bool idle;
|
||||
};
|
||||
|
||||
// static
|
||||
const std::string& TestRunner::getBasePath() {
|
||||
const static std::string result = std::string(TEST_RUNNER_ROOT_PATH).append("/mapbox-gl-js/test/integration");
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
gfx::HeadlessBackend::SwapBehaviour swapBehavior(MapMode mode) {
|
||||
return mode == MapMode::Continuous ? gfx::HeadlessBackend::SwapBehaviour::Flush
|
||||
@@ -107,6 +101,8 @@ std::string simpleDiff(const Value& result, const Value& expected) {
|
||||
return diff.str();
|
||||
}
|
||||
|
||||
TestRunner::TestRunner(const std::string& testRootPath_) : maps(), testRootPath(testRootPath_) {}
|
||||
|
||||
bool TestRunner::checkQueryTestResults(mbgl::PremultipliedImage&& actualImage,
|
||||
std::vector<mbgl::Feature>&& features,
|
||||
TestMetadata& metadata) {
|
||||
@@ -491,7 +487,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(std::string(TEST_RUNNER_ROOT_PATH) + "/mapbox-gl-js/test/integration/" + imagePath);
|
||||
const mbgl::filesystem::path filePath = mbgl::filesystem::path(getTestPath(testRootPath)) / imagePath;
|
||||
|
||||
mbgl::optional<std::string> maybeImage = mbgl::util::readFile(filePath.string());
|
||||
if (!maybeImage) {
|
||||
@@ -511,15 +507,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());
|
||||
std::string stylePath = localizeURL(operationArray[1].GetString(), testRootPath);
|
||||
auto maybeStyle = readJson(stylePath);
|
||||
if (maybeStyle.is<mbgl::JSDocument>()) {
|
||||
auto& style = maybeStyle.get<mbgl::JSDocument>();
|
||||
localizeStyleURLs((mbgl::JSValue&)style, style);
|
||||
localizeStyleURLs((mbgl::JSValue&)style, style, testRootPath);
|
||||
map.getStyle().loadJSON(serializeJsonValue(style));
|
||||
}
|
||||
} else {
|
||||
localizeStyleURLs(operationArray[1], metadata.document);
|
||||
localizeStyleURLs(operationArray[1], metadata.document, testRootPath);
|
||||
map.getStyle().loadJSON(serializeJsonValue(operationArray[1]));
|
||||
}
|
||||
} else if (operationArray[0].GetString() == setCenterOp) {
|
||||
@@ -620,7 +616,7 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) {
|
||||
assert(operationArray[1].IsString());
|
||||
assert(operationArray[2].IsObject());
|
||||
|
||||
localizeSourceURLs(operationArray[2], metadata.document);
|
||||
localizeSourceURLs(operationArray[2], metadata.document, testRootPath);
|
||||
|
||||
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