[tests] Merge single test in set_style.cpp with other Map tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user