diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-09-17 18:51:53 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-09-18 16:21:59 +0300 |
commit | 224d49cc9083f8ecb418a68ae0fea839bc51def6 (patch) | |
tree | f7fe1451c5b3d9631f6d4e1e5672ae628ecd7982 /test | |
parent | 8b355c7f8b42d4523c3adfc3f7407a522273824f (diff) | |
download | qtlocation-mapboxgl-224d49cc9083f8ecb418a68ae0fea839bc51def6.tar.gz |
[core] Check layer compatibility with source
Diffstat (limited to 'test')
-rw-r--r-- | test/style/style_layer.test.cpp | 18 |
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> |