[core] change std::array<uint16_t, 2> to mbgl::Size

This commit is contained in:
Konstantin Käfer
2016-10-26 15:22:31 -07:00
parent ef8017198c
commit 62b56b799a
72 changed files with 461 additions and 431 deletions

View File

@@ -27,7 +27,7 @@ public:
OffscreenView view{ backend.getContext() };
StubFileSource fileSource;
ThreadPool threadPool { 4 };
Map map { backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still };
Map map { backend, view.size, 1, fileSource, threadPool, MapMode::Still };
void checkRendering(const char * name) {
test::checkImage(std::string("test/fixtures/annotations/") + name,
@@ -45,8 +45,8 @@ TEST(Annotations, SymbolAnnotation) {
test.map.addAnnotation(SymbolAnnotation { Point<double>(0, 0), "default_marker" });
test.checkRendering("point_annotation");
auto size = test.view.getSize();
auto screenBox = ScreenBox { {}, { double(size[0]), double(size[1]) } };
auto size = test.view.size;
auto screenBox = ScreenBox { {}, { double(size.width), double(size.height) } };
auto features = test.map.queryPointAnnotations(screenBox);
EXPECT_EQ(features.size(), 1u);
@@ -354,8 +354,8 @@ TEST(Annotations, QueryRenderedFeatures) {
TEST(Annotations, QueryFractionalZoomLevels) {
AnnotationTest test;
auto viewSize = test.view.getSize();
auto box = ScreenBox { {}, { double(viewSize[0]), double(viewSize[1]) } };
auto viewSize = test.view.size;
auto box = ScreenBox { {}, { double(viewSize.width), double(viewSize.height) } };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png"));
@@ -386,8 +386,8 @@ TEST(Annotations, QueryFractionalZoomLevels) {
TEST(Annotations, VisibleFeatures) {
AnnotationTest test;
auto viewSize = test.view.getSize();
auto box = ScreenBox { {}, { double(viewSize[0]), double(viewSize[1]) } };
auto viewSize = test.view.size;
auto box = ScreenBox { {}, { double(viewSize.width), double(viewSize.height) } };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png"));

View File

@@ -21,12 +21,12 @@ TEST(API, RenderWithoutCallback) {
util::RunLoop loop;
HeadlessBackend backend;
OffscreenView view(backend.getContext(), {{ 128, 512 }});
OffscreenView view(backend.getContext(), { 128, 512 });
StubFileSource fileSource;
ThreadPool threadPool(4);
std::unique_ptr<Map> map =
std::make_unique<Map>(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still);
std::make_unique<Map>(backend, view.size, 1, fileSource, threadPool, MapMode::Still);
map->renderStill(view, nullptr);
// Force Map thread to join.
@@ -46,11 +46,11 @@ TEST(API, RenderWithoutStyle) {
util::RunLoop loop;
HeadlessBackend backend;
OffscreenView view(backend.getContext(), {{ 128, 512 }});
OffscreenView view(backend.getContext(), { 128, 512 });
StubFileSource fileSource;
ThreadPool threadPool(4);
Map map(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still);
Map map(backend, view.size, 1, fileSource, threadPool, MapMode::Still);
std::exception_ptr error;
map.renderStill(view, [&](std::exception_ptr error_) {

View File

@@ -97,7 +97,7 @@ TEST(CustomLayer, Basic) {
ThreadPool threadPool(4);
Map map(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still);
Map map(backend, view.size, 1, fileSource, threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/water.json"));
map.setLatLngZoom({ 37.8, -122.5 }, 10);
map.addLayer(std::make_unique<CustomLayer>(

View File

@@ -30,7 +30,7 @@ public:
OffscreenView view { backend.getContext() };
StubFileSource fileSource;
ThreadPool threadPool { 4 };
Map map { backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still };
Map map { backend, view.size, 1, fileSource, threadPool, MapMode::Still };
};
} // end namespace

View File

@@ -26,7 +26,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) {
const auto style = util::read_file("test/fixtures/api/water_missing_tiles.json");
HeadlessBackend backend;
OffscreenView view(backend.getContext(), {{ 256, 512 }});
OffscreenView view(backend.getContext(), { 256, 512 });
#ifdef MBGL_ASSET_ZIP
// Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/`
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip");
@@ -38,7 +38,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) {
Log::setObserver(std::make_unique<FixtureLogObserver>());
Map map(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still);
Map map(backend, view.size, 1, fileSource, threadPool, MapMode::Still);
std::string message;

View File

@@ -20,7 +20,7 @@ TEST(API, RepeatedRender) {
const auto style = util::read_file("test/fixtures/api/water.json");
HeadlessBackend backend;
OffscreenView view(backend.getContext(), {{ 256, 512 }});
OffscreenView view(backend.getContext(), { 256, 512 });
#ifdef MBGL_ASSET_ZIP
// Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/`
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip");
@@ -32,7 +32,7 @@ TEST(API, RepeatedRender) {
Log::setObserver(std::make_unique<FixtureLogObserver>());
Map map(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still);
Map map(backend, view.size, 1, fileSource, threadPool, MapMode::Still);
{
map.setStyleJSON(style);
@@ -41,12 +41,12 @@ TEST(API, RepeatedRender) {
result = view.readStillImage();
});
while (!result.size()) {
while (!result.valid()) {
loop.runOnce();
}
ASSERT_EQ(256u, result.width);
ASSERT_EQ(512u, result.height);
ASSERT_EQ(256u, result.size.width);
ASSERT_EQ(512u, result.size.height);
#if !TEST_READ_ONLY
util::write_file("test/fixtures/api/1.png", encodePNG(result));
#endif
@@ -59,12 +59,12 @@ TEST(API, RepeatedRender) {
result = view.readStillImage();
});
while (!result.size()) {
while (!result.valid()) {
loop.runOnce();
}
ASSERT_EQ(256u, result.width);
ASSERT_EQ(512u, result.height);
ASSERT_EQ(256u, result.size.width);
ASSERT_EQ(512u, result.size.height);
#if !TEST_READ_ONLY
util::write_file("test/fixtures/api/2.png", encodePNG(result));
#endif