Files
MapLibreParticleLab/test/miscellaneous/map_context.cpp
Thiago Marcos P. Santos b162fb7c6f Make the MapContext object run on its own thread on the tests
The MapContext can only run on its own thread because it is
registering a EnvironmentScope and it is making many assertions
on Debug mode if its methods are being called on the Map thread.
2015-05-15 13:06:23 +03:00

25 lines
872 B
C++

#include "../fixtures/util.hpp"
#include <mbgl/map/map_data.hpp>
#include <mbgl/map/map_context.hpp>
#include <mbgl/platform/default/headless_view.hpp>
#include <mbgl/platform/default/headless_display.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/util/thread.hpp>
using namespace mbgl;
TEST(MapContext, DoubleStyleLoad) {
std::shared_ptr<HeadlessDisplay> display = std::make_shared<HeadlessDisplay>();
HeadlessView view(display, 512, 512, 1);
DefaultFileSource fileSource(nullptr);
MapData data(view, MapMode::Continuous);
std::unique_ptr<util::Thread<MapContext>> context(
util::make_unique<util::Thread<MapContext>>(
"Map", util::ThreadPriority::Regular, view, fileSource, data));
context->invokeSync(&MapContext::setStyleJSON, "", "");
context->invokeSync(&MapContext::setStyleJSON, "", "");
}