summaryrefslogtreecommitdiff
path: root/render-test/runner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'render-test/runner.cpp')
-rw-r--r--render-test/runner.cpp20
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());