diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-04 15:19:12 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-07 11:19:08 -0800 |
commit | 0a0007e0acdce85576857bec76e1333d771472f1 (patch) | |
tree | 07b0ecc27aa064332c989e50dcd2b4bf8942b8ad /test | |
parent | fc0c839fc87088a9e3a3c0b6bd031544162b6ebf (diff) | |
download | qtlocation-mapboxgl-0a0007e0acdce85576857bec76e1333d771472f1.tar.gz |
[core] More efficient layer cloning
Diffstat (limited to 'test')
-rw-r--r-- | test/style/style_layer.cpp | 24 | ||||
-rw-r--r-- | test/test.gypi | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/style/style_layer.cpp b/test/style/style_layer.cpp new file mode 100644 index 0000000000..d005371fef --- /dev/null +++ b/test/style/style_layer.cpp @@ -0,0 +1,24 @@ +#include "../fixtures/util.hpp" + +#include <mbgl/style/style_layer.hpp> +#include <mbgl/layer/background_layer.hpp> + +using namespace mbgl; + +TEST(StyleLayer, Create) { + std::unique_ptr<StyleLayer> layer = StyleLayer::create(StyleLayerType::Background); + EXPECT_TRUE(reinterpret_cast<BackgroundLayer*>(layer.get())); +} + +TEST(StyleLayer, Clone) { + std::unique_ptr<StyleLayer> layer = StyleLayer::create(StyleLayerType::Background); + std::unique_ptr<StyleLayer> clone = layer->clone(); + EXPECT_NE(layer.get(), clone.get()); + EXPECT_TRUE(reinterpret_cast<BackgroundLayer*>(layer.get())); +} + +TEST(StyleLayer, CloneCopiesBaseProperties) { + std::unique_ptr<BackgroundLayer> layer = std::make_unique<BackgroundLayer>(); + layer->id = "test"; + EXPECT_EQ("test", layer->clone()->id); +} diff --git a/test/test.gypi b/test/test.gypi index 708b89e74f..2188ed905a 100644 --- a/test/test.gypi +++ b/test/test.gypi @@ -91,6 +91,7 @@ 'style/glyph_store.cpp', 'style/pending_resources.cpp', 'style/resource_loading.cpp', + 'style/style_layer.cpp', 'sprite/sprite_atlas.cpp', 'sprite/sprite_image.cpp', |