summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-10-26 15:22:31 -0700
committerKonstantin Käfer <mail@kkaefer.com>2016-10-27 18:30:58 -0700
commit62b56b799a7d4fcd1a8f151eed878054b862da5b (patch)
tree34d510a69f9dd1bca30e9b137feffbd1eb6495d0 /test/api
parentef8017198ce8f0bd79ba5a5ed31e35a16e3433bb (diff)
downloadqtlocation-mapboxgl-62b56b799a7d4fcd1a8f151eed878054b862da5b.tar.gz
[core] change std::array<uint16_t, 2> to mbgl::Size
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.test.cpp14
-rw-r--r--test/api/api_misuse.test.cpp8
-rw-r--r--test/api/custom_layer.test.cpp2
-rw-r--r--test/api/query.test.cpp2
-rw-r--r--test/api/render_missing.test.cpp4
-rw-r--r--test/api/repeated_render.test.cpp16
6 files changed, 23 insertions, 23 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index 2c875796bd..06a0a61b0a 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -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"));
diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp
index eb271b0258..50a8f38c33 100644
--- a/test/api/api_misuse.test.cpp
+++ b/test/api/api_misuse.test.cpp
@@ -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_) {
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index 70de102b80..9d4ba04cee 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -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>(
diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp
index 8e59c19afc..d3c233ad34 100644
--- a/test/api/query.test.cpp
+++ b/test/api/query.test.cpp
@@ -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
diff --git a/test/api/render_missing.test.cpp b/test/api/render_missing.test.cpp
index 366d71e67d..b24d59ab21 100644
--- a/test/api/render_missing.test.cpp
+++ b/test/api/render_missing.test.cpp
@@ -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;
diff --git a/test/api/repeated_render.test.cpp b/test/api/repeated_render.test.cpp
index 715b49b289..1bea05b1fb 100644
--- a/test/api/repeated_render.test.cpp
+++ b/test/api/repeated_render.test.cpp
@@ -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