Skip to content

Commit

Permalink
Fix tests, update to use the iPhone 12 simulator. (#290)
Browse files Browse the repository at this point in the history
* Fix tests, update to use the iOS 12 simulator.

* Add a tolerance for tests

* Fix last test

* Fix latest test

* Fix operator spacing
  • Loading branch information
AvdLee authored Jan 21, 2021
1 parent e67ddd1 commit 575f006
Show file tree
Hide file tree
Showing 33 changed files with 33 additions and 35 deletions.
20 changes: 11 additions & 9 deletions WeScan.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1230;
ORGANIZATIONNAME = WeTransfer;
TargetAttributes = {
A1D4BCB6202C4F3800FCDDEC = {
Expand Down Expand Up @@ -1051,6 +1051,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -1076,7 +1077,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.2;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1111,6 +1112,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -1130,7 +1132,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.2;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -1147,7 +1149,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = WeScanSampleProject/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.WeTransfer.WeScanSampleProject;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1166,7 +1168,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = WeScanSampleProject/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.WeTransfer.WeScanSampleProject;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1180,7 +1182,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
Expand All @@ -1190,7 +1192,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = WeScan/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WeTransfer.WeScan;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand All @@ -1209,7 +1211,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
Expand All @@ -1219,7 +1221,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = WeScan/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WeTransfer.WeScan;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down
28 changes: 12 additions & 16 deletions WeScan.xcodeproj/xcshareddata/xcschemes/WeScan.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,8 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A1D4BCEC202C4F4100FCDDEC"
BuildableName = "WeScan.framework"
BlueprintName = "WeScan"
ReferencedContainer = "container:WeScan.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -40,17 +49,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A1D4BCEC202C4F4100FCDDEC"
BuildableName = "WeScan.framework"
BlueprintName = "WeScan"
ReferencedContainer = "container:WeScan.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand Down Expand Up @@ -83,8 +81,6 @@
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion WeScanTests/CIRectangleDetectorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class CIRectangleDetectorTests: FBSnapshotTestCase {
quadView.backgroundColor = UIColor.red
resultView.addSubview(quadView)

FBSnapshotVerifyView(resultView)
FBSnapshotVerifyView(resultView, perPixelTolerance: 6 / 256)
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ...fs/WeScanTests.UIImageTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ...s/WeScanTests.UIImageTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...Images_64/WeScanTests.UIImageTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...nceImages_64/WeScanTests.UIImageTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...nceImages_64/WeScanTests.UIImageTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ceImages_64/WeScanTests.UIImageTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...renceImages_64/WeScanTests.UIImageTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ....VisionRectangleDetectorTests/[email protected]
Binary file added ...angleDetectorTests/[email protected]
12 changes: 6 additions & 6 deletions WeScanTests/UIImageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class UIImageTests: FBSnapshotTestCase {
let view = UIImageView(image: orientatedImage.applyingPortraitOrientation())
view.sizeToFit()

FBSnapshotVerifyView(view)
FBSnapshotVerifyView(view, perPixelTolerance: 6 / 256)
}

func testRotateDownFacingImageCorrectly() {
Expand All @@ -35,7 +35,7 @@ final class UIImageTests: FBSnapshotTestCase {
let view = UIImageView(image: orientatedImage.applyingPortraitOrientation())
view.sizeToFit()

FBSnapshotVerifyView(view)
FBSnapshotVerifyView(view, perPixelTolerance: 6 / 256)
}

func testRotateLeftFacingImageCorrectly() {
Expand All @@ -45,7 +45,7 @@ final class UIImageTests: FBSnapshotTestCase {
let view = UIImageView(image: orientatedImage.applyingPortraitOrientation())
view.sizeToFit()

FBSnapshotVerifyView(view)
FBSnapshotVerifyView(view, perPixelTolerance: 6 / 256)
}

func testRotateRightFacingImageCorrectly() {
Expand All @@ -55,7 +55,7 @@ final class UIImageTests: FBSnapshotTestCase {
let view = UIImageView(image: orientatedImage.applyingPortraitOrientation())
view.sizeToFit()

FBSnapshotVerifyView(view)
FBSnapshotVerifyView(view, perPixelTolerance: 6 / 256)
}

func testRotateDefaultFacingImageCorrectly() {
Expand All @@ -65,7 +65,7 @@ final class UIImageTests: FBSnapshotTestCase {
let view = UIImageView(image: orientatedImage.applyingPortraitOrientation())
view.sizeToFit()

FBSnapshotVerifyView(view)
FBSnapshotVerifyView(view, perPixelTolerance: 6 / 256)
}

func testRotateImageCorrectly() {
Expand All @@ -74,7 +74,7 @@ final class UIImageTests: FBSnapshotTestCase {
let view = UIImageView(image: image!.rotated(by: Measurement(value: Double.pi * 0.2, unit: .radians), options: []))
view.sizeToFit()

FBSnapshotVerifyView(view)
FBSnapshotVerifyView(view, perPixelTolerance: 6 / 256)
}

func testScaledImageSuccessfully() {
Expand Down
4 changes: 2 additions & 2 deletions WeScanTests/VisionRectangleDetectorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class VisionRectangleDetectorTests: FBSnapshotTestCase {
quadView.backgroundColor = UIColor.red
resultView.addSubview(quadView)

self.FBSnapshotVerifyView(resultView)
self.FBSnapshotVerifyView(resultView, overallTolerance: 0.05)
expectation.fulfill()
}
}
Expand All @@ -90,7 +90,7 @@ final class VisionRectangleDetectorTests: FBSnapshotTestCase {
quadView.backgroundColor = UIColor.red
resultView.addSubview(quadView)

self.FBSnapshotVerifyView(resultView)
self.FBSnapshotVerifyView(resultView, perPixelTolerance: 6 / 256)
expectation.fulfill()
}
}
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ lane :test do |options|
test_project(
project_name: "WeScan",
scheme: "WeScan",
device: "iPhone 8")
device: "iPhone 12 Pro")
end

0 comments on commit 575f006

Please sign in to comment.