Skip to content

Commit

Permalink
Merge pull request #132 from tumblr/declan/ICORE-4872-update-snapshot…
Browse files Browse the repository at this point in the history
…-library

Update FBSnapshot Library
  • Loading branch information
Deco354 authored Apr 22, 2022
2 parents ee0d7d3 + 8b7fd9e commit d0032ed
Show file tree
Hide file tree
Showing 40 changed files with 95 additions and 75 deletions.
25 changes: 22 additions & 3 deletions KanvasExample/KanvasExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
0EDE7A3B216425BD009DB00F /* ExtendedStackViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE7A3A216425BD009DB00F /* ExtendedStackViewTests.swift */; };
0EDE7A3D216425C5009DB00F /* ExtendedButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE7A3C216425C5009DB00F /* ExtendedButtonTests.swift */; };
1F11FE1FF570F16AE42DE1EB /* libPods-KanvasExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4E3D4DAD54900431C164FE1 /* libPods-KanvasExampleTests.a */; };
5E1399DE40FDDBD3F12B4468 /* Pods_KanvasExampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FBD328E5F4D4ECEBA5561F5 /* Pods_KanvasExampleTests.framework */; };
650648012478291B0052C175 /* SpeedControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650648002478291B0052C175 /* SpeedControllerTests.swift */; };
65064803247829270052C175 /* SpeedViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65064802247829270052C175 /* SpeedViewTests.swift */; };
650A833F24646A350071BF9D /* GifMakerControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650A833E24646A350071BF9D /* GifMakerControllerTests.swift */; };
Expand Down Expand Up @@ -246,6 +247,7 @@
0EDE7A3A216425BD009DB00F /* ExtendedStackViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtendedStackViewTests.swift; sourceTree = "<group>"; };
0EDE7A3C216425C5009DB00F /* ExtendedButtonTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtendedButtonTests.swift; sourceTree = "<group>"; };
2E2C11793C82F53D672DCC9A /* Pods-KanvasExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KanvasExample.release.xcconfig"; path = "Target Support Files/Pods-KanvasExample/Pods-KanvasExample.release.xcconfig"; sourceTree = "<group>"; };
2FBD328E5F4D4ECEBA5561F5 /* Pods_KanvasExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KanvasExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
528EA69F8E77F28A567AEDBC /* Pods-KanvasExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KanvasExample.debug.xcconfig"; path = "Target Support Files/Pods-KanvasExample/Pods-KanvasExample.debug.xcconfig"; sourceTree = "<group>"; };
650648002478291B0052C175 /* SpeedControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeedControllerTests.swift; sourceTree = "<group>"; };
65064802247829270052C175 /* SpeedViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeedViewTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -424,7 +426,6 @@
BFA7DAA724E3BA8000F357B6 /* LivePhotoLoaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LivePhotoLoaderTests.swift; sourceTree = "<group>"; };
BFA7DAA924E3BACE00F357B6 /* MediaPickerThumbnailFetcherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaPickerThumbnailFetcherTests.swift; sourceTree = "<group>"; };
BFA7DAAB24E42A9000F357B6 /* KanvasMediaPickerViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KanvasMediaPickerViewControllerTests.swift; sourceTree = "<group>"; };
E4E3D4DAD54900431C164FE1 /* libPods-KanvasExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KanvasExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F551187F25DDC96700DEBF7E /* MultiEditorControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultiEditorControllerTests.swift; sourceTree = "<group>"; };
F58D37B925117A88007CDF82 /* en.lproj */ = {isa = PBXFileReference; lastKnownFileType = folder; path = en.lproj; sourceTree = "<group>"; };
F597B4E024B3E57300843540 /* UIColor+Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Colors.swift"; sourceTree = "<group>"; };
Expand All @@ -449,7 +450,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1F11FE1FF570F16AE42DE1EB /* libPods-KanvasExampleTests.a in Frameworks */,
5E1399DE40FDDBD3F12B4468 /* Pods_KanvasExampleTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -493,7 +494,7 @@
isa = PBXGroup;
children = (
973CC439A84BFDE7FC10BAC1 /* libPods-KanvasExample.a */,
E4E3D4DAD54900431C164FE1 /* libPods-KanvasExampleTests.a */,
2FBD328E5F4D4ECEBA5561F5 /* Pods_KanvasExampleTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -1147,6 +1148,7 @@
AB7F29582121F0ED00B8D599 /* Sources */,
AB7F29592121F0ED00B8D599 /* Frameworks */,
AB7F295A2121F0ED00B8D599 /* Resources */,
DE95F59B62017B241AAF5CD5 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -1286,6 +1288,23 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
DE95F59B62017B241AAF5CD5 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-KanvasExampleTests/Pods-KanvasExampleTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-KanvasExampleTests/Pods-KanvasExampleTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-KanvasExampleTests/Pods-KanvasExampleTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
24 changes: 12 additions & 12 deletions KanvasExample/KanvasExampleTests/Camera/CameraControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
func testSetUpWithAllOptionsAndModesShouldStartWithFlashOffAndStopMotionMode() {
let delegate = newDelegateStub()
let controller = newController(delegate: delegate)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testSetupWithStopMotionDisabled() {
Expand All @@ -72,7 +72,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
settings.features.ghostFrame = false
settings.features.cameraFilters = true
let controller = newController(delegate: delegate, settings: settings)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testSetUpWithGifDefaultModeShouldStartWithGifMode() {
Expand All @@ -82,7 +82,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
settings.features.ghostFrame = true
settings.features.cameraFilters = true
let controller = newController(delegate: delegate, settings: settings)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testSetUpWithFlashOn() {
Expand All @@ -92,7 +92,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
settings.features.ghostFrame = true
settings.features.cameraFilters = true
let controller = newController(delegate: delegate, settings: settings)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testSetUpWithImagePreviewOn() {
Expand All @@ -102,7 +102,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
settings.features.ghostFrame = true
settings.features.cameraFilters = true
let controller = newController(delegate: delegate, settings: settings)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testImagePreviewButtonShouldHideOnPhotoMode() {
Expand All @@ -111,7 +111,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
UIView.setAnimationsEnabled(false)
controller.didOpenMode(.photo, andClosed: .none)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testImagePreviewButtonShouldHideOnStopMotionMode() {
Expand All @@ -120,7 +120,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
UIView.setAnimationsEnabled(false)
controller.didOpenMode(.stopMotion, andClosed: .none)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testImagePreviewButtonShouldHideOnGifMode() {
Expand All @@ -129,7 +129,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
UIView.setAnimationsEnabled(false)
controller.didOpenMode(.loop, andClosed: .none)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

// Can't test `exportStopMotionPhotoAsVideo` because it can't export in tests
Expand All @@ -147,7 +147,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
controller.didOpenMode(.stopMotion, andClosed: .none)
controller.didTapForMode(.stopMotion)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testStartLongPressShouldHideUIButFilterSelectorAndShutterButton() {
Expand All @@ -168,7 +168,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
controller.didStartPressingForMode(.stopMotion)
controller.didEndPressingForMode(.stopMotion)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

func testTapAndLongPressShouldAddTwoClipsAndShowNextButton() {
Expand All @@ -180,7 +180,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
controller.didStartPressingForMode(.stopMotion)
controller.didEndPressingForMode(.stopMotion)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

// MARK: - CameraViewDelegate
Expand Down Expand Up @@ -293,7 +293,7 @@ final class CameraControllerTests: FBSnapshotTestCase {
controller.didTapVisibilityButton(visible: true)
controller.didTapVisibilityButton(visible: false)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}

// Can't test `dismissButtonPressed` because it requires presenting and dismissing preview controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,31 +133,31 @@ final class CameraPermissionsViewTests: FBSnapshotTestCase {
func testViewWithNoAccess() {
let view = CameraPermissionsView(showMediaPicker: true, frame: CGRect(x: 0, y: 0, width: 375, height: 667))
view.layoutIfNeeded()
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func testViewWithCameraAccess() {
let view = CameraPermissionsView(showMediaPicker: true, frame: CGRect(x: 0, y: 0, width: 375, height: 667))
view.updateCameraAccess(hasAccess: true)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func testViewWithMicrophoneAccess() {
let view = CameraPermissionsView(showMediaPicker: true, frame: CGRect(x: 0, y: 0, width: 375, height: 667))
view.updateMicrophoneAccess(hasAccess: true)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func testViewWithCameraAndMicrophoneAccess() {
let view = CameraPermissionsView(showMediaPicker: true, frame: CGRect(x: 0, y: 0, width: 375, height: 667))
view.updateCameraAccess(hasAccess: true)
view.updateMicrophoneAccess(hasAccess: true)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func testViewWithoutMediaPickerButton() {
let view = CameraPermissionsView(showMediaPicker: false, frame: CGRect(x: 0, y: 0, width: 375, height: 667))
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ final class CameraFilterCollectionCellTests: FBSnapshotTestCase {
let cell = newCell()
let filterItem = FilterItem(type: .lightLeaks)
cell.bindTo(filterItem)
FBSnapshotVerifyView(cell, tolerance: 0.05)
FBSnapshotVerifyView(cell, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ final class CameraFilterCollectionControllerTests: FBSnapshotTestCase {
UIView.setAnimationsEnabled(false)
controller.showView(true)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class CameraFilterCollectionViewTests: FBSnapshotTestCase, UICollectionVie
view.collectionView.delegate = self
view.collectionView.dataSource = self
view.collectionView.reloadData()
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ final class FilterSettingsControllerTests: FBSnapshotTestCase {
UIView.setAnimationsEnabled(false)
controller.didTapVisibilityButton()
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class KanvasFontsTests: FBSnapshotTestCase {
let label = newLabelView()
let drawer = KanvasFonts.Drawer(textSelectedFont: .guavaMedium(), textUnselectedFont: .guavaMedium())
label.font = drawer.textSelectedFont
FBSnapshotVerifyView(label, tolerance: 0.05)
FBSnapshotVerifyView(label, overallTolerance: 0.05)
}

func testPermissionsFont() {
let label = newLabelView()
let permissions = KanvasFonts.CameraPermissions(titleFont: .guavaMedium(), descriptionFont: .guavaMedium(), buttonFont: .guavaMedium())
label.font = permissions.titleFont
FBSnapshotVerifyView(label, tolerance: 0.05)
FBSnapshotVerifyView(label, overallTolerance: 0.05)
}

func testPadding() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ final class DrawingControllerTests: FBSnapshotTestCase {
controller.showView(true)
controller.showConfirmButton(true)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ final class StrokeSelectorControllerTests: FBSnapshotTestCase {

func testSelectorControllerView() {
let controller = newViewController()
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ final class StrokeSelectorViewTests: FBSnapshotTestCase {

func testViewSetup() {
let view = newView()
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ final class EditorFilterCollectionCellTests: FBSnapshotTestCase {
let cell = newCell()
let filterItem = FilterItem(type: .lightLeaks)
cell.bindTo(filterItem)
FBSnapshotVerifyView(cell, tolerance: 0.05)
FBSnapshotVerifyView(cell, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class EditorFilterCollectionViewTests: FBSnapshotTestCase, UICollectionVie
view.collectionView.delegate = self
view.collectionView.dataSource = self
view.collectionView.reloadData()
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ final class GifMakerControllerTests: FBSnapshotTestCase {
controller.showView(true)
controller.showConfirmButton(true)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ final class GifMakerViewTests: FBSnapshotTestCase {
func testViewSetup() {
let view = newView()
view.showConfirmButton(true)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func testRevertButton() {
let view = newView()
view.toggleRevertButton(true)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ final class DiscreteSliderCollectionCellTests: FBSnapshotTestCase {
cell.bindTo(0)
cell.setStyle(isCenter: true, isFirst: false, isLast: false)
cell.setProgress(leftLineActive: false, rightLineActive: false)
FBSnapshotVerifyView(cell, tolerance: 0.05)
FBSnapshotVerifyView(cell, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ final class DiscreteSliderTests: FBSnapshotTestCase {

func testSliderView() {
let slider = newSlider()
FBSnapshotVerifyView(slider.view, tolerance: 0.05)
FBSnapshotVerifyView(slider.view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ final class DiscreteSliderViewTests: FBSnapshotTestCase {
let view = newView()
view.cellWidth = view.bounds.width / 5
view.setSelector(at: 0)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func testViewSetupWithIndex() {
let view = newView()
view.cellWidth = view.bounds.width / 5
view.setSelector(at: 2)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}

func testViewSetupAtLastPosition() {
let view = newView()
view.cellWidth = view.bounds.width / 5
view.setSelector(at: 4)
FBSnapshotVerifyView(view, tolerance: 0.05)
FBSnapshotVerifyView(view, overallTolerance: 0.05)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ final class SpeedControllerTests: FBSnapshotTestCase {
UIView.setAnimationsEnabled(false)
controller.showView(true)
UIView.setAnimationsEnabled(true)
FBSnapshotVerifyView(controller.view, tolerance: 0.05)
FBSnapshotVerifyView(controller.view, overallTolerance: 0.05)
}
}
Loading

0 comments on commit d0032ed

Please sign in to comment.