Skip to content

Commit 258a8c9

Browse files
authored
Merge pull request maplibre#41 from stadiamaps/housekeeping
Update dependencies
2 parents 49ccef3 + b236952 commit 258a8c9

File tree

6 files changed

+72
-46
lines changed

6 files changed

+72
-46
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ jobs:
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424
steps:
25-
- uses: rymndhng/release-on-push-action@master
25+
- uses: rymndhng/release-on-push-action@v0.28.0
2626
with:
27-
bump_version_scheme: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'patch' || inputs.bump_version_scheme }}
27+
bump_version_scheme: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'patch' || inputs.bump_version_scheme }}

Package.resolved

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ let package = Package(
2424
.package(url: "https://github.com/maplibre/maplibre-gl-native-distribution.git", from: "6.4.0"),
2525
.package(url: "https://github.com/stadiamaps/maplibre-swift-macros.git", from: "0.0.3"),
2626
// Testing
27-
.package(url: "https://github.com/Kolos65/Mockable.git", exact: "0.0.3"),
28-
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.15.3"),
27+
.package(url: "https://github.com/Kolos65/Mockable.git", exact: "0.0.9"),
28+
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.17.2"),
2929
],
3030
targets: [
3131
.target(

Sources/MapLibreSwiftUI/StaticLocationManager.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import MapLibre
1010
///
1111
/// You can provide a new location by setting the ``lastLocation`` property.
1212
///
13-
/// This class does not ever perform any authorization checks. That is the responsibility of the caller.
13+
/// While this class is required to implement authorization status per the underlying protocol,
14+
/// it does not ever actually check whether you have access to Core Location services.
1415
public final class StaticLocationManager: NSObject, @unchecked Sendable {
1516
public var delegate: (any MLNLocationManagerDelegate)?
1617

Tests/MapLibreSwiftUITests/MapViewCoordinator/MapViewCoordinatorCameraTests.swift

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ final class MapViewCoordinatorCameraTests: XCTestCase {
2323
@MainActor func testUnchangedCamera() {
2424
let camera: MapViewCamera = .default()
2525

26+
given(maplibreMapView)
27+
.setCenter(.any,
28+
zoomLevel: .any,
29+
direction: .any,
30+
animated: .any)
31+
.willReturn()
32+
2633
coordinator.updateCamera(mapView: maplibreMapView, camera: camera, animated: false)
2734
// Run a second update. We're testing that the snapshotCamera correctly exits the function
2835
// when nothing changed.
@@ -32,173 +39,192 @@ final class MapViewCoordinatorCameraTests: XCTestCase {
3239
// This verifies the comment above.
3340
verify(maplibreMapView)
3441
.userTrackingMode(newValue: .value(.none))
35-
.setterCalled(count: 1)
42+
.setCalled(1)
3643

3744
verify(maplibreMapView)
3845
.setCenter(.value(MapViewCamera.Defaults.coordinate),
3946
zoomLevel: .value(10),
4047
direction: .value(0),
4148
animated: .value(false))
42-
.called(count: 1)
49+
.called(1)
4350

4451
// Due to the .frame == .zero workaround, min/max pitch setting is called twice, once to set the
4552
// pitch, and then once to set the actual range.
4653
verify(maplibreMapView)
4754
.minimumPitch(newValue: .value(0))
48-
.setterCalled(count: 2)
55+
.setCalled(2)
4956

5057
verify(maplibreMapView)
5158
.maximumPitch(newValue: .value(0))
52-
.setterCalled(count: 1)
59+
.setCalled(1)
5360

5461
verify(maplibreMapView)
5562
.maximumPitch(newValue: .value(60))
56-
.setterCalled(count: 1)
63+
.setCalled(1)
5764

5865
verify(maplibreMapView)
5966
.setZoomLevel(.any, animated: .any)
60-
.called(count: 0)
67+
.called(0)
6168
}
6269

6370
@MainActor func testCenterCameraUpdate() {
6471
let coordinate = CLLocationCoordinate2D(latitude: 12.3, longitude: 23.4)
6572
let newCamera: MapViewCamera = .center(coordinate, zoom: 13)
6673

74+
given(maplibreMapView)
75+
.setCenter(.any,
76+
zoomLevel: .any,
77+
direction: .any,
78+
animated: .any)
79+
.willReturn()
80+
6781
coordinator.updateCamera(mapView: maplibreMapView, camera: newCamera, animated: false)
6882

6983
verify(maplibreMapView)
7084
.userTrackingMode(newValue: .value(.none))
71-
.setterCalled(count: 1)
85+
.setCalled(1)
7286

7387
verify(maplibreMapView)
7488
.setCenter(.value(coordinate),
7589
zoomLevel: .value(13),
7690
direction: .value(0),
7791
animated: .value(false))
78-
.called(count: 1)
92+
.called(1)
7993

8094
// Due to the .frame == .zero workaround, min/max pitch setting is called twice, once to set the
8195
// pitch, and then once to set the actual range.
8296
verify(maplibreMapView)
8397
.minimumPitch(newValue: .value(0))
84-
.setterCalled(count: 2)
98+
.setCalled(2)
8599

86100
verify(maplibreMapView)
87101
.maximumPitch(newValue: .value(0))
88-
.setterCalled(count: 1)
102+
.setCalled(1)
89103

90104
verify(maplibreMapView)
91105
.maximumPitch(newValue: .value(60))
92-
.setterCalled(count: 1)
106+
.setCalled(1)
93107

94108
verify(maplibreMapView)
95109
.setZoomLevel(.any, animated: .any)
96-
.called(count: 0)
110+
.called(0)
97111
}
98112

99113
@MainActor func testUserTrackingCameraUpdate() {
100114
let newCamera: MapViewCamera = .trackUserLocation()
101115

116+
given(maplibreMapView)
117+
.setZoomLevel(.any, animated: .any)
118+
.willReturn()
119+
102120
coordinator.updateCamera(mapView: maplibreMapView, camera: newCamera, animated: false)
103121

104122
verify(maplibreMapView)
105123
.userTrackingMode(newValue: .value(.follow))
106-
.setterCalled(count: 1)
124+
.setCalled(1)
107125

108126
verify(maplibreMapView)
109127
.setCenter(.any,
110128
zoomLevel: .any,
111129
direction: .any,
112130
animated: .any)
113-
.called(count: 0)
131+
.called(0)
114132

115133
// Due to the .frame == .zero workaround, min/max pitch setting is called twice, once to set the
116134
// pitch, and then once to set the actual range.
117135
verify(maplibreMapView)
118136
.minimumPitch(newValue: .value(0))
119-
.setterCalled(count: 2)
137+
.setCalled(2)
120138

121139
verify(maplibreMapView)
122140
.maximumPitch(newValue: .value(0))
123-
.setterCalled(count: 1)
141+
.setCalled(1)
124142

125143
verify(maplibreMapView)
126144
.maximumPitch(newValue: .value(60))
127-
.setterCalled(count: 1)
145+
.setCalled(1)
128146

129147
verify(maplibreMapView)
130148
.setZoomLevel(.value(10), animated: .value(false))
131-
.called(count: 1)
149+
.called(1)
132150
}
133151

134152
@MainActor func testUserTrackingWithCourseCameraUpdate() {
135153
let newCamera: MapViewCamera = .trackUserLocationWithCourse()
136154

155+
given(maplibreMapView)
156+
.setZoomLevel(.any, animated: .any)
157+
.willReturn()
158+
137159
coordinator.updateCamera(mapView: maplibreMapView, camera: newCamera, animated: false)
138160

139161
verify(maplibreMapView)
140162
.userTrackingMode(newValue: .value(.followWithCourse))
141-
.setterCalled(count: 1)
163+
.setCalled(1)
142164

143165
verify(maplibreMapView)
144166
.setCenter(.any,
145167
zoomLevel: .any,
146168
direction: .any,
147169
animated: .any)
148-
.called(count: 0)
170+
.called(0)
149171

150172
// Due to the .frame == .zero workaround, min/max pitch setting is called twice, once to set the
151173
// pitch, and then once to set the actual range.
152174
verify(maplibreMapView)
153175
.minimumPitch(newValue: .value(0))
154-
.setterCalled(count: 2)
176+
.setCalled(2)
155177

156178
verify(maplibreMapView)
157179
.maximumPitch(newValue: .value(0))
158-
.setterCalled(count: 1)
180+
.setCalled(1)
159181

160182
verify(maplibreMapView)
161183
.maximumPitch(newValue: .value(60))
162-
.setterCalled(count: 1)
184+
.setCalled(1)
163185

164186
verify(maplibreMapView)
165187
.setZoomLevel(.value(10), animated: .value(false))
166-
.called(count: 1)
188+
.called(1)
167189
}
168190

169191
@MainActor func testUserTrackingWithHeadingUpdate() {
170192
let newCamera: MapViewCamera = .trackUserLocationWithHeading()
171193

194+
given(maplibreMapView)
195+
.setZoomLevel(.any, animated: .any)
196+
.willReturn()
197+
172198
coordinator.updateCamera(mapView: maplibreMapView, camera: newCamera, animated: false)
173199

174200
verify(maplibreMapView)
175201
.userTrackingMode(newValue: .value(.followWithHeading))
176-
.setterCalled(count: 1)
202+
.setCalled(1)
177203

178204
verify(maplibreMapView)
179205
.setCenter(.any,
180206
zoomLevel: .any,
181207
direction: .any,
182208
animated: .any)
183-
.called(count: 0)
209+
.called(0)
184210

185211
// Due to the .frame == .zero workaround, min/max pitch setting is called twice, once to set the
186212
// pitch, and then once to set the actual range.
187213
verify(maplibreMapView)
188214
.minimumPitch(newValue: .value(0))
189-
.setterCalled(count: 2)
215+
.setCalled(2)
190216

191217
verify(maplibreMapView)
192218
.maximumPitch(newValue: .value(0))
193-
.setterCalled(count: 1)
219+
.setCalled(1)
194220

195221
verify(maplibreMapView)
196222
.maximumPitch(newValue: .value(60))
197-
.setterCalled(count: 1)
223+
.setCalled(1)
198224

199225
verify(maplibreMapView)
200226
.setZoomLevel(.value(10), animated: .value(false))
201-
.called(count: 1)
227+
.called(1)
202228
}
203229

204230
// TODO: Test Rect & Showcase once we build it!

Tests/MapLibreSwiftUITests/Support/XCTestAssertView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import SnapshotTesting
33
import SwiftUI
44
import XCTest
55

6-
// TODO: This is a WIP that needs some additional eyes
76
extension XCTestCase {
87
func assertView(
98
named name: String? = nil,
@@ -18,7 +17,7 @@ extension XCTestCase {
1817
let view = content()
1918
.frame(width: frame.width, height: frame.height)
2019

21-
assertSnapshot(matching: view,
20+
assertSnapshot(of: view,
2221
as: .image(precision: 0.9, perceptualPrecision: 0.95),
2322
named: name,
2423
record: record,

0 commit comments

Comments
 (0)