Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require iOS 10.0 #2206

Merged
merged 14 commits into from
Oct 1, 2019
Merged

Require iOS 10.0 #2206

merged 14 commits into from
Oct 1, 2019

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Aug 7, 2019

This library now requires a minimum deployment target of iOS 10.0 or above. iOS 9.x is no longer supported. This change is forced by mapbox/mapbox-directions-swift#379 and needed for continued feature development, including #2114.

Along the way:

  • User notification and distance formatting functionality was overhauled to take advantage of the iOS 10 SDK.
  • CocoaPods installation test no longer lints MapboxNavigation.podspec on CI.
  • CircleCI runs tests on iOS 13.1.

Details on these changes below.

/cc @mapbox/navigation-ios @mapbox/driver-app

@1ec5 1ec5 added build Issues related to builds and dependency management. backwards incompatible changes that break backwards compatibility of public API labels Aug 7, 2019
@1ec5 1ec5 added this to the v0.38.0 milestone Aug 7, 2019
@1ec5 1ec5 requested review from frederoni and JThramer August 7, 2019 03:32
@1ec5 1ec5 self-assigned this Aug 7, 2019
@1ec5
Copy link
Contributor Author

1ec5 commented Aug 7, 2019

The CocoaPods installation test was failing because of a warning about UILocalNotification being deprecated on iOS 10.0 and above. 09c376abed41744b1ed996ea762c9c4ff47273c6 migrates to the UserNotifications framework, removing a hack we put in for replacing any already present notification.

I also took the opportunity to revamp the notifications. Instead of displaying the plain-text representation of the spoken instruction, which can easily get truncated, the notification now mirrors the turn banner more closely, displaying the primary instruction text, secondary instruction text, and maneuver icon.

notification

xcode: "10.1.0"
iOS: "9.3"
iOS: "10.3.1"
delete_private_deps: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this flag is no longer necessary. We removed private deps because some or one of them didn't support iOS 9. Technically, we can start testing on iOS 10 but we would have to generate snapshot fixtures.

@JThramer
Copy link
Contributor

Could we add a iOS 13.0 CI bot as part of this effort?

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 18, 2019

Spurred in part by the Swift 5 warnings in #2232 (comment), I rewrote DistanceFormatter to inherit from Formatter and wrap MeasurementFormatter instead of inheriting from LengthFormatter. In the process, I removed some cruft stemming from the old vulgar fraction functionality removed in #383. These changes needed to happen in this PR because Measurement and MeasurementFormatter were introduced in iOS 10.

let value = distanceFormatter.measurement(of: distance).value
XCTAssertEqual(distanceFormatter.numberFormatter.string(from: value as NSNumber), quantity)
}
let value = Measurement(distance: distance).localized(into: distanceFormatter.locale).value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

assertDistance(2_500, displayed: "2.5 km", quantity: "2.5")
assertDistance(2_900, displayed: "2.9 km", quantity: "2.9")
assertDistance(2_500, displayed: "2,5 km", quantity: "2,5")
assertDistance(2_900, displayed: "2,9 km", quantity: "2,9")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this indicates a bug in master, just a shortcoming of how the test was previously written. The test previously set the locale of the number formatter above, but the locale would be changed back to nationalizedCurrent within the formatter. Now the locale is set on the distance formatter, which takes care of the measurement formatter’s locale.

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 19, 2019

