summaryrefslogtreecommitdiff
path: root/test/style
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-21 16:28:11 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-21 19:33:36 +0200
commit1f8910de186f35216791a17a683a55f01031ec81 (patch)
treeee470e8e1ee6f85094afce6d1a227018b9780eb6 /test/style
parent86cddaf751e4c66f117b28fb013a43486581c948 (diff)
downloadqtlocation-mapboxgl-1f8910de186f35216791a17a683a55f01031ec81.tar.gz
Make Source::getZoomRange return an optional range
Diffstat (limited to 'test/style')
-rw-r--r--test/style/source.test.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp
index 6bb18d188b..f637f1ccde 100644
--- a/test/style/source.test.cpp
+++ b/test/style/source.test.cpp
@@ -13,6 +13,8 @@
#include <mbgl/util/tileset.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/logging.hpp>
+#include <mbgl/util/optional.hpp>
+#include <mbgl/util/range.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/style/style.hpp>
@@ -23,6 +25,8 @@
#include <mapbox/geojsonvt.hpp>
+#include <cstdint>
+
using namespace mbgl;
class SourceTest {
@@ -68,25 +72,28 @@ public:
TEST(Source, DefaultZoomRange) {
VectorSource vectorSource("vectorSource", "url");
+ EXPECT_FALSE(vectorSource.getZoomRange());
vectorSource.baseImpl->loaded = true;
- EXPECT_EQ(vectorSource.getZoomRange().min, 0u);
- EXPECT_EQ(vectorSource.getZoomRange().max, 22u);
+ EXPECT_EQ(vectorSource.getZoomRange()->min, 0u);
+ EXPECT_EQ(vectorSource.getZoomRange()->max, 22u);
GeoJSONSource geojsonSource("source");
+ EXPECT_FALSE(geojsonSource.getZoomRange());
geojsonSource.baseImpl->loaded = true;
- EXPECT_EQ(geojsonSource.getZoomRange().min, 0u);
- EXPECT_EQ(geojsonSource.getZoomRange().max, 18u);
+ EXPECT_EQ(geojsonSource.getZoomRange()->min, 0u);
+ EXPECT_EQ(geojsonSource.getZoomRange()->max, 18u);
Tileset tileset;
RasterSource rasterSource("source", tileset, 512);
+ EXPECT_FALSE(rasterSource.getZoomRange());
rasterSource.baseImpl->loaded = true;
- EXPECT_EQ(rasterSource.getZoomRange().min, 0u);
- EXPECT_EQ(rasterSource.getZoomRange().max, 22u);
- EXPECT_EQ(rasterSource.getZoomRange(), tileset.zoomRange);
+ EXPECT_EQ(rasterSource.getZoomRange()->min, 0u);
+ EXPECT_EQ(rasterSource.getZoomRange()->max, 22u);
+ EXPECT_EQ(*rasterSource.getZoomRange(), tileset.zoomRange);
AnnotationSource annotationSource;
- EXPECT_EQ(annotationSource.getZoomRange().min, 0u);
- EXPECT_EQ(annotationSource.getZoomRange().max, 22u);
+ EXPECT_EQ(annotationSource.getZoomRange()->min, 0u);
+ EXPECT_EQ(annotationSource.getZoomRange()->max, 22u);
}
TEST(Source, LoadingFail) {