summaryrefslogtreecommitdiff
path: root/test/tile
diff options
context:
space:
mode:
Diffstat (limited to 'test/tile')
-rw-r--r--test/tile/tile_coordinate.test.cpp35
-rw-r--r--test/tile/vector_tile.test.cpp6
2 files changed, 29 insertions, 12 deletions
diff --git a/test/tile/tile_coordinate.test.cpp b/test/tile/tile_coordinate.test.cpp
index 4d58bf8c51..8b1048fe16 100644
--- a/test/tile/tile_coordinate.test.cpp
+++ b/test/tile/tile_coordinate.test.cpp
@@ -1,6 +1,5 @@
#include <mbgl/test/util.hpp>
-#include <mbgl/map/change.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/tile/tile.hpp>
@@ -13,17 +12,35 @@
using namespace mbgl;
TEST(TileCoordinate, FromLatLng) {
+
size_t changeCount = 0;
- std::vector<MapChange> changes = {
- MapChangeRegionWillChange,
- MapChangeRegionDidChange,
+ struct TransformObserver : public mbgl::MapObserver {
+ void onCameraWillChange(MapObserver::CameraChangeMode mode) final {
+ if (mode == MapObserver::CameraChangeMode::Immediate && cameraWillChangeImmediateCallback) {
+ cameraWillChangeImmediateCallback();
+ }
+ }
+
+ void onCameraDidChange(MapObserver::CameraChangeMode mode) final {
+ if (mode == MapObserver::CameraChangeMode::Immediate && cameraDidChangeImmediateCallback) {
+ cameraDidChangeImmediateCallback();
+ }
+ }
+
+ std::function<void()> cameraWillChangeImmediateCallback;
+ std::function<void()> cameraDidChangeImmediateCallback;
};
- auto onMapChange = [&](MapChange change) {
- ASSERT_EQ(change, changes[changeCount]);
+
+ TransformObserver observer;
+ observer.cameraWillChangeImmediateCallback = [&]() {
+ ASSERT_EQ(changeCount, 0u);
++changeCount;
};
+ observer.cameraDidChangeImmediateCallback = [&]() {
+ ASSERT_EQ(changeCount, 1u);
+ };
- Transform transform(onMapChange);
+ Transform transform(observer);
const double max = util::tileSize;
transform.resize({ static_cast<uint32_t>(max), static_cast<uint32_t>(max) });
@@ -47,8 +64,8 @@ TEST(TileCoordinate, FromLatLng) {
const double zoom = integerZoom;
const double maxTilesPerAxis = std::pow(2.0, zoom);
const Point<double> tilePoint = {
- latLng.longitude == 0 ? 0.5 : latLng.longitude == -util::LONGITUDE_MAX ? 0 : 1.0,
- latLng.latitude == 0 ? 0.5 : latLng.latitude == -util::LATITUDE_MAX ? 1.0 : 0,
+ latLng.longitude() == 0 ? 0.5 : latLng.longitude() == -util::LONGITUDE_MAX ? 0 : 1.0,
+ latLng.latitude() == 0 ? 0.5 : latLng.latitude() == -util::LATITUDE_MAX ? 1.0 : 0,
};
const auto fromLatLng = TileCoordinate::fromLatLng(zoom, latLng);
diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp
index f9bdafa5d2..a388e8937e 100644
--- a/test/tile/vector_tile.test.cpp
+++ b/test/tile/vector_tile.test.cpp
@@ -61,11 +61,11 @@ TEST(VectorTile, Issue7615) {
style::SymbolLayer symbolLayer("symbol", "source");
auto symbolBucket = std::make_shared<SymbolBucket>(
- style::SymbolLayoutProperties::Evaluated(),
- std::unordered_map<
+ style::SymbolLayoutProperties::PossiblyEvaluated(),
+ std::map<
std::string,
std::pair<style::IconPaintProperties::Evaluated, style::TextPaintProperties::Evaluated>>(),
- 0.0f, false, false);
+ 16.0f, 1.0f, 0.0f, false, false);
// Simulate placement of a symbol layer.
tile.onPlacement(GeometryTile::PlacementResult {