The Xcode_10.2_iOS_12.2_CP_update bot keeps failing with this compiler error:

   Testing with `xcodebuild`.     /Users/distiller/project/MapboxNavigation/CarPlayManager.swift:554:73: error: incorrect argument label in call (have 'distance:', expected 'from:')

            let estimates = CPTravelEstimates(distanceRemaining: Measurement(distance: route.distance).localized(),
 -> MapboxNavigation (0.37.0)
                                                                            ^~~~~~~~~

The module does have access to the public Measurement(distance:) initializer declared in an extension in MapboxCoreNavigation. However, this bot tests CocoaPods integration by linting the podspec, which I think causes MapboxNavigation to build against the latest release of MapboxCoreNavigation. The latest release of MapboxCoreNavigation doesn’t have Measurement(distance:), so the build fails.

Copy link
Contributor

@JThramer JThramer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking Great. Calling out known issue with brittle cocoa pods update test.

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 26, 2019

I wonder if there’s a way to override the MapboxCoreNavigation commit hash that CocoaPods uses when linting the MapboxNavigation podspec.

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 26, 2019

a6e1a9e modifies the CI configuration to no longer lint MapboxNavigation.podspec. MapboxNavigation fails the linter between releases because it depends on MapboxCoreNavigation. The linter installs the latest release of MapboxCoreNavigation, which potentially has a different set of public symbols than what’s in the current branch. Moreover, at release time, it fails the linter because the new release of MapboxCoreNavigation hasn’t been published yet.

@1ec5 1ec5 added op-ex Refactoring, Tech Debt or any other operational excellence work. CocoaPods topic: localization labels Sep 26, 2019
@1ec5
Copy link
Contributor Author

1ec5 commented Sep 26, 2019

iOS 13 seems to have changed some default behaviors around number formatting. Specifically, rounding 0.5 now seems to follow the even-odd rule rather than rounding away from zero.

Test Case '-[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_GB]' started.
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_GB] : XCTAssertEqual failed: ("3 mi") is not equal to ("4 mi") - Displayed: '3 mi' should be equal to 4 mi
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_GB] : XCTAssertEqual failed: ("Optional("3")") is not equal to ("Optional("4")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_GB] : XCTAssertEqual failed: ("Optional("3 mi")") is not equal to ("Optional("4 mi")") - Displayed: '3 mi' should be equal to 4 mi
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_GB] : XCTAssertNotNil failed - Displayed: '3 mi' should contain 4
Test Case '-[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_GB]' failed (0.030 seconds).

There are also numerous errors related to the Hindi localization switching from Indian numerals to European numerals:

