summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2020-02-12 12:34:30 +0200
committerJuha Alanen <juha.alanen@mapbox.com>2020-02-14 12:01:52 +0200
commita4c4de28285a5abe1343fe5abf718adad2b9d354 (patch)
treecb2ab9ecdc7d46fd21839af8b42c71821e7e2842 /test
parentddc7930b2792ffe12e7d1d3e0a231b7e204e1ff5 (diff)
downloadqtlocation-mapboxgl-a4c4de28285a5abe1343fe5abf718adad2b9d354.tar.gz
[test] Fix failing tests on iOS
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/local_glyphs/ping_fang/expected.pngbin18174 -> 17731 bytes
-rw-r--r--test/map/transform.test.cpp5
-rw-r--r--test/storage/offline_database.test.cpp8
-rw-r--r--test/tile/vector_tile.test.cpp2
-rw-r--r--test/util/tile_cover.test.cpp4
5 files changed, 11 insertions, 8 deletions
diff --git a/test/fixtures/local_glyphs/ping_fang/expected.png b/test/fixtures/local_glyphs/ping_fang/expected.png
index 2ec62e1bc6..8c891a5232 100644
--- a/test/fixtures/local_glyphs/ping_fang/expected.png
+++ b/test/fixtures/local_glyphs/ping_fang/expected.png
Binary files differ
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index 95fb744206..02ecbfbee4 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -621,7 +621,8 @@ TEST(Transform, LatLngBounds) {
}
transform.jumpTo(CameraOptions().withCenter(sanFrancisco));
- ASSERT_EQ(transform.getLatLng(), sanFrancisco);
+ ASSERT_NEAR(transform.getLatLng().latitude(), sanFrancisco.latitude(), 1e-8);
+ ASSERT_NEAR(transform.getLatLng().longitude(), sanFrancisco.longitude(), 1e-8);
// Single location.
transform.setLatLngBounds(LatLngBounds::singleton(sanFrancisco));
@@ -655,7 +656,7 @@ TEST(Transform, LatLngBounds) {
// └───┴───┸───┴───┸───┴───┘
transform.setLatLngBounds(LatLngBounds::hull({ -90.0, 0.0 }, { 90.0, 180.0 }));
transform.jumpTo(CameraOptions().withCenter(sanFrancisco));
- ASSERT_EQ(transform.getLatLng().latitude(), sanFrancisco.latitude());
+ ASSERT_NEAR(transform.getLatLng().latitude(), sanFrancisco.latitude(), 1e-8);
ASSERT_EQ(transform.getLatLng().longitude(), 0.0);
// -1 | 0 | +1
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index f988457dac..f344151297 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -779,7 +779,7 @@ TEST(OfflineDatabase, MapboxTileLimitExceeded) {
db.put(ambientTile, response);
};
- auto insertRegionTile = [&](int64_t regionID, unsigned i) {
+ auto insertRegionTile = [&](int64_t regionID, uint64_t i) {
const Resource tile = Resource::tile("mapbox://region_tile_" + std::to_string(i), 1, 0, 0, 0, Tileset::Scheme::XYZ);
db.putRegionResource(regionID, tile, response);
};
@@ -801,14 +801,14 @@ TEST(OfflineDatabase, MapboxTileLimitExceeded) {
ASSERT_EQ(db.getOfflineMapboxTileCount(), 0);
// Fine because this region is under the tile limit.
- for (unsigned i = 0; i < limit - 10; ++i) {
+ for (uint64_t i = 0; i < limit - 10; ++i) {
insertRegionTile(region1->getID(), i);
}
ASSERT_EQ(db.getOfflineMapboxTileCount(), limit - 10);
// Fine because this region + the previous is at the limit.
- for (unsigned i = limit; i < limit + 10; ++i) {
+ for (uint64_t i = limit; i < limit + 10; ++i) {
insertRegionTile(region2->getID(), i);
}
@@ -848,7 +848,7 @@ TEST(OfflineDatabase, MapboxTileLimitExceeded) {
// 10, which would blow up the limit if it wasn't
// for the fact that tile 60 is already on the
// database and will not count.
- for (unsigned i = limit; i < limit + 10; ++i) {
+ for (uint64_t i = limit; i < limit + 10; ++i) {
insertRegionTile(region1->getID(), i);
}
diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp
index d282c874ef..b89a572f7f 100644
--- a/test/tile/vector_tile.test.cpp
+++ b/test/tile/vector_tile.test.cpp
@@ -91,6 +91,8 @@ TEST(VectorTileData, ParseResults) {
ASSERT_TRUE(false) << "should throw: feature index is out of range.";
} catch (const std::out_of_range&) {
ASSERT_TRUE(true);
+ } catch (...) { // needed for iOS when MBGL_WITH_RTTI=OFF
+ ASSERT_TRUE(true);
}
std::unique_ptr<GeometryTileFeature> feature = layer->getFeature(0u);
diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp
index af9f0c4884..ba39bfa61b 100644
--- a/test/util/tile_cover.test.cpp
+++ b/test/util/tile_cover.test.cpp
@@ -365,7 +365,7 @@ TEST(TileCount, BoundsCrossingAntimeridian) {
TEST(TileCover, DISABLED_FuzzPoly) {
while(true)
{
- std::srand (time(nullptr));
+ std::srand(static_cast<uint32_t>(time(nullptr)));
std::size_t len = std::rand() % 10000 + 3;
Polygon<double> polygon;
@@ -393,7 +393,7 @@ TEST(TileCover, DISABLED_FuzzPoly) {
TEST(TileCover, DISABLED_FuzzLine) {
while(true)
{
- std::srand (time(nullptr));
+ std::srand(static_cast<uint32_t>(time(nullptr)));
std::size_t len = std::rand() % 10000 + 3;
MultiLineString<double> mls;