summaryrefslogtreecommitdiff
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
parentdf3b44531e1c2a95edd2a035d3744f34ebb8d0e9 (diff)
downloadqtlocation-mapboxgl-6bbb2e4c2b5fdb07be229b3eee03f355dc3103e5.tar.gz
[tests] Merge single test in set_style.cpp with other Map tests
-rw-r--r--cmake/test-files.cmake1
-rw-r--r--test/api/set_style.cpp33
-rw-r--r--test/map/map.cpp19
3 files changed, 19 insertions, 34 deletions
diff --git a/cmake/test-files.cmake b/cmake/test-files.cmake
index 4736af6c56..a157f2183c 100644
--- a/cmake/test-files.cmake
+++ b/cmake/test-files.cmake
@@ -13,7 +13,6 @@ set(MBGL_TEST_FILES
test/api/custom_layer.cpp
test/api/render_missing.cpp
test/api/repeated_render.cpp
- test/api/set_style.cpp
# geometry
test/geometry/binpack.cpp
diff --git a/test/api/set_style.cpp b/test/api/set_style.cpp
deleted file mode 100644
index 2399e4ea50..0000000000
--- a/test/api/set_style.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#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>
-#include <mbgl/platform/default/headless_display.hpp>
-#include <mbgl/util/run_loop.hpp>
-
-
-TEST(API, SetStyle) {
- using namespace mbgl;
-
- util::RunLoop loop;
-
- auto display = std::make_shared<mbgl::HeadlessDisplay>();
- HeadlessView view(display, 1);
- StubFileSource fileSource;
-
- Log::setObserver(std::make_unique<FixtureLogObserver>());
-
- {
- Map map(view, 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;
-}
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;