Test Case '-[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN]' started.
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("0 मी॰") is not equal to ("० मी॰") - Displayed: '0 मी॰' should be equal to ० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("0")") is not equal to ("Optional("०")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("0 मी॰")") is not equal to ("Optional("० मी॰")") - Displayed: '0 मी॰' should be equal to ० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '0 मी॰' should contain ०
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("5 मी॰") is not equal to ("५ मी॰") - Displayed: '5 मी॰' should be equal to ५ मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("5")") is not equal to ("Optional("५")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("5 मी॰")") is not equal to ("Optional("५ मी॰")") - Displayed: '5 मी॰' should be equal to ५ मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '5 मी॰' should contain ५
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("10 मी॰") is not equal to ("१० मी॰") - Displayed: '10 मी॰' should be equal to १० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("10")") is not equal to ("Optional("१०")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("10 मी॰")") is not equal to ("Optional("१० मी॰")") - Displayed: '10 मी॰' should be equal to १० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '10 मी॰' should contain १०
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("15 मी॰") is not equal to ("१५ मी॰") - Displayed: '15 मी॰' should be equal to १५ मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("15")") is not equal to ("Optional("१५")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("15 मी॰")") is not equal to ("Optional("१५ मी॰")") - Displayed: '15 मी॰' should be equal to १५ मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '15 मी॰' should contain १५
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("25 मी॰") is not equal to ("२५ मी॰") - Displayed: '25 मी॰' should be equal to २५ मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("25")") is not equal to ("Optional("२५")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("25 मी॰")") is not equal to ("Optional("२५ मी॰")") - Displayed: '25 मी॰' should be equal to २५ मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '25 मी॰' should contain २५
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("100 मी॰") is not equal to ("१��० मी॰") - Displayed: '100 मी॰' should be equal to १०० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("100")") is not equal to ("Optional("१००")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("100 मी॰")") is not equal to ("Optional("१०० मी॰")") - Displayed: '100 मी॰' should be equal to १०० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '100 मी॰' should contain १००
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("250 मी॰") is not equal to ("२५० मी॰") - Displayed: '250 मी॰' should be equal to २५० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("250")") is not equal to ("Optional("२५०")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("250 मी॰")") is not equal to ("Optional("२५० मी॰")") - Displayed: '250 मी॰' should be equal to २५० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '250 मी॰' should contain २५०
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("300 मी॰") is not equal to ("३०० मी॰") - Displayed: '300 मी॰' should be equal to ३०० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("300")") is not equal to ("Optional("३००")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("300 मी॰")") is not equal to ("Optional("३०० मी॰")") - Displayed: '300 मी॰' should be equal to ३०० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '300 मी॰' should contain ३००
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("500 मी॰") is not equal to ("५०० मी॰") - Displayed: '500 मी॰' should be equal to ५०० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("500")") is not equal to ("Optional("५००")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("500 मी॰")") is not equal to ("Optional("५०० मी॰")") - Displayed: '500 मी॰' should be equal to ५०० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '500 मी॰' should contain ५००
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("950 मी॰") is not equal to ("९५० मी॰") - Displayed: '950 मी॰' should be equal to ९५० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("950")") is not equal to ("Optional("९५०")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("950 मी॰")") is not equal to ("Optional("९५० मी॰")") - Displayed: '950 मी॰' should be equal to ९५० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '950 मी॰' should contain ९५०
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("950 मी॰") is not equal to ("९५० मी॰") - Displayed: '950 मी॰' should be equal to ९५० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("950")") is not equal to ("Optional("९५०")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("950 मी॰")") is not equal to ("Optional("९५० मी॰")") - Displayed: '950 मी॰' should be equal to ९५० मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '950 मी॰' should contain ९५०
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("1 कि॰मी॰") is not equal to ("१ कि॰मी॰") - Displayed: '1 कि॰मी॰' should be equal to १ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("1")") is not equal to ("Optional("१")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("1 कि॰मी॰")") is not equal to ("Optional("१ कि॰मी॰")") - Displayed: '1 कि॰मी॰' should be equal to १ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '1 कि॰मी॰' should contain १
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("1 कि॰मी॰") is not equal to ("१ कि॰मी॰") - Displayed: '1 कि॰मी॰' should be equal to १ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("1")") is not equal to ("Optional("१")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("1 कि॰मी॰")") is not equal to ("Optional("१ कि॰मी॰")") - Displayed: '1 कि॰मी॰' should be equal to १ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '1 कि॰मी॰' should contain १
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("2.5 कि॰मी॰") is not equal to ("२.५ कि॰मी॰") - Displayed: '2.5 कि॰मी॰' should be equal to २.५ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("2.5")") is not equal to ("Optional("२.५")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("2.5 कि॰मी॰")") is not equal to ("Optional("२.५ कि॰मी॰")") - Displayed: '2.5 कि॰मी॰' should be equal to २.५ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '2.5 कि॰मी॰' should contain २.५
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("2.9 कि॰मी॰") is not equal to ("२.९ कि॰मी॰") - Displayed: '2.9 कि॰मी॰' should be equal to २.९ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("2.9")") is not equal to ("Optional("२.९")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("2.9 कि॰मी॰")") is not equal to ("Optional("२.९ कि॰मी॰")") - Displayed: '2.9 कि॰मी॰' should be equal to २.९ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '2.9 कि॰मी॰' should contain २.९
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("3 कि॰मी॰") is not equal to ("३ कि॰मी॰") - Displayed: '3 कि॰मी॰' should be equal to ३ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("3")") is not equal to ("Optional("३")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("3 कि॰मी॰")") is not equal to ("Optional("३ कि॰मी॰")") - Displayed: '3 कि॰मी॰' should be equal to ३ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '3 कि॰मी॰' should contain ३
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("4 कि॰मी॰") is not equal to ("४ कि॰मी॰") - Displayed: '4 कि॰मी॰' should be equal to ४ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("4")") is not equal to ("Optional("४")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("4 कि॰मी॰")") is not equal to ("Optional("४ कि॰मी॰")") - Displayed: '4 कि॰मी॰' should be equal to ४ कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '4 कि॰मी॰' should contain ४
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:20: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("3,84,400 कि॰मी॰") is not equal to ("३,८४,४०० कि॰मी॰") - Displayed: '3,84,400 कि॰मी॰' should be equal to ३,८४,४०० कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:23: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("3,84,400")") is not equal to ("Optional("३,८४,४००")")
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:26: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertEqual failed: ("Optional("3,84,400 कि॰मी॰")") is not equal to ("Optional("३,८४,४०० कि॰मी॰")") - Displayed: '3,84,400 कि॰मी॰' should be equal to ३,८४,४०० कि॰मी॰
/Users/distiller/project/MapboxCoreNavigationTests/DistanceFormatterTests.swift:32: error: -[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN] : XCTAssertNotNil failed - Displayed: '3,84,400 कि॰मी॰' should contain ३,८४,४००
Test Case '-[MapboxCoreNavigationTests.DistanceFormatterTests testDistanceFormatters_hi_IN]' failed (1.568 seconds).

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 27, 2019

iOS 13 seems to have changed some default behaviors around number formatting. Specifically, rounding 0.5 now seems to follow the even-odd rule rather than rounding away from zero.

Actually, the selected threshold for this test is one that has a roundingIncrement of 0 (which is effectively a no-op) and a maximumFractionDigits of 0. On iOS 13, Measurement<UnitLength>(value: 3.5, unit: .miles).converted(to: .meters).converted(to: .miles).value is 3.4999999999999996, whereas on iOS 12 the same value round-trips as 3.5. Threshold.measurement(of:) is given this value to round to the ones place.

