Skip to content

Commit

Permalink
internal to main merge. (#66)
Browse files Browse the repository at this point in the history
* Update generated code (#1708)

Co-authored-by: Roman Gardukevich <[email protected]>
Co-authored-by: Roman Laitarenko <[email protected]>
Co-authored-by: Patrick Leonard <[email protected]>
Co-authored-by: Mai Mai <[email protected]>
Co-authored-by: ZiZi <[email protected]>
Co-authored-by: Kiryl Dzehtsiarenka <[email protected]>
  • Loading branch information
7 people authored Nov 10, 2022
1 parent 5584957 commit 7c5eb06
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class CircleAnnotationManager: AnnotationManagerInternal {
self.offsetPointCalculator = offsetPointCalculator
self.dragLayerId = id + "_drag-layer"
self.dragSourceId = id + "_drag-source"

do {
// Add the source with empty `data` property
var source = GeoJSONSource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ final class CircleAnnotationManagerTests: XCTestCase, AnnotationInteractionDeleg
style = MockStyle()
displayLinkCoordinator = MockDisplayLinkCoordinator()
offsetPointCalculator = OffsetPointCalculator(mapboxMap: mapboxMap)
manager = CircleAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
manager = CircleAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)

for _ in 0...10 {
let annotation = CircleAnnotation(point: .init(.init(latitude: 0, longitude: 0)))
Expand All @@ -45,11 +47,13 @@ final class CircleAnnotationManagerTests: XCTestCase, AnnotationInteractionDeleg
func testSourceSetup() {
style.addSourceStub.reset()

_ = CircleAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
_ = CircleAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)

XCTAssertEqual(style.addSourceStub.invocations.count, 1)
XCTAssertEqual(style.addSourceStub.invocations.last?.parameters.source.type, SourceType.geoJson)
Expand All @@ -58,11 +62,13 @@ final class CircleAnnotationManagerTests: XCTestCase, AnnotationInteractionDeleg

func testAddLayer() {
style.addSourceStub.reset()
let initializedManager = CircleAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
let initializedManager = CircleAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)

XCTAssertEqual(style.addSourceStub.invocations.count, 1)
XCTAssertEqual(style.addPersistentLayerWithPropertiesStub.invocations.count, 0)
Expand All @@ -80,23 +86,27 @@ final class CircleAnnotationManagerTests: XCTestCase, AnnotationInteractionDeleg
}

manager.annotations = annotations
let manager2 = CircleAnnotationManager(id: manager.id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
let manager2 = CircleAnnotationManager(
id: manager.id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)
manager2.annotations = annotations2

XCTAssertEqual(manager.annotations.count, 11)
XCTAssertEqual(manager2.annotations.count, 51)
}

func testLayerPositionPassedCorrectly() {
let manager3 = CircleAnnotationManager(id: id,
style: style,
layerPosition: LayerPosition.at(4),
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
let manager3 = CircleAnnotationManager(
id: id,
style: style,
layerPosition: LayerPosition.at(4),
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)
manager3.annotations = annotations

XCTAssertEqual(style.addPersistentLayerStub.invocations.last?.parameters.layerPosition, LayerPosition.at(4))
Expand Down Expand Up @@ -483,6 +493,7 @@ final class CircleAnnotationManagerTests: XCTestCase, AnnotationInteractionDeleg
expectation = nil
}


func testHandleDragBeginNoFeatureId() {
style.addSourceStub.reset()
style.addPersistentLayerWithPropertiesStub.reset()
Expand Down Expand Up @@ -526,7 +537,6 @@ final class CircleAnnotationManagerTests: XCTestCase, AnnotationInteractionDeleg
XCTAssertTrue(updateSourceParameters.id == addSourceParameters.id)
}


func testHandleDragChanged() throws {
mapboxMap.pointStub.defaultReturnValue = CGPoint(x: 0, y: 0)
mapboxMap.coordinateForPointStub.defaultReturnValue = .random()
Expand Down Expand Up @@ -574,7 +584,6 @@ final class CircleAnnotationManagerTests: XCTestCase, AnnotationInteractionDeleg
XCTAssertNotEqual(removeSourceParameters, self.manager.sourceId)
}
}

}

// End of generated file
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
style = MockStyle()
displayLinkCoordinator = MockDisplayLinkCoordinator()
offsetPointCalculator = OffsetPointCalculator(mapboxMap: mapboxMap)
manager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
manager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)

for _ in 0...10 {
let annotation = PointAnnotation(point: .init(.init(latitude: 0, longitude: 0)))
Expand All @@ -45,11 +47,13 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
func testSourceSetup() {
style.addSourceStub.reset()

_ = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
_ = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)

XCTAssertEqual(style.addSourceStub.invocations.count, 1)
XCTAssertEqual(style.addSourceStub.invocations.last?.parameters.source.type, SourceType.geoJson)
Expand All @@ -58,11 +62,13 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega

func testAddLayer() {
style.addSourceStub.reset()
let initializedManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
let initializedManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)

XCTAssertEqual(style.addSourceStub.invocations.count, 1)
XCTAssertEqual(style.addPersistentLayerWithPropertiesStub.invocations.count, 0)
Expand All @@ -80,23 +86,27 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
}

manager.annotations = annotations
let manager2 = PointAnnotationManager(id: manager.id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
let manager2 = PointAnnotationManager(
id: manager.id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)
manager2.annotations = annotations2

XCTAssertEqual(manager.annotations.count, 11)
XCTAssertEqual(manager2.annotations.count, 51)
}

func testLayerPositionPassedCorrectly() {
let manager3 = PointAnnotationManager(id: id,
style: style,
layerPosition: LayerPosition.at(4),
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator)
let manager3 = PointAnnotationManager(
id: id,
style: style,
layerPosition: LayerPosition.at(4),
displayLinkCoordinator: displayLinkCoordinator,
offsetPointCalculator: offsetPointCalculator
)
manager3.annotations = annotations

XCTAssertEqual(style.addPersistentLayerStub.invocations.last?.parameters.layerPosition, LayerPosition.at(4))
Expand Down Expand Up @@ -2839,12 +2849,14 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
}

// when
let pointAnnotationManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator)
let pointAnnotationManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator
)
pointAnnotationManager.annotations = annotations

