- Do not carry it over everywhere as parameter, it is a shared instance anyway and the lifecycle is pretty much the app lifecycle from the moment we instantiate a map. - Rename to BackgroundScheduler because it is a Scheduler that will do tasks in the background, we don't make assumptions if it is a thread pool or a single thread. - Most importantly, remove the dependency from `core` on `platform`.
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#include <mbgl/test/util.hpp>
|
|
#include <mbgl/test/stub_file_source.hpp>
|
|
#include <mbgl/test/fixture_log_observer.hpp>
|
|
#include <mbgl/test/map_adapter.hpp>
|
|
|
|
#include <mbgl/map/map_options.hpp>
|
|
#include <mbgl/gfx/backend_scope.hpp>
|
|
#include <mbgl/gl/headless_frontend.hpp>
|
|
#include <mbgl/util/exception.hpp>
|
|
#include <mbgl/util/run_loop.hpp>
|
|
|
|
#include <future>
|
|
|
|
using namespace mbgl;
|
|
|
|
|
|
TEST(API, RenderWithoutCallback) {
|
|
auto log = new FixtureLogObserver();
|
|
Log::setObserver(std::unique_ptr<Log::Observer>(log));
|
|
|
|
util::RunLoop loop;
|
|
|
|
HeadlessFrontend frontend { 1 };
|
|
|
|
auto map = std::make_unique<MapAdapter>(frontend, MapObserver::nullObserver(),
|
|
std::make_shared<StubFileSource>(),
|
|
MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()));
|
|
map->renderStill(nullptr);
|
|
|
|
// Force Map thread to join.
|
|
map.reset();
|
|
|
|
const FixtureLogObserver::LogMessage logMessage {
|
|
EventSeverity::Error,
|
|
Event::General,
|
|
int64_t(-1),
|
|
"StillImageCallback not set",
|
|
};
|
|
|
|
EXPECT_EQ(log->count(logMessage), 1u);
|
|
}
|