The difference between iOS 12 and iOS 13 appears to be caused by a different conversion factor between meters and miles: 1609.34 meters per mile on iOS 12 versus 1609.344 on iOS 13.

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 27, 2019

There are also numerous errors related to the Hindi localization switching from Indian numerals to European numerals:

In iOS 13, the Hindi localization defaults to Latin-script numbers but offers an option to switch back to Devanagari-script numerals:

numbers

The BCP 47 code for Hindi with Devanagari numbers would be hi-u-nu-deva, but Locale truncates the identifier to hi-u-nu, resulting in a malformed locale and subsequent crash. The only way to specify Devanagari numbers is via the contorted identifier hi-Deva-IN-u-nu-deva, which Locale misinterprets as hi-IN-u-nu-Deva, which serendipitously becomes hi-u-nu-deva for CLDR.

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 27, 2019

Still need to regenerate snapshot test fixtures. Also, this simulation test is failing:

Test Case '-[MapboxNavigationTests.CarPlayManagerSpec Starting_a_trip__When_configured_to_simulate__starts_navigation_with_a_navigation_service_with_simulation_enabled]' started.
2019-09-26 22:48:24.253257-0700 Example[4310:17202] Warning: Attempt to present <MBCarPlayNavigationViewController: 0x7fc2d2ec2400> on <MBCarPlayMapViewController: 0x7fc2d2f68760> whose view is not in the window hierarchy!
/Users/distiller/project/MapboxNavigationTests/CarPlayManagerTests.swift:394: error: -[MapboxNavigationTests.CarPlayManagerSpec Starting_a_trip__When_configured_to_simulate__starts_navigation_with_a_navigation_service_with_simulation_enabled] : expected to equal <5>, got <1>

Test Case '-[MapboxNavigationTests.CarPlayManagerSpec Starting_a_trip__When_configured_to_simulate__starts_navigation_with_a_navigation_service_with_simulation_enabled]' failed (0.165 seconds).

MapboxNavigationService.simulatedLocationSource is nil at the time that the simulationSpeedMultiplier gets set, so the multiplier gets dropped on the floor.

The minimum deployment target is now iOS 10.0. Updated the CircleCI configuration to test on iOS 10.3.1 instead of 9.3.
Lock screen notifications are presented more reliably and more closely resemble instruction banners. Factored out a method that produces a UIImage representing a visual instruction’s maneuver.
Removed iOS 10 availability guards. Replaced LengthFormatter.Unit usage with Measurement. For now, a MeasurementFormatter is embedded inside DistanceFormatter.
DistanceFormatter no longer inherits from LengthFormatter. The quantity attribute now reflects any rounding that took place in the attributed string. Added strongly typed attributed string formatting methods. Extended Measurement with an initializer from CLLocationDistance and method for localizing to a locale-appropriate unit.
MapboxNavigation fails the linter between releases because it depends on MapboxCoreNavigation. The linter installs the latest release of MapboxCoreNavigation, which potentially has a different set of public symbols than what’s in the current branch. Moreover, at release time, it fails the linter because the new release of MapboxCoreNavigation hasn’t been published yet.
Different versions of iOS have different meter-mile conversion factors, so encapsulate conversions in Measurement.
iOS 13 uses a meter-mile conversion factor that happens to expose a floating-point precision error when the input value is halfway between two integers. This change applies a small rounding increment to avoid the imprecision.
The CPWindow doesn’t end up in the view hierarchy by itself on iOS 13, so the navigation service doesn’t start. This test is mainly about simulation mode, not about whether the navigation service starts automatically, so just start it automatically as if the view had loaded.
@1ec5
Copy link
Contributor Author

1ec5 commented Oct 1, 2019

MapboxNavigationService.simulatedLocationSource is nil at the time that the simulationSpeedMultiplier gets set, so the multiplier gets dropped on the floor.

The simulated location source is populated when the navigation service begins, so the test failure indicates that the navigation service never began. CarPlayNavigationViewController.viewDidLoad() is normally responsible for starting the navigation service. However, iOS 13 doesn’t make the CPWindow key and visible automatically. 65c9663 manually kicks off the navigation service to avoid relying on window state, which isn’t especially relevant to this particular test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards incompatible changes that break backwards compatibility of public API build Issues related to builds and dependency management. op-ex Refactoring, Tech Debt or any other operational excellence work. topic: localization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants