diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-03-24 18:23:26 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-03-24 20:53:55 +0200 |
commit | 371af12e1ff3b02e81210a6831c0cca77fb8ec90 (patch) | |
tree | 51a30e72d56238508545367cf7513cdaf5cb5bf9 /test | |
parent | 7234cb3968621f90b0afdf9dd50966923b5fa7ba (diff) | |
download | qtlocation-mapboxgl-371af12e1ff3b02e81210a6831c0cca77fb8ec90.tar.gz |
StyleConversion.SetGenericProperties test
Diffstat (limited to 'test')
-rw-r--r-- | test/style/conversion/layer.test.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/style/conversion/layer.test.cpp b/test/style/conversion/layer.test.cpp index aae5d3495c..742f902168 100644 --- a/test/style/conversion/layer.test.cpp +++ b/test/style/conversion/layer.test.cpp @@ -1,5 +1,6 @@ #include <mbgl/test/util.hpp> +#include <mbgl/style/conversion/filter.hpp> #include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/layer.hpp> #include <mbgl/style/layers/background_layer_impl.hpp> @@ -18,6 +19,11 @@ std::unique_ptr<Layer> parseLayer(const std::string& src) { return nullptr; } +Filter parseFilter(const std::string& expression) { + Error error; + return *convertJSON<Filter>(expression, error); +} + std::string stringifyLayer(const Value& value) { rapidjson::StringBuffer s; rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(s); @@ -125,3 +131,21 @@ TEST(StyleConversion, OverrideDefaults) { EXPECT_EQ(4u, roundTrippedObject.at("layout").getObject()->size()); EXPECT_EQ(2u, roundTrippedObject.at("paint").getObject()->size()); } + +TEST(StyleConversion, SetGenericProperties) { + auto layer = parseLayer(R"JSON({ + "type": "symbol", + "id": "symbol", + "source": "composite", + "source-layer": "landmarks", + "filter": ["has", "monuments"], + "minzoom": 12, + "maxzoom": 18 + })JSON"); + + ASSERT_NE(nullptr, layer); + EXPECT_EQ(parseFilter(R"FILTER(["has", "monuments"])FILTER").serialize(), layer->getFilter().serialize()); + EXPECT_EQ(12.0f, layer->getMinZoom()); + EXPECT_EQ(18.0f, layer->getMaxZoom()); + EXPECT_EQ("landmarks", layer->getSourceLayer()); +}
\ No newline at end of file |