[core] add MapChangeDidFinishLoadingStyle signal (#6371)

This commit is contained in:
Ivo van Dongen
2016-09-20 09:55:53 +02:00
committed by GitHub
parent 073a675c29
commit f3b38df91d
5 changed files with 29 additions and 0 deletions

View File

@@ -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;