Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[test runner] Update test commands for Layer::setProperty()
Browse files Browse the repository at this point in the history
  • Loading branch information
pozdnyakov committed Dec 3, 2019
1 parent 5d46cd6 commit 75f8530
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions render-test/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,9 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata, R
assert(operationArray.Size() >= 2u);
assert(operationArray[1].IsString());
map.getStyle().removeSource(operationArray[1].GetString());
} else if (operationArray[0].GetString() == setPaintPropertyOp) {
// setPaintProperty
} else if (operationArray[0].GetString() == setLayoutPropertyOp ||
operationArray[0].GetString() == setPaintPropertyOp) {
// set{Paint|Layout}Property
assert(operationArray.Size() >= 4u);
assert(operationArray[1].IsString());
assert(operationArray[2].IsString());
Expand All @@ -808,24 +809,7 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata, R
return false;
} else {
const mbgl::JSValue* propertyValue = &operationArray[3];
layer->setPaintProperty(propertyName, propertyValue);
}
} else if (operationArray[0].GetString() == setLayoutPropertyOp) {
// setLayoutProperty
assert(operationArray.Size() >= 4u);
assert(operationArray[1].IsString());
assert(operationArray[2].IsString());

const std::string layerName { operationArray[1].GetString(), operationArray[1].GetStringLength() };
const std::string propertyName { operationArray[2].GetString(), operationArray[2].GetStringLength() };

auto layer = map.getStyle().getLayer(layerName);
if (!layer) {
metadata.errorMessage = std::string("Layer not found: ") + layerName;
return false;
} else {
const mbgl::JSValue* propertyValue = &operationArray[3];
layer->setLayoutProperty(propertyName, propertyValue);
layer->setProperty(propertyName, propertyValue);
}
} else if (operationArray[0].GetString() == fileSizeProbeOp) {
// probeFileSize
Expand Down

0 comments on commit 75f8530

Please sign in to comment.