Skip to content

Commit 22150a3

Browse files
authored
Merge pull request #183 from cashapp/krueger/inverted-colors-identifier
Include the identifier in the call to FBSnapshotVerifyView for SnapshotVerifyWithInvertedColors
2 parents c6b18fb + 4ffd48f commit 22150a3

11 files changed

+21
-1
lines changed

Example/AccessibilitySnapshot/InvertColorsViewController.swift

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ final class InvertColorsViewController: AccessibilityViewController {
3333
view = View()
3434
}
3535

36+
override func viewDidLoad() {
37+
super.viewDidLoad()
38+
39+
// This additional call to updateStatusLabel() is needed because
40+
// of a view life cycle issue with the snapshot test framework
41+
updateStatusLabel()
42+
}
43+
3644
override func viewWillAppear(_ animated: Bool) {
3745
super.viewWillAppear(animated)
3846

Example/SnapshotTests/InvertColorsTests.swift

+12
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ final class InvertColorsTests: SnapshotTestCase {
2525
let viewController = InvertColorsViewController()
2626
viewController.view.frame = UIScreen.main.bounds
2727

28+
FBSnapshotVerifyView(viewController.view, identifier: "disabled")
29+
2830
SnapshotVerifyWithInvertedColors(viewController.view)
31+
32+
// Run the plain snapshot a second time to ensure that the view was restored to its original state.
33+
FBSnapshotVerifyView(viewController.view, identifier: "disabled")
34+
}
35+
36+
func testInvertColorsWithIdentifier() {
37+
let viewController = InvertColorsViewController()
38+
viewController.view.frame = UIScreen.main.bounds
39+
40+
SnapshotVerifyWithInvertedColors(viewController.view, identifier: "someIdentifier")
2941
}
3042

3143
}
Loading
Loading

Sources/AccessibilitySnapshot/iOSSnapshotTestCase/Swift/FBSnapshotTestCase+Accessibility.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ extension FBSnapshotTestCase {
137137
}
138138

139139
let imageView = UIImageView(image: image)
140-
FBSnapshotVerifyView(imageView, suffixes: suffixes, file: file, line: line)
140+
FBSnapshotVerifyView(imageView, identifier: identifier, suffixes: suffixes, file: file, line: line)
141141

142142
statusUtility.unmockStatuses()
143143
postNotification()

0 commit comments

Comments
 (0)