summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2019-10-02 11:13:36 +0300
committerJuha Alanen <19551460+jmalanen@users.noreply.github.com>2019-10-07 10:58:46 +0300
commit18a426d74808605d7bb333a56de0cb5493094f20 (patch)
treec662499e4e03b2a45c352862988850f948d582fe
parentf58a25932a1f0e6e2b4e58129f83bdb641048986 (diff)
downloadqtlocation-mapboxgl-18a426d74808605d7bb333a56de0cb5493094f20.tar.gz
[render-test] Support feature-state tests where featureID is a number
-rw-r--r--render-test/runner.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/render-test/runner.cpp b/render-test/runner.cpp
index 26419e3eae..fa7a86e948 100644
--- a/render-test/runner.cpp
+++ b/render-test/runner.cpp
@@ -490,7 +490,11 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) {
sourceLayer = {featureOptions["sourceLayer"].GetString()};
}
if (featureOptions.HasMember("id")) {
- featureID = featureOptions["id"].GetString();
+ if (featureOptions["id"].IsString()) {
+ featureID = featureOptions["id"].GetString();
+ } else if (featureOptions["id"].IsNumber()) {
+ featureID = mbgl::util::toString(featureOptions["id"].GetUint64());
+ }
}
const JSValue* state = &operationArray[2];
@@ -514,7 +518,7 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) {
result[k] = std::move(array);
stateValue = std::move(result);
valueParsed = true;
- return {};
+ return nullopt;
} else if (isObject(v)) {
eachMember(v, convertFn);
@@ -555,7 +559,11 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) {
sourceLayer = {featureOptions["sourceLayer"].GetString()};
}
if (featureOptions.HasMember("id")) {
- featureID = featureOptions["id"].GetString();
+ if (featureOptions["id"].IsString()) {
+ featureID = featureOptions["id"].GetString();
+ } else if (featureOptions["id"].IsNumber()) {
+ featureID = mbgl::util::toString(featureOptions["id"].GetUint64());
+ }
}
try {
@@ -584,7 +592,11 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) {
sourceLayer = {featureOptions["sourceLayer"].GetString()};
}
if (featureOptions.HasMember("id")) {
- featureID = featureOptions["id"].GetString();
+ if (featureOptions["id"].IsString()) {
+ featureID = featureOptions["id"].GetString();
+ } else if (featureOptions["id"].IsNumber()) {
+ featureID = mbgl::util::toString(featureOptions["id"].GetUint64());
+ }
}
if (operationArray.Size() >= 3u) {