summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLFeatureTests.mm
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@gmail.com>2019-01-14 15:17:13 -0500
committerGitHub <noreply@github.com>2019-01-14 15:17:13 -0500
commitc8c664fbf376b615b3f1e4b2a4d7f1c99b6097be (patch)
tree414451567862d1bca08bcff1798ebb6b6501ad8d /platform/darwin/test/MGLFeatureTests.mm
parent2342b8ee936b9ecce33e152d109a091e505488e6 (diff)
downloadqtlocation-mapboxgl-c8c664fbf376b615b3f1e4b2a4d7f1c99b6097be.tar.gz
[ios, macos] Support getLeaves (and related) clustering methods (#12952) following feature extension API (#13382)
Diffstat (limited to 'platform/darwin/test/MGLFeatureTests.mm')
-rw-r--r--platform/darwin/test/MGLFeatureTests.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLFeatureTests.mm b/platform/darwin/test/MGLFeatureTests.mm
index 67f2a9a45e..edc105bca4 100644
--- a/platform/darwin/test/MGLFeatureTests.mm
+++ b/platform/darwin/test/MGLFeatureTests.mm
@@ -2,6 +2,7 @@
#import <XCTest/XCTest.h>
#import <mbgl/util/geometry.hpp>
+#import "MGLFoundation_Private.h"
#import "../../darwin/src/MGLFeature_Private.h"
@interface MGLFeatureTests : XCTestCase
@@ -85,6 +86,26 @@
[NSValue valueWithMGLCoordinate:CLLocationCoordinate2DMake(3, 2)]);
}
+- (void)testClusterGeometryConversion {
+ mbgl::Point<double> point = { -90.066667, 29.95 };
+ mbgl::Feature pointFeature { point };
+ pointFeature.id = { UINT64_MAX };
+ pointFeature.properties["cluster"] = true;
+ pointFeature.properties["cluster_id"] = 1ULL;
+ pointFeature.properties["point_count"] = 5ULL;
+
+ id<MGLFeature> feature = MGLFeatureFromMBGLFeature(pointFeature);
+
+ XCTAssert([feature conformsToProtocol:@protocol(MGLFeature)]);
+
+ id<MGLCluster> cluster = MGL_OBJC_DYNAMIC_CAST_AS_PROTOCOL(feature, MGLCluster);
+ XCTAssert(cluster);
+ XCTAssert(cluster.clusterIdentifier == 1);
+ XCTAssert(cluster.clusterPointCount == 5);
+
+ XCTAssert([cluster isMemberOfClass:[MGLPointFeatureCluster class]]);
+}
+
- (void)testPropertyConversion {
std::vector<mbgl::Feature> features;