Skip to content

Commit

Permalink
🚨 Fix compiler errors on remaining targets
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBardon committed Dec 4, 2022
1 parent a383f71 commit 5ba4b88
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 65 deletions.
125 changes: 70 additions & 55 deletions .swiftpm/xcode/xcshareddata/xcschemes/swift-geo-Package.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GeodeticDisplay"
BuildableName = "GeodeticDisplay"
BlueprintName = "GeodeticDisplay"
BlueprintIdentifier = "Geodesy"
BuildableName = "Geodesy"
BlueprintName = "Geodesy"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -56,9 +56,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Geodesy"
BuildableName = "Geodesy"
BlueprintName = "Geodesy"
BlueprintIdentifier = "GeodeticDisplay"
BuildableName = "GeodeticDisplay"
BlueprintName = "GeodeticDisplay"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -84,23 +84,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Turf"
BuildableName = "Turf"
BlueprintName = "Turf"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "TurfTests"
BuildableName = "TurfTests"
BlueprintName = "TurfTests"
BlueprintIdentifier = "GeodeticConversions"
BuildableName = "GeodeticConversions"
BlueprintName = "GeodeticConversions"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -112,9 +98,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WGS84"
BuildableName = "WGS84"
BlueprintName = "WGS84"
BlueprintIdentifier = "Turf"
BuildableName = "Turf"
BlueprintName = "Turf"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -126,9 +112,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "TurfMapKit"
BuildableName = "TurfMapKit"
BlueprintName = "TurfMapKit"
BlueprintIdentifier = "TurfCore"
BuildableName = "TurfCore"
BlueprintName = "TurfCore"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -140,9 +126,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WGS84Core"
BuildableName = "WGS84Core"
BlueprintName = "WGS84Core"
BlueprintIdentifier = "TurfMapKit"
BuildableName = "TurfMapKit"
BlueprintName = "TurfMapKit"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -154,9 +140,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WGS84Geometry"
BuildableName = "WGS84Geometry"
BlueprintName = "WGS84Geometry"
BlueprintIdentifier = "WGS84"
BuildableName = "WGS84"
BlueprintName = "WGS84"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -168,9 +154,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WGS84Turf"
BuildableName = "WGS84Turf"
BlueprintName = "WGS84Turf"
BlueprintIdentifier = "WGS84Core"
BuildableName = "WGS84Core"
BlueprintName = "WGS84Core"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -182,9 +168,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "TurfCore"
BuildableName = "TurfCore"
BlueprintName = "TurfCore"
BlueprintIdentifier = "WGS84Geometry"
BuildableName = "WGS84Geometry"
BlueprintName = "WGS84Geometry"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -196,9 +182,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GeodeticConversions"
BuildableName = "GeodeticConversions"
BlueprintName = "GeodeticConversions"
BlueprintIdentifier = "WGS84Turf"
BuildableName = "WGS84Turf"
BlueprintName = "WGS84Turf"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -223,18 +209,47 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
enableAddressSanitizer = "YES">
enableAddressSanitizer = "YES"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES">
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Geodesy"
BuildableName = "Geodesy"
BlueprintName = "Geodesy"
ReferencedContainer = "container:">
</BuildableReference>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GeodeticConversions"
BuildableName = "GeodeticConversions"
BlueprintName = "GeodeticConversions"
ReferencedContainer = "container:">
</BuildableReference>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GeodeticGeometry"
BuildableName = "GeodeticGeometry"
BlueprintName = "GeodeticGeometry"
ReferencedContainer = "container:">
</BuildableReference>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Turf"
BuildableName = "Turf"
BlueprintName = "Turf"
ReferencedContainer = "container:">
</BuildableReference>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WGS84"
BuildableName = "WGS84"
BlueprintName = "WGS84"
ReferencedContainer = "container:">
</BuildableReference>
</CodeCoverageTargets>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "TurfTests"
BuildableName = "TurfTests"
BlueprintName = "TurfTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
Expand Down
2 changes: 1 addition & 1 deletion Sources/GeodeticConversions/ConvertibleCRS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public extension Point {
static func + <OtherCRS>(lhs: Self, rhs: Point<OtherCRS>) -> Self
where CRS: ConvertibleCRS, OtherCRS: ConvertibleCRS
{
Self.init(coordinates: lhs.coordinates + rhs.coordinates.to(to: OtherCRS.self))
Self.init(coordinates: lhs.coordinates + rhs.coordinates.to(CRS.self))
}
}

