summaryrefslogtreecommitdiff
path: root/test/style
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-04 15:19:12 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-07 11:19:08 -0800
commit0a0007e0acdce85576857bec76e1333d771472f1 (patch)
tree07b0ecc27aa064332c989e50dcd2b4bf8942b8ad /test/style
parentfc0c839fc87088a9e3a3c0b6bd031544162b6ebf (diff)
downloadqtlocation-mapboxgl-0a0007e0acdce85576857bec76e1333d771472f1.tar.gz
[core] More efficient layer cloning
Diffstat (limited to 'test/style')
-rw-r--r--test/style/style_layer.cpp24
1 files changed, 24 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);
+}