summaryrefslogtreecommitdiff
path: root/test/style/style_layer.cpp
blob: 3274fe3377533d133f9c9cb9a40e149c8c3eb8a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <mbgl/test/util.hpp>
#include <mbgl/layer/background_layer.hpp>
#include <mbgl/layer/background_layer_impl.hpp>

using namespace mbgl;

TEST(Layer, Clone) {
    std::unique_ptr<Layer> layer = std::make_unique<BackgroundLayer>("id");
    std::unique_ptr<Layer> clone = layer->baseImpl->clone();
    EXPECT_NE(layer.get(), clone.get());
    EXPECT_TRUE(reinterpret_cast<BackgroundLayer::Impl*>(clone->baseImpl.get()));
}

TEST(Layer, CloneCopiesBaseProperties) {
    std::unique_ptr<BackgroundLayer> layer = std::make_unique<BackgroundLayer>("id");
    layer->impl->id = "test";
    EXPECT_EQ("test", layer->baseImpl->clone()->getID());
}