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

[Guidance Cards][Part 2]Defer to UIAppearance proxy for color/font literals #2402

Merged
merged 7 commits into from
Aug 4, 2020

Conversation

nishant-karajgikar
Copy link
Contributor

@nishant-karajgikar nishant-karajgikar commented Jun 15, 2020

Builds on #2401

This PR changes the UI logic in the InstructionCardContainerView and InstructionCardView to defer to the color/font literals supplied by the UIAppearance proxy.

@1ec5 1ec5 added this to the v1.0.0 milestone Jul 2, 2020
@avi-c avi-c force-pushed the nishantk/styleGuidanceCardsPt2 branch from 3ec472b to d77cc66 Compare July 30, 2020 22:52
@avi-c avi-c force-pushed the nishantk/styleGuidanceCards branch from c47b8e8 to d0536ea Compare August 3, 2020 18:52
}

fileprivate func preparePrimaryLabel(_ style: InstructionsCardStyle) {
primaryLabel.normalFont = style.primaryLabelNormalFont
Copy link
Contributor

Choose a reason for hiding this comment

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

@avi-c, is there still a need to customize the font used in the instruction card’s labels?

Copy link
Contributor

@avi-c avi-c Aug 4, 2020

Choose a reason for hiding this comment

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

Yes, it should still be supported if we want this to be truly flexible and this does work using DayStyle UIAppearance mechanism.

@1ec5 1ec5 added the op-ex Refactoring, Tech Debt or any other operational excellence work. label Aug 3, 2020
@1ec5
Copy link
Contributor

1ec5 commented Aug 3, 2020

Some of the guidance card snapshot tests are failing. It might just be that the test fixtures need to be updated:

Test Case '-[MapboxNavigationTests.GuidanceCardsSnapshotTests testLanesManeuver]' started.
2020-08-03 20:35:47.494339+0000 Example[84993:147072] Task <3B98A0C3-990E-4CB4-83CE-CC40BAD1AC05>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://s3.amazonaws.com/mapbox/shields/v3/i-25@3x.png, NSErrorFailingURLKey=https://s3.amazonaws.com/mapbox/shields/v3/i-25@3x.png, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <3B98A0C3-990E-4CB4-83CE-CC40BAD1AC05>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3B98A0C3-990E-4CB4-83CE-CC40BAD1AC05>.<1>, NSLocalizedDescription=cancelled} [-999]
2020-08-03 20:35:47.634902+0000 Example[84993:146893] If you have Kaleidoscope installed you can run this command to see an image diff:
ksdiff "/Users/distiller/project/MapboxNavigationTests/FailureDiffs/MapboxNavigationTests.GuidanceCardsSnapshotTests/reference_testLanesManeuver_iPhone6Plus_Portrait_iOS_12.2@3x.png" "/Users/distiller/project/MapboxNavigationTests/FailureDiffs/MapboxNavigationTests.GuidanceCardsSnapshotTests/failed_testLanesManeuver_iPhone6Plus_Portrait_iOS_12.2@3x.png"
/Users/distiller/project/MapboxNavigationTests/GuidanceCardsSnapshotTests.swift:63: error: -[MapboxNavigationTests.GuidanceCardsSnapshotTests testLanesManeuver] : failed - Snapshot comparison failed: Optional(Error Domain=FBSnapshotTestControllerErrorDomain Code=4 "Images different" UserInfo={NSLocalizedFailureReason=image pixels differed by more than 0.00% from the reference image, FBDiffedImageKey=<UIImage: 0x6000024773a0>, {414, 736}, FBReferenceImageKey=<UIImage: 0x60000247b170>, {414, 736}, FBCapturedImageKey=<UIImage: 0x600002477020>, {414, 736}, NSLocalizedDescription=Images different})
Test Case '-[MapboxNavigationTests.GuidanceCardsSnapshotTests testLanesManeuver]' failed (0.487 seconds).
Test Case '-[MapboxNavigationTests.GuidanceCardsSnapshotTests testRegularManeuver]' started.
2020-08-03 20:35:48.052319+0000 Example[84993:146893] If you have Kaleidoscope installed you can run this command to see an image diff:
ksdiff "/Users/distiller/project/MapboxNavigationTests/FailureDiffs/MapboxNavigationTests.GuidanceCardsSnapshotTests/reference_testRegularManeuver_iPhone6Plus_Portrait_iOS_12.2@3x.png" "/Users/distiller/project/MapboxNavigationTests/FailureDiffs/MapboxNavigationTests.GuidanceCardsSnapshotTests/failed_testRegularManeuver_iPhone6Plus_Portrait_iOS_12.2@3x.png"
/Users/distiller/project/MapboxNavigationTests/GuidanceCardsSnapshotTests.swift:40: error: -[MapboxNavigationTests.GuidanceCardsSnapshotTests testRegularManeuver] : failed - Snapshot comparison failed: Optional(Error Domain=FBSnapshotTestControllerErrorDomain Code=4 "Images different" UserInfo={NSLocalizedFailureReason=image pixels differed by more than 0.00% from the reference image, FBDiffedImageKey=<UIImage: 0x600002470d90>, {414, 736}, FBReferenceImageKey=<UIImage: 0x600002466140>, {414, 736}, FBCapturedImageKey=<UIImage: 0x60000247b020>, {414, 736}, NSLocalizedDescription=Images different})
Test Case '-[MapboxNavigationTests.GuidanceCardsSnapshotTests testRegularManeuver]' failed (0.416 seconds).
Test Case '-[MapboxNavigationTests.GuidanceCardsSnapshotTests testTertiaryManeuver]' started.
2020-08-03 20:35:48.470854+0000 Example[84993:146893] If you have Kaleidoscope installed you can run this command to see an image diff:
ksdiff "/Users/distiller/project/MapboxNavigationTests/FailureDiffs/MapboxNavigationTests.GuidanceCardsSnapshotTests/reference_testTertiaryManeuver_iPhone6Plus_Portrait_iOS_12.2@3x.png" "/Users/distiller/project/MapboxNavigationTests/FailureDiffs/MapboxNavigationTests.GuidanceCardsSnapshotTests/failed_testTertiaryManeuver_iPhone6Plus_Portrait_iOS_12.2@3x.png"
/Users/distiller/project/MapboxNavigationTests/GuidanceCardsSnapshotTests.swift:87: error: -[MapboxNavigationTests.GuidanceCardsSnapshotTests testTertiaryManeuver] : failed - Snapshot comparison failed: Optional(Error Domain=FBSnapshotTestControllerErrorDomain Code=4 "Images different" UserInfo={NSLocalizedFailureReason=image pixels differed by more than 0.00% from the reference image, FBDiffedImageKey=<UIImage: 0x60000247ff00>, {414, 736}, FBReferenceImageKey=<UIImage: 0x6000024778e0>, {414, 736}, FBCapturedImageKey=<UIImage: 0x600002465a40>, {414, 736}, NSLocalizedDescription=Images different})
Test Case '-[MapboxNavigationTests.GuidanceCardsSnapshotTests testTertiaryManeuver]' failed (0.418 seconds).

@avi-c
Copy link
Contributor

avi-c commented Aug 4, 2020

The test failures are definitely the test fixtures. The colors that were selected as defaults by @nishant-karajgikar are not the same as what was used previously. If we wish to fix these tests now then we could regenerate new fixtures. Alternatively we could adjust the default colors chosen in DayStyle.swift so that they match what was used in the past. @1ec5 - Any preference? However if we go the route of making new fixtures then I'll need help since I'm not sure how to regenerate the test fixtures myself.

avi-c and others added 5 commits August 4, 2020 12:49
@avi-c avi-c merged commit 5281311 into nishantk/styleGuidanceCards Aug 4, 2020
@avi-c avi-c deleted the nishantk/styleGuidanceCardsPt2 branch August 4, 2020 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
op-ex Refactoring, Tech Debt or any other operational excellence work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants