[core] private OffscreenView implementation
This commit is contained in:
@@ -34,7 +34,7 @@ struct MapTest {
|
||||
|
||||
TEST(Map, LatLngBehavior) {
|
||||
MapTest test;
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
|
||||
|
||||
@@ -68,7 +68,7 @@ TEST(Map, Offline) {
|
||||
fileSource.put(Resource::glyphs(prefix + "{fontstack}/{range}.pbf", {{"Helvetica"}}, {0, 255}), expiredItem("glyph.pbf"));
|
||||
NetworkStatus::Set(NetworkStatus::Status::Offline);
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL(prefix + "style.json");
|
||||
|
||||
test::checkImage("test/fixtures/map/offline",
|
||||
@@ -92,7 +92,7 @@ TEST(Map, SetStyleInvalidJSON) {
|
||||
});
|
||||
|
||||
{
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool,
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool,
|
||||
MapMode::Still);
|
||||
map.setStyleJSON("invalid");
|
||||
}
|
||||
@@ -124,7 +124,7 @@ TEST(Map, SetStyleInvalidURL) {
|
||||
}
|
||||
});
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL("mapbox://bar");
|
||||
|
||||
test.runLoop.run();
|
||||
@@ -133,7 +133,7 @@ TEST(Map, SetStyleInvalidURL) {
|
||||
TEST(Map, DoubleStyleLoad) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleJSON("");
|
||||
map.setStyleJSON("");
|
||||
}
|
||||
@@ -144,7 +144,7 @@ TEST(Map, StyleFresh) {
|
||||
MapTest test;
|
||||
FakeFileSource fileSource;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL("mapbox://styles/test");
|
||||
EXPECT_EQ(1u, fileSource.requests.size());
|
||||
|
||||
@@ -164,7 +164,7 @@ TEST(Map, StyleExpired) {
|
||||
MapTest test;
|
||||
FakeFileSource fileSource;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL("mapbox://styles/test");
|
||||
EXPECT_EQ(1u, fileSource.requests.size());
|
||||
|
||||
@@ -191,7 +191,7 @@ TEST(Map, StyleExpiredWithAnnotations) {
|
||||
MapTest test;
|
||||
FakeFileSource fileSource;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL("mapbox://styles/test");
|
||||
EXPECT_EQ(1u, fileSource.requests.size());
|
||||
|
||||
@@ -215,7 +215,7 @@ TEST(Map, StyleEarlyMutation) {
|
||||
MapTest test;
|
||||
FakeFileSource fileSource;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL("mapbox://styles/test");
|
||||
map.addLayer(std::make_unique<style::BackgroundLayer>("bg"));
|
||||
|
||||
@@ -229,7 +229,7 @@ TEST(Map, StyleEarlyMutation) {
|
||||
|
||||
TEST(Map, StyleLoadedSignal) {
|
||||
MapTest test;
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
|
||||
// The map should emit a signal on style loaded
|
||||
bool emitted = false;
|
||||
@@ -252,7 +252,7 @@ TEST(Map, TEST_REQUIRES_SERVER(StyleNetworkErrorRetry)) {
|
||||
MapTest test;
|
||||
OnlineFileSource fileSource;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL("http://127.0.0.1:3000/style-fail-once-500");
|
||||
|
||||
test.backend.setMapChangeCallback([&](MapChange change) {
|
||||
@@ -268,7 +268,7 @@ TEST(Map, TEST_REQUIRES_SERVER(StyleNotFound)) {
|
||||
MapTest test;
|
||||
OnlineFileSource fileSource;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleURL("http://127.0.0.1:3000/style-fail-once-404");
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
@@ -297,7 +297,7 @@ TEST(Map, TEST_REQUIRES_SERVER(StyleNotFound)) {
|
||||
TEST(Map, AddLayer) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
|
||||
|
||||
auto layer = std::make_unique<BackgroundLayer>("background");
|
||||
@@ -319,7 +319,7 @@ TEST(Map, WithoutVAOExtension) {
|
||||
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
|
||||
#endif
|
||||
|
||||
Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/water.json"));
|
||||
|
||||
test::checkImage("test/fixtures/map/no_vao", test::render(map, test.view), 0.002);
|
||||
@@ -328,7 +328,7 @@ TEST(Map, WithoutVAOExtension) {
|
||||
TEST(Map, RemoveLayer) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
|
||||
|
||||
auto layer = std::make_unique<BackgroundLayer>("background");
|
||||
@@ -353,7 +353,7 @@ TEST(Map, DisabledSources) {
|
||||
return {};
|
||||
};
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
map.setZoom(1);
|
||||
|
||||
// This stylesheet has two raster layers, one that starts at zoom 1, the other at zoom 0.
|
||||
@@ -403,7 +403,7 @@ TEST(Map, DisabledSources) {
|
||||
TEST(Map, Classes) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
|
||||
|
||||
EXPECT_FALSE(map.getTransitionOptions().duration);
|
||||
@@ -437,7 +437,7 @@ TEST(Map, Classes) {
|
||||
TEST(Map, AddImage) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
auto decoded1 = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
|
||||
auto decoded2 = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
|
||||
auto image1 = std::make_unique<SpriteImage>(std::move(decoded1), 1.0);
|
||||
@@ -454,7 +454,7 @@ TEST(Map, AddImage) {
|
||||
TEST(Map, RemoveImage) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
auto decoded = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
|
||||
auto image = std::make_unique<SpriteImage>(std::move(decoded), 1.0);
|
||||
|
||||
@@ -467,7 +467,7 @@ TEST(Map, RemoveImage) {
|
||||
TEST(Map, GetImage) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
auto decoded = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
|
||||
auto image = std::make_unique<SpriteImage>(std::move(decoded), 1.0);
|
||||
|
||||
@@ -479,7 +479,7 @@ TEST(Map, GetImage) {
|
||||
TEST(Map, DontLoadUnneededTiles) {
|
||||
MapTest test;
|
||||
|
||||
Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
|
||||
map.setStyleJSON(R"STYLE({
|
||||
"sources": {
|
||||
"a": { "type": "vector", "tiles": [ "a/{z}/{x}/{y}" ] }
|
||||
@@ -552,7 +552,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
|
||||
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
|
||||
#endif
|
||||
|
||||
Map map(backend, view.size, 1, fileSource, threadPool, MapMode::Continuous);
|
||||
Map map(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Continuous);
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user