summaryrefslogtreecommitdiff
path: root/test/map
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-07-19 15:42:03 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-08-23 09:55:32 -0700
commit6bbb2e4c2b5fdb07be229b3eee03f355dc3103e5 (patch)
treeef5d0ac891bd80248a2a4946b9c9f5f85e57a587 /test/map
parentdf3b44531e1c2a95edd2a035d3744f34ebb8d0e9 (diff)
downloadqtlocation-mapboxgl-6bbb2e4c2b5fdb07be229b3eee03f355dc3103e5.tar.gz
[tests] Merge single test in set_style.cpp with other Map tests
Diffstat (limited to 'test/map')
-rw-r--r--test/map/map.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/map/map.cpp b/test/map/map.cpp
index d60c7e945c..1f6e59f3ea 100644
--- a/test/map/map.cpp
+++ b/test/map/map.cpp
@@ -1,5 +1,6 @@
#include <mbgl/test/util.hpp>
#include <mbgl/test/stub_file_source.hpp>
+#include <mbgl/test/fixture_log_observer.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/platform/default/headless_view.hpp>
@@ -53,6 +54,24 @@ TEST(Map, Offline) {
NetworkStatus::Set(NetworkStatus::Status::Online);
}
+TEST(Map, SetStyleInvalidJSON) {
+ MapTest test;
+
+ Log::setObserver(std::make_unique<FixtureLogObserver>());
+
+ {
+ Map map(test.view, test.fileSource, MapMode::Still);
+ map.setStyleJSON("invalid");
+ }
+
+ auto observer = Log::removeObserver();
+ auto flo = dynamic_cast<FixtureLogObserver*>(observer.get());
+ EXPECT_EQ(1u, flo->count({ EventSeverity::Error, Event::ParseStyle, -1,
+ "Error parsing style JSON at 0: Invalid value." }));
+ auto unchecked = flo->unchecked();
+ EXPECT_TRUE(unchecked.empty()) << unchecked;
+}
+
TEST(Map, DoubleStyleLoad) {
MapTest test;