// then
Expand Down Expand Up @@ -2880,13 +2892,14 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
}

// when
let pointAnnotationManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator)

let pointAnnotationManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator
)
pointAnnotationManager.annotations = annotations
let geoJSONSource = style.addSourceStub.invocations.last?.parameters.source as! GeoJSONSource

Expand Down Expand Up @@ -2914,12 +2927,14 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
}

// when
let pointAnnotationManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator)
let pointAnnotationManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator
)
pointAnnotationManager.annotations = annotations

// then
Expand Down Expand Up @@ -2954,12 +2969,14 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
}

// when
let pointAnnotationManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator)
let pointAnnotationManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator
)
pointAnnotationManager.annotations = annotations

// then
Expand All @@ -2986,12 +3003,14 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
}

// when
let pointAnnotationManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator)
let pointAnnotationManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator
)
pointAnnotationManager.annotations = annotations

// then
Expand Down Expand Up @@ -3025,12 +3044,14 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
}

// when
let pointAnnotationManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator)
let pointAnnotationManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator
)
pointAnnotationManager.annotations = annotations
pointAnnotationManager.syncSourceAndLayerIfNeeded()
var sourceGeoJSON = style.updateGeoJSONSourceStub.invocations.last?.parameters.geojson
Expand Down Expand Up @@ -3059,12 +3080,14 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
let clusterOptions = ClusterOptions()

// when
let pointAnnotationManager = PointAnnotationManager(id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator)
let pointAnnotationManager = PointAnnotationManager(
id: id,
style: style,
layerPosition: nil,
displayLinkCoordinator: displayLinkCoordinator,
clusterOptions: clusterOptions,
offsetPointCalculator: offsetPointCalculator
)
pointAnnotationManager.annotations = annotations
pointAnnotationManager.destroy()

Expand Down Expand Up @@ -3120,7 +3143,6 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
XCTAssertTrue(updateSourceParameters.id == addSourceParameters.id)
}


func testHandleDragChanged() throws {
mapboxMap.pointStub.defaultReturnValue = CGPoint(x: 0, y: 0)
mapboxMap.coordinateForPointStub.defaultReturnValue = .random()
Expand Down Expand Up @@ -3168,7 +3190,6 @@ final class PointAnnotationManagerTests: XCTestCase, AnnotationInteractionDelega
XCTAssertNotEqual(removeSourceParameters, self.manager.sourceId)
}
}

}

private extension PointAnnotation {
Expand All @@ -3177,5 +3198,4 @@ private extension PointAnnotation {
self.image = image
}
}

// End of generated file
Loading

0 comments on commit 7c5eb06

Please sign in to comment.