[core] separate Backend from View for headless rendering
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
#include <mbgl/test/fixture_log_observer.hpp>
|
||||
|
||||
#include <mbgl/map/map.hpp>
|
||||
#include <mbgl/platform/default/headless_display.hpp>
|
||||
#include <mbgl/platform/default/headless_backend.hpp>
|
||||
#include <mbgl/platform/default/headless_view.hpp>
|
||||
#include <mbgl/storage/online_file_source.hpp>
|
||||
#include <mbgl/platform/default/thread_pool.hpp>
|
||||
#include <mbgl/util/exception.hpp>
|
||||
@@ -19,13 +20,14 @@ TEST(API, RenderWithoutCallback) {
|
||||
|
||||
util::RunLoop loop;
|
||||
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
HeadlessBackend backend;
|
||||
HeadlessView view;
|
||||
view.resize(128, 512);
|
||||
StubFileSource fileSource;
|
||||
ThreadPool threadPool(4);
|
||||
|
||||
std::unique_ptr<Map> map = std::make_unique<Map>(view, fileSource, threadPool, MapMode::Still);
|
||||
std::unique_ptr<Map> map = std::make_unique<Map>(backend, view, view.getPixelRatio(),
|
||||
fileSource, threadPool, MapMode::Still);
|
||||
map->renderStill(nullptr);
|
||||
|
||||
// Force Map thread to join.
|
||||
@@ -44,13 +46,13 @@ TEST(API, RenderWithoutCallback) {
|
||||
TEST(API, RenderWithoutStyle) {
|
||||
util::RunLoop loop;
|
||||
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
HeadlessBackend backend;
|
||||
HeadlessView view;
|
||||
view.resize(128, 512);
|
||||
StubFileSource fileSource;
|
||||
ThreadPool threadPool(4);
|
||||
|
||||
Map map(view, fileSource, threadPool, MapMode::Still);
|
||||
Map map(backend, view, view.getPixelRatio(), fileSource, threadPool, MapMode::Still);
|
||||
|
||||
std::exception_ptr error;
|
||||
map.renderStill([&](std::exception_ptr error_, PremultipliedImage&&) {
|
||||
|
||||
Reference in New Issue
Block a user