From 224d49cc9083f8ecb418a68ae0fea839bc51def6 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Tue, 17 Sep 2019 18:51:53 +0300 Subject: [core] Check layer compatibility with source --- test/style/style_layer.test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/style') 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("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 class PropertyValueType, typename LayoutType> -- cgit v1.2.1