Skip to content

Commit

Permalink
Fixed the possible situation when the upcoming route leg is rendered …
Browse files Browse the repository at this point in the history
…above the active route leg (#4589)
  • Loading branch information
kried authored Feb 16, 2024
1 parent 33275ec commit fb0a314
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* Added PrivacyInfo.xcprivacy support. ([#4573](https://github.com/mapbox/mapbox-navigation-ios/pull/4573))
* Removed `NavigationEventsManager.init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:mobileEventsManager:)` in favor of `NavigationEventsManager.init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:)`. ([#4572](https://github.com/mapbox/mapbox-navigation-ios/pull/4572))
* Fixed a rare issue that could lead to memory corruption under specific conditions. This was resolved by replacing the internal image downloader with brand new actor-based implementation. ([#4588](https://github.com/mapbox/mapbox-navigation-ios/pull/4588))
* Fixed the possible situation when the upcoming route leg is rendered above the active route leg. ([#4588](https://github.com/mapbox/mapbox-navigation-ios/pull/4588))

## v2.17.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ extension NavigationMapView {
return self.congestionColor(for: nil, isMain: isMain)
}
}
return self.routeCasingColor

return .clear
}
})

Expand Down
21 changes: 21 additions & 0 deletions Tests/MapboxNavigationTests/NavigationMapViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,27 @@ class NavigationMapViewTests: TestCase {
XCTAssertEqual(routeLineGradient[0.0], navigationMapView.trafficLowColor)
}

func testGenerateRouteLineGradientWithMultilegRoute() {
let coordinates: [CLLocationCoordinate2D] = [
CLLocationCoordinate2D(latitude: 37.798, longitude: -122.398),
CLLocationCoordinate2D(latitude: 37.795, longitude: -122.398),
CLLocationCoordinate2D(latitude: 37.795, longitude: -122.395),
]
let congestionSegment: CongestionSegment = (coordinates, CongestionLevel.low)
var feature = Feature(geometry: .lineString(LineString(congestionSegment.0)))
feature.properties = [
CongestionAttribute: .string(String(describing: congestionSegment.1)),
CurrentLegAttribute: false
]
let congestionFeatures = [feature]

let routeLineGradient = navigationMapView.routeLineCongestionGradient(congestionFeatures: congestionFeatures,
isMain: true,
isSoft: false)
XCTAssertEqual(routeLineGradient.count, 1)
XCTAssertEqual(routeLineGradient[0.0], .clear)
}

func testGenerateRouteLineRestrictedGradient() {
let coordinates: [CLLocationCoordinate2D] = [
CLLocationCoordinate2D(latitude: 1, longitude: 0),
Expand Down

0 comments on commit fb0a314

Please sign in to comment.