summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/style/style_layer.cpp24
-rw-r--r--test/test.gypi1
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',