Expand Down
29 changes: 25 additions & 4 deletions Tests/TurfCoreTests/Toolbox/MapSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@ func snapshot(
assert(points.count == polyline.pointCount)
mapView.addOverlay(polyline, level: .aboveRoads)

while (!delegate.renderingFinished) {
while (delegate.renderingStep == .rendering) {
// Wait 100ms
try await Task.sleep(nanoseconds: 100 * NSEC_PER_MSEC)
}
return mapView.snapshot
switch delegate.renderingStep {
case .rendered:
return mapView.snapshot
case .error(let error):
throw XCTSkip(String(describing: error))
case .rendering:
XCTFail("Unexpected code path: `delegate.renderingStep` should not equal `.rendering`", file: file, line: line)
throw XCTSkip()
}
}

extension NSView {
Expand All @@ -65,7 +73,11 @@ extension NSView {

final class MapDelegate: NSObject, MKMapViewDelegate {

var renderingFinished = false
enum RenderingStep: Equatable {
case rendering, rendered, error(MKError)
}

var renderingStep = RenderingStep.rendering

func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if overlay is MKPolyline {
Expand All @@ -77,8 +89,17 @@ final class MapDelegate: NSObject, MKMapViewDelegate {
return MKOverlayRenderer()
}

func mapViewDidFailLoadingMap(_ mapView: MKMapView, withError error: Error) {
if let error = error as? MKError {
self.renderingStep = .error(error)
} else {
assertionFailure("Error is not a `MKError`: \(error)")
self.renderingStep = .error(.init(.unknown, userInfo: [:]))
}
}

func mapViewDidFinishRenderingMap(_ mapView: MKMapView, fullyRendered: Bool) {
self.renderingFinished = true
self.renderingStep = .rendered
}

}
11 changes: 6 additions & 5 deletions Tests/WGS84Tests/WSG84Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@
//

import Geodesy
import GeodeticConversions
import WGS84
import XCTest

final class ConversionTests: XCTestCase {
/// Example from <https://epsg.io/transform#s_srs=4979&t_srs=4978&x=90&y=0>.
func testEPSG9602() {
let c1 = Coordinate2D(x: 0, y: 90)
let c2 = c1.transformed(toCRS: WGS84Geographic3DCRS.self)
let c2 = c1.to(WGS84Geographic3DCRS.self)
XCTAssertEqual(c2, Coordinate3D(x: 0, y: 90, z: 0))
let c3 = c2.transformed(toCRS: WGS84GeocentricCRS.self)
XCTAssertEqual(c3, Coordinate3DOf<WGS84GeocentricCRS>(
let c3 = c2.to(WGS84GeocentricCRS.self)
XCTAssertEqual(c3, Coordinates3DOf<WGS84GeocentricCRS>(
x: 3.905482530786651e-10,
y: .init(WGS84Ensemble.Ellipsoid.semiMajorAxis),
z: 0
))
let c4 = c3.transformed(toCRS: WGS84Geographic3DCRS.self)
let c4 = c3.to(WGS84Geographic3DCRS.self)
XCTAssertEqual(c4, Coordinate3D(x: 0, y: 90, z: 0))
let c5 = c4.transformed(toCRS: WGS84Geographic2DCRS.self)
let c5 = c4.to(WGS84Geographic2DCRS.self)
XCTAssertEqual(c5, c1)
}

Expand Down

0 comments on commit 5ba4b88

Please sign in to comment.