summaryrefslogtreecommitdiff
path: root/test/style/style_layer.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/style/style_layer.test.cpp')
-rw-r--r--test/style/style_layer.test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp
index d6a926c631..dfced634b7 100644
--- a/test/style/style_layer.test.cpp
+++ b/test/style/style_layer.test.cpp
@@ -299,6 +299,24 @@ TEST(Layer, DuplicateLayer) {
}
}
+TEST(Layer, IncompatibleLayer) {
+ util::RunLoop loop;
+
+ // Setup style
+ StubFileSource fileSource;
+ Style::Impl style{fileSource, 1.0};
+ style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json"));
+
+ // Try to add duplicate
+ try {
+ style.addLayer(std::make_unique<RasterLayer>("raster", "unusedsource"));
+ FAIL() << "Should not have been allowed to add an incompatible layer to the source";
+ } catch (const std::runtime_error& e) {
+ // Expected
+ ASSERT_STREQ("Layer 'raster' is not compatible with source 'unusedsource'", e.what());
+ }
+}
+
namespace {
template<template<typename> class PropertyValueType, typename LayoutType>