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

using namespace mbgl;
using namespace mbgl::style;

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());
}