summaryrefslogtreecommitdiff
path: root/test/map
diff options
context:
space:
mode:
authorIvo van Dongen <ivovandongen@users.noreply.github.com>2016-09-20 09:55:53 +0200
committerGitHub <noreply@github.com>2016-09-20 09:55:53 +0200
commitf3b38df91dc22ddbeec45cd3dbce636253c75037 (patch)
tree31efcfa5315f686eae29b92ce8585a1fe2d9c93d /test/map
parent073a675c2951ca98efeb2a7b2973e27dada4c56e (diff)
downloadqtlocation-mapboxgl-f3b38df91dc22ddbeec45cd3dbce636253c75037.tar.gz
[core] add MapChangeDidFinishLoadingStyle signal (#6371)
Diffstat (limited to 'test/map')
-rw-r--r--test/map/map.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/map/map.cpp b/test/map/map.cpp
index e78160a324..6ecbc52e5f 100644
--- a/test/map/map.cpp
+++ b/test/map/map.cpp
@@ -202,6 +202,26 @@ TEST(Map, StyleEarlyMutation) {
EXPECT_NE(nullptr, map.getLayer("water"));
}
+TEST(Map, StyleLoadedSignal) {
+ MapTest test;
+ Map map(test.view, test.fileSource, MapMode::Still);
+
+ // The map should emit a signal on style loaded
+ bool emitted = false;
+ test.view.setMapChangeCallback([&](MapChange change) {
+ if (change == mbgl::MapChangeDidFinishLoadingStyle) {
+ emitted = true;
+ }
+ });
+ map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ EXPECT_TRUE(emitted);
+
+ // But not when the style couldn't be parsed
+ emitted = false;
+ map.setStyleJSON("invalid");
+ EXPECT_FALSE(emitted);
+}
+
TEST(Map, AddLayer) {
MapTest test;