From a2a48e25afeb376fe117f1b042408d8a7e401920 Mon Sep 17 00:00:00 2001 From: woxtu Date: Mon, 22 May 2023 11:55:57 +0900 Subject: [PATCH] chore: Fix typos (#307) * Fix typos * Fix typos --- README.md | 12 +++--- Sources/Mantis/CropData.swift | 2 +- .../CropView/CropAuxiliaryIndicatorView.swift | 30 +++++++------- Sources/Mantis/CropView/CropView.swift | 40 +++++++++---------- .../CropViewController.swift | 2 +- .../ToolBarButtonImageBuilder+DrawImage.swift | 10 ++--- .../ToolBarButtonImageBuilder.swift | 10 ++--- Sources/Mantis/Enum.swift | 4 +- .../Mantis/Protocols/CropViewProtocol.swift | 4 +- .../CropAuxiliaryIndicatorViewTests.swift | 12 +++--- Tests/MantisTests/CropViewTests.swift | 8 ++-- .../MantisTests/CropWorkbenchViewTests.swift | 36 ++++++++--------- Tests/MantisTests/Mock/FakeCropView.swift | 4 +- 13 files changed, 87 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 70e13694..5de144f3 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ github "guoyingtao/Mantis"
Swift Packages -* Respository: https://github.com/guoyingtao/Mantis.git +* Repository: https://github.com/guoyingtao/Mantis.git * Rules: Version - Exact - 2.9.1
@@ -80,7 +80,7 @@ public protocol CropViewControllerDelegate: class { func cropViewControllerDidCrop(_ cropViewController: CropViewController, cropped: UIImage, transformation: Transformation, cropInfo: CropInfo) func cropViewControllerDidCancel(_ cropViewController: CropViewController, original: UIImage) - // The implementaion of the following functions are optional + // The implementation of the following functions are optional func cropViewControllerDidFailToCrop(_ cropViewController: CropViewController, original: UIImage) func cropViewControllerDidBeginResize(_ cropViewController: CropViewController) func cropViewControllerDidEndResize(_ cropViewController: CropViewController, original: UIImage, cropInfo: CropInfo) @@ -188,10 +188,10 @@ public enum CropShapeType { public enum PresetTransformationType { case none case presetInfo(info: Transformation) - case presetNormalizedInfo(normailizedInfo: CGRect) + case presetNormalizedInfo(normalizedInfo: CGRect) } ``` -Please use the transformation infomation obtained previously from delegate method cropViewControllerDidCrop(_ cropViewController: CropViewController, cropped: UIImage, transformation: Transformation, , cropInfo: CropInfo). +Please use the transformation information obtained previously from delegate method cropViewControllerDidCrop(_ cropViewController: CropViewController, cropped: UIImage, transformation: Transformation, , cropInfo: CropInfo). @@ -199,7 +199,7 @@ Please use the transformation infomation obtained previously from delegate metho Localization * UIKit project - Add more languages support to the Localizaions section for Project Info tab + Add more languages support to the Localizations section for Project Info tab

Mantis @@ -236,7 +236,7 @@ Then you'll need to configure Mantis: ``` let config = Mantis.Config() config.localizationConfig.bundle = // a bundle where strings file is located -config.localizationConfig.tableName = // a localizaed strings file name within the bundle +config.localizationConfig.tableName = // a localized strings file name within the bundle ``` diff --git a/Sources/Mantis/CropData.swift b/Sources/Mantis/CropData.swift index 8503455b..a075019a 100644 --- a/Sources/Mantis/CropData.swift +++ b/Sources/Mantis/CropData.swift @@ -29,7 +29,7 @@ public typealias Transformation = ( rotation: CGFloat, scale: CGFloat, manualZoomed: Bool, - intialMaskFrame: CGRect, + initialMaskFrame: CGRect, maskFrame: CGRect, cropWorkbenchViewBounds: CGRect ) diff --git a/Sources/Mantis/CropView/CropAuxiliaryIndicatorView.swift b/Sources/Mantis/CropView/CropAuxiliaryIndicatorView.swift index 6be2a1ef..c6180036 100644 --- a/Sources/Mantis/CropView/CropAuxiliaryIndicatorView.swift +++ b/Sources/Mantis/CropView/CropAuxiliaryIndicatorView.swift @@ -15,7 +15,7 @@ class CropAuxiliaryIndicatorView: UIView, CropAuxiliaryIndicatorViewProtocol { private let edgeLineHandleLength = CGFloat(30.0) private let handleThickness = CGFloat(3.0) private let borderThickness = CGFloat(1.0) - private let hineLineThickness = CGFloat(2.0) + private let hintLineThickness = CGFloat(2.0) private var hintLine = UIView() private var tappedEdge: CropViewAuxiliaryIndicatorHandleType = .none @@ -162,13 +162,13 @@ class CropAuxiliaryIndicatorView: UIView, CropAuxiliaryIndicatorViewProtocol { } private func layoutCornerHandles() { - let topLeftHorizonalLayerFrame = CGRect(x: -handleThickness, y: -handleThickness, width: cornerHandleLength, height: handleThickness) + let topLeftHorizontalLayerFrame = CGRect(x: -handleThickness, y: -handleThickness, width: cornerHandleLength, height: handleThickness) let topLeftVerticalLayerFrame = CGRect(x: -handleThickness, y: -handleThickness, width: handleThickness, height: cornerHandleLength) let horizontalDistanceForHCorner = bounds.width + 2 * handleThickness - cornerHandleLength let verticalDistanceForHCorner = bounds.height + handleThickness let horizontalDistanceForVCorner = bounds.width + handleThickness - let veticalDistanceForVCorner = bounds.height + 2 * handleThickness - cornerHandleLength + let verticalDistanceForVCorner = bounds.height + 2 * handleThickness - cornerHandleLength for (index, line) in cornerHandles.enumerated() { guard let lineType = CropAuxiliaryIndicatorView.CornerHandleType(rawValue: index) else { @@ -176,21 +176,21 @@ class CropAuxiliaryIndicatorView: UIView, CropAuxiliaryIndicatorViewProtocol { } switch lineType { case .topLeftHorizontal: - line.frame = topLeftHorizonalLayerFrame + line.frame = topLeftHorizontalLayerFrame case .topLeftVertical: line.frame = topLeftVerticalLayerFrame case .topRightHorizontal: - line.frame = topLeftHorizonalLayerFrame.offsetBy(dx: horizontalDistanceForHCorner, dy: 0) + line.frame = topLeftHorizontalLayerFrame.offsetBy(dx: horizontalDistanceForHCorner, dy: 0) case .topRightVertical: line.frame = topLeftVerticalLayerFrame.offsetBy(dx: horizontalDistanceForVCorner, dy: 0) case .bottomRightHorizontal: - line.frame = topLeftHorizonalLayerFrame.offsetBy(dx: horizontalDistanceForHCorner, dy: verticalDistanceForHCorner) + line.frame = topLeftHorizontalLayerFrame.offsetBy(dx: horizontalDistanceForHCorner, dy: verticalDistanceForHCorner) case .bottomRightVertical: - line.frame = topLeftVerticalLayerFrame.offsetBy(dx: horizontalDistanceForVCorner, dy: veticalDistanceForVCorner) + line.frame = topLeftVerticalLayerFrame.offsetBy(dx: horizontalDistanceForVCorner, dy: verticalDistanceForVCorner) case .bottomLeftHorizontal: - line.frame = topLeftHorizonalLayerFrame.offsetBy(dx: 0, dy: verticalDistanceForHCorner) + line.frame = topLeftHorizontalLayerFrame.offsetBy(dx: 0, dy: verticalDistanceForHCorner) case .bottomLeftVertical: - line.frame = topLeftVerticalLayerFrame.offsetBy(dx: 0, dy: veticalDistanceForVCorner) + line.frame = topLeftVerticalLayerFrame.offsetBy(dx: 0, dy: verticalDistanceForVCorner) } } } @@ -250,21 +250,21 @@ class CropAuxiliaryIndicatorView: UIView, CropAuxiliaryIndicatorViewProtocol { hintLine.frame = CGRect(x: borderLine.frame.minX, y: borderLine.frame.minY, width: borderLine.frame.width, - height: hineLineThickness) + height: hintLineThickness) case .bottom: hintLine.frame = CGRect(x: borderLine.frame.minX, - y: borderLine.frame.maxY - hineLineThickness, + y: borderLine.frame.maxY - hintLineThickness, width: borderLine.frame.width, - height: hineLineThickness) + height: hintLineThickness) case .left: hintLine.frame = CGRect(x: borderLine.frame.minX, y: borderLine.frame.minY, - width: hineLineThickness, + width: hintLineThickness, height: borderLine.frame.height) case .right: - hintLine.frame = CGRect(x: borderLine.frame.maxX - hineLineThickness, + hintLine.frame = CGRect(x: borderLine.frame.maxX - hintLineThickness, y: borderLine.frame.minY, - width: hineLineThickness, + width: hintLineThickness, height: borderLine.frame.height) default: break diff --git a/Sources/Mantis/CropView/CropView.swift b/Sources/Mantis/CropView/CropView.swift index c69df851..dc7f1f25 100644 --- a/Sources/Mantis/CropView/CropView.swift +++ b/Sources/Mantis/CropView/CropView.swift @@ -605,7 +605,7 @@ extension CropView { rotation: getTotalRadians(), scale: cropWorkbenchView.zoomScale, manualZoomed: manualZoomed, - intialMaskFrame: getInitialCropBoxRect(), + initialMaskFrame: getInitialCropBoxRect(), maskFrame: cropAuxiliaryIndicatorView.frame, cropWorkbenchViewBounds: cropWorkbenchView.bounds ) @@ -755,7 +755,7 @@ extension CropView: CropViewProtocol { setForceFixedRatio(by: presetFixedRatioType) } - func getRatioType(byImageIsOriginalisHorizontal isHorizontal: Bool) -> RatioType { + func getRatioType(byImageIsOriginalHorizontal isHorizontal: Bool) -> RatioType { return viewModel.getRatioType(byImageIsOriginalHorizontal: isHorizontal) } @@ -845,7 +845,7 @@ extension CropView: CropViewProtocol { updatePositionFor90Rotation(by: rotateAngle + viewModel.radians) } - func handleRoteteCompletion() { + func handleRotateCompletion() { cropWorkbenchView.updateMinZoomScale() viewModel.rotateBy90(withRotateType: newRotateType) viewModel.setBetweenOperationStatus() @@ -855,7 +855,7 @@ extension CropView: CropViewProtocol { UIView.animate(withDuration: 0.25, animations: { handleRotateAnimation() }, completion: { _ in - handleRoteteCompletion() + handleRotateCompletion() }) } @@ -937,36 +937,36 @@ extension CropView: CropViewProtocol { return newTransform } - func getTransformInfo(byNormalizedInfo normailizedInfo: CGRect) -> Transformation { + func getTransformInfo(byNormalizedInfo normalizedInfo: CGRect) -> Transformation { let cropFrame = viewModel.cropBoxFrame - let scale: CGFloat = min(1/normailizedInfo.width, 1/normailizedInfo.height) + let scale: CGFloat = min(1/normalizedInfo.width, 1/normalizedInfo.height) var offset = cropFrame.origin - offset.x = cropFrame.width * normailizedInfo.origin.x * scale - offset.y = cropFrame.height * normailizedInfo.origin.y * scale + offset.x = cropFrame.width * normalizedInfo.origin.x * scale + offset.y = cropFrame.height * normalizedInfo.origin.y * scale var maskFrame = cropFrame - if normailizedInfo.width > normailizedInfo.height { - let adjustScale = 1 / normailizedInfo.width - maskFrame.size.height = normailizedInfo.height * cropFrame.height * adjustScale + if normalizedInfo.width > normalizedInfo.height { + let adjustScale = 1 / normalizedInfo.width + maskFrame.size.height = normalizedInfo.height * cropFrame.height * adjustScale maskFrame.origin.y += (cropFrame.height - maskFrame.height) / 2 - } else if normailizedInfo.width < normailizedInfo.height { - let adjustScale = 1 / normailizedInfo.height - maskFrame.size.width = normailizedInfo.width * cropFrame.width * adjustScale + } else if normalizedInfo.width < normalizedInfo.height { + let adjustScale = 1 / normalizedInfo.height + maskFrame.size.width = normalizedInfo.width * cropFrame.width * adjustScale maskFrame.origin.x += (cropFrame.width - maskFrame.width) / 2 } let manualZoomed = (scale != 1.0) - let transformantion = Transformation(offset: offset, + let transformation = Transformation(offset: offset, rotation: 0, scale: scale, manualZoomed: manualZoomed, - intialMaskFrame: .zero, + initialMaskFrame: .zero, maskFrame: maskFrame, cropWorkbenchViewBounds: .zero) - return transformantion + return transformation } func processPresetTransformation(completion: (Transformation) -> Void) { @@ -979,12 +979,12 @@ extension CropView: CropViewProtocol { // The second transform is for adjusting the scale of transformInfo let adjustScale = (viewModel.cropBoxFrame.width / viewModel.cropBoxOriginFrame.width) - / (transformInfo.maskFrame.width / transformInfo.intialMaskFrame.width) + / (transformInfo.maskFrame.width / transformInfo.initialMaskFrame.width) newTransform.scale *= adjustScale transform(byTransformInfo: newTransform) completion(transformInfo) - case .presetNormalizedInfo(let normailizedInfo): - let transformInfo = getTransformInfo(byNormalizedInfo: normailizedInfo) + case .presetNormalizedInfo(let normalizedInfo): + let transformInfo = getTransformInfo(byNormalizedInfo: normalizedInfo) transform(byTransformInfo: transformInfo) cropWorkbenchView.frame = transformInfo.maskFrame completion(transformInfo) diff --git a/Sources/Mantis/CropViewController/CropViewController.swift b/Sources/Mantis/CropViewController/CropViewController.swift index 38e43e6a..d84d59e7 100644 --- a/Sources/Mantis/CropViewController/CropViewController.swift +++ b/Sources/Mantis/CropViewController/CropViewController.swift @@ -96,7 +96,7 @@ open class CropViewController: UIViewController { private func getRatioType() -> RatioType { switch config.cropToolbarConfig.fixedRatiosShowType { case .adaptive: - return cropView.getRatioType(byImageIsOriginalisHorizontal: cropView.image.isHorizontal()) + return cropView.getRatioType(byImageIsOriginalHorizontal: cropView.image.isHorizontal()) case .horizontal: return .horizontal case .vertical: diff --git a/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder+DrawImage.swift b/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder+DrawImage.swift index b85ff3f9..a8758dc0 100644 --- a/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder+DrawImage.swift +++ b/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder+DrawImage.swift @@ -115,13 +115,13 @@ extension ToolBarButtonImageBuilder { rightarrowPath.fill() let mirrorWidth = wholeWidth / 2 - 1 - let mirrowHeight = wholeHeight - 8 + let mirrorHeight = wholeHeight - 8 // left mirror let leftMirror = UIBezierPath() leftMirror.move(to: CGPoint(x: 0, y: wholeHeight)) leftMirror.addLine(to: CGPoint(x: mirrorWidth, y: wholeHeight)) - leftMirror.addLine(to: CGPoint(x: mirrorWidth, y: wholeHeight - mirrowHeight)) + leftMirror.addLine(to: CGPoint(x: mirrorWidth, y: wholeHeight - mirrorHeight)) leftMirror.addLine(to: CGPoint(x: 0, y: wholeHeight)) leftMirror.close() UIColor.white.setFill() @@ -131,7 +131,7 @@ extension ToolBarButtonImageBuilder { let rightMirror = UIBezierPath() rightMirror.move(to: CGPoint(x: wholeWidth, y: wholeHeight)) rightMirror.addLine(to: CGPoint(x: wholeWidth - mirrorWidth, y: wholeHeight)) - rightMirror.addLine(to: CGPoint(x: wholeWidth - mirrorWidth, y: wholeHeight - mirrowHeight)) + rightMirror.addLine(to: CGPoint(x: wholeWidth - mirrorWidth, y: wholeHeight - mirrorHeight)) rightMirror.addLine(to: CGPoint(x: wholeWidth, y: wholeHeight)) rightMirror.close() UIColor.white.setFill() @@ -152,9 +152,9 @@ extension ToolBarButtonImageBuilder { context?.rotate(by: -.pi / 2) context?.translateBy(x: -flippedHorizontallyImage.size.height, y: 0) context?.draw(cgImage, in: CGRect(x: 0, y: 0, width: flippedHorizontallyImage.size.height, height: flippedHorizontallyImage.size.width)) - let fippedVerticallyImage: UIImage? = UIGraphicsGetImageFromCurrentImageContext() + let flippedVerticallyImage: UIImage? = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() - return fippedVerticallyImage + return flippedVerticallyImage } static func drawClampImage() -> UIImage? { diff --git a/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder.swift b/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder.swift index a955c416..40808331 100644 --- a/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder.swift +++ b/Sources/Mantis/CropViewController/ToolBarButtonImageBuilder.swift @@ -87,15 +87,15 @@ struct ToolBarButtonImageBuilder { static func verticallyFlipImage() -> UIImage? { if #available(macCatalyst 13.1, iOS 13.0, *) { - guard let horizontallyFippedImage = horizontallyFlipImage(), - let cgImage = horizontallyFippedImage.cgImage else { + guard let horizontallyFlippedImage = horizontallyFlipImage(), + let cgImage = horizontallyFlippedImage.cgImage else { return nil } - let rotatedImage = UIImage(cgImage: cgImage, scale: horizontallyFippedImage.scale, orientation: .leftMirrored) + let rotatedImage = UIImage(cgImage: cgImage, scale: horizontallyFlippedImage.scale, orientation: .leftMirrored) - let newSize = CGSize(width: horizontallyFippedImage.size.height, height: horizontallyFippedImage.size.width) - UIGraphicsBeginImageContextWithOptions(newSize, false, horizontallyFippedImage.scale) + let newSize = CGSize(width: horizontallyFlippedImage.size.height, height: horizontallyFlippedImage.size.width) + UIGraphicsBeginImageContextWithOptions(newSize, false, horizontallyFlippedImage.scale) rotatedImage.draw(in: CGRect(origin: .zero, size: newSize)) let newImage = UIGraphicsGetImageFromCurrentImageContext() diff --git a/Sources/Mantis/Enum.swift b/Sources/Mantis/Enum.swift index e3cd83fa..92338354 100644 --- a/Sources/Mantis/Enum.swift +++ b/Sources/Mantis/Enum.swift @@ -27,7 +27,7 @@ import UIKit public enum PresetTransformationType { case none case presetInfo(info: Transformation) - case presetNormalizedInfo(normailizedInfo: CGRect) + case presetNormalizedInfo(normalizedInfo: CGRect) } public enum PresetFixedRatioType { @@ -79,7 +79,7 @@ public enum CropShapeType: Hashable { case polygon(sides: Int, offset: CGFloat = 0, maskOnly: Bool = false) /** - Each point should have normailzed values whose range is 0...1 + Each point should have normalized values whose range is 0...1 */ case path(points: [CGPoint], maskOnly: Bool = false) diff --git a/Sources/Mantis/Protocols/CropViewProtocol.swift b/Sources/Mantis/Protocols/CropViewProtocol.swift index 0202e72d..c3de2419 100644 --- a/Sources/Mantis/Protocols/CropViewProtocol.swift +++ b/Sources/Mantis/Protocols/CropViewProtocol.swift @@ -20,7 +20,7 @@ protocol CropViewProtocol: UIView { func initialSetup(delegate: CropViewDelegate, presetFixedRatioType: PresetFixedRatioType) func setViewDefaultProperties() - func getRatioType(byImageIsOriginalisHorizontal isHorizontal: Bool) -> RatioType + func getRatioType(byImageIsOriginalHorizontal isHorizontal: Bool) -> RatioType func getImageHorizontalToVerticalRatio() -> Double func resetComponents() func prepareForViewWillTransition() @@ -32,7 +32,7 @@ protocol CropViewProtocol: UIView { func transform(byTransformInfo transformation: Transformation, rotateDial: Bool) func getTransformInfo(byTransformInfo transformInfo: Transformation) -> Transformation - func getTransformInfo(byNormalizedInfo normailizedInfo: CGRect) -> Transformation + func getTransformInfo(byNormalizedInfo normalizedInfo: CGRect) -> Transformation func processPresetTransformation(completion: (Transformation) -> Void) func horizontallyFlip() diff --git a/Tests/MantisTests/CropAuxiliaryIndicatorViewTests.swift b/Tests/MantisTests/CropAuxiliaryIndicatorViewTests.swift index b4f4ead6..e0629f18 100644 --- a/Tests/MantisTests/CropAuxiliaryIndicatorViewTests.swift +++ b/Tests/MantisTests/CropAuxiliaryIndicatorViewTests.swift @@ -31,20 +31,20 @@ final class CropAuxiliaryIndicatorViewTests: XCTestCase { let container = UIView(frame: CGRect(x: 0, y: 0, width: 1000, height: 1000)) container.addSubview(cropAuxiliaryIndicatorView) - for subivew in cropAuxiliaryIndicatorView.subviews { - XCTAssertEqual(subivew.frame, .zero) + for subview in cropAuxiliaryIndicatorView.subviews { + XCTAssertEqual(subview.frame, .zero) } cropAuxiliaryIndicatorView = CropAuxiliaryIndicatorView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), cropBoxHotAreaUnit: 42) - for subivew in cropAuxiliaryIndicatorView.subviews { - XCTAssertEqual(subivew.frame, .zero) + for subview in cropAuxiliaryIndicatorView.subviews { + XCTAssertEqual(subview.frame, .zero) } container.addSubview(cropAuxiliaryIndicatorView) - for subivew in cropAuxiliaryIndicatorView.subviews { - XCTAssertNotEqual(subivew.frame, .zero) + for subview in cropAuxiliaryIndicatorView.subviews { + XCTAssertNotEqual(subview.frame, .zero) } } diff --git a/Tests/MantisTests/CropViewTests.swift b/Tests/MantisTests/CropViewTests.swift index 36db43cd..b3e6d1fc 100644 --- a/Tests/MantisTests/CropViewTests.swift +++ b/Tests/MantisTests/CropViewTests.swift @@ -41,10 +41,10 @@ final class CropViewTests: XCTestCase { } func testGetRatioType() { - XCTAssertEqual(cropView.getRatioType(byImageIsOriginalisHorizontal: true), cropViewModel.getRatioType(byImageIsOriginalHorizontal: true)) - XCTAssertEqual(cropView.getRatioType(byImageIsOriginalisHorizontal: false), cropViewModel.getRatioType(byImageIsOriginalHorizontal: false)) - XCTAssertNotEqual(cropView.getRatioType(byImageIsOriginalisHorizontal: true), cropViewModel.getRatioType(byImageIsOriginalHorizontal: false)) - XCTAssertNotEqual(cropView.getRatioType(byImageIsOriginalisHorizontal: false), cropViewModel.getRatioType(byImageIsOriginalHorizontal: true)) + XCTAssertEqual(cropView.getRatioType(byImageIsOriginalHorizontal: true), cropViewModel.getRatioType(byImageIsOriginalHorizontal: true)) + XCTAssertEqual(cropView.getRatioType(byImageIsOriginalHorizontal: false), cropViewModel.getRatioType(byImageIsOriginalHorizontal: false)) + XCTAssertNotEqual(cropView.getRatioType(byImageIsOriginalHorizontal: true), cropViewModel.getRatioType(byImageIsOriginalHorizontal: false)) + XCTAssertNotEqual(cropView.getRatioType(byImageIsOriginalHorizontal: false), cropViewModel.getRatioType(byImageIsOriginalHorizontal: true)) } private func testGetImageHorizontalToVerticalRatioWithUpDownAndMirror(testImage: UIImage) { diff --git a/Tests/MantisTests/CropWorkbenchViewTests.swift b/Tests/MantisTests/CropWorkbenchViewTests.swift index ea74a873..df1e115a 100644 --- a/Tests/MantisTests/CropWorkbenchViewTests.swift +++ b/Tests/MantisTests/CropWorkbenchViewTests.swift @@ -10,7 +10,7 @@ import XCTest final class CropWorkbenchViewTests: XCTestCase { - var workbechView = CropWorkbenchView(frame: .zero, minimumZoomScale: 1.0, maximumZoomScale: 15, imageContainer: FakeImageContainer(frame: .zero)) + var workbenchView = CropWorkbenchView(frame: .zero, minimumZoomScale: 1.0, maximumZoomScale: 15, imageContainer: FakeImageContainer(frame: .zero)) override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. @@ -22,36 +22,36 @@ final class CropWorkbenchViewTests: XCTestCase { func testUpdateMinZoomScale() { let fakeImageContainer = FakeImageContainer(frame: .init(x: 0, y: 0, width: 200, height: 100)) - workbechView = CropWorkbenchView(frame: .zero, + workbenchView = CropWorkbenchView(frame: .zero, minimumZoomScale: 1.0, maximumZoomScale: 15, imageContainer: fakeImageContainer) - workbechView.bounds = CGRect(x: 0, y: 0, width: 400, height: 100) - workbechView.updateMinZoomScale() + workbenchView.bounds = CGRect(x: 0, y: 0, width: 400, height: 100) + workbenchView.updateMinZoomScale() - XCTAssertEqual(workbechView.minimumZoomScale, 2) + XCTAssertEqual(workbenchView.minimumZoomScale, 2) - workbechView = CropWorkbenchView(frame: .zero, + workbenchView = CropWorkbenchView(frame: .zero, minimumZoomScale: 1.0, maximumZoomScale: 15, imageContainer: fakeImageContainer) - workbechView.bounds = CGRect(x: 0, y: 0, width: 400, height: 300) - workbechView.updateMinZoomScale() + workbenchView.bounds = CGRect(x: 0, y: 0, width: 400, height: 300) + workbenchView.updateMinZoomScale() - XCTAssertEqual(workbechView.minimumZoomScale, 3) + XCTAssertEqual(workbenchView.minimumZoomScale, 3) } func testShouldScale() { - workbechView.bounds = CGRect(x: 0, y: 0, width: 200, height: 100) - workbechView.contentSize = CGSize(width: 200, height: 100) - XCTAssertTrue(workbechView.shouldScale()) + workbenchView.bounds = CGRect(x: 0, y: 0, width: 200, height: 100) + workbenchView.contentSize = CGSize(width: 200, height: 100) + XCTAssertTrue(workbenchView.shouldScale()) - workbechView.bounds = CGRect(x: 0, y: 0, width: 200, height: 100) - workbechView.contentSize = CGSize(width: 100, height: 80) - XCTAssertTrue(workbechView.shouldScale()) + workbenchView.bounds = CGRect(x: 0, y: 0, width: 200, height: 100) + workbenchView.contentSize = CGSize(width: 100, height: 80) + XCTAssertTrue(workbenchView.shouldScale()) - workbechView.bounds = CGRect(x: 0, y: 0, width: 200, height: 100) - workbechView.contentSize = CGSize(width: 300, height: 200) - XCTAssertFalse(workbechView.shouldScale()) + workbenchView.bounds = CGRect(x: 0, y: 0, width: 200, height: 100) + workbenchView.contentSize = CGSize(width: 300, height: 200) + XCTAssertFalse(workbenchView.shouldScale()) } } diff --git a/Tests/MantisTests/Mock/FakeCropView.swift b/Tests/MantisTests/Mock/FakeCropView.swift index 99695efb..3e852d31 100644 --- a/Tests/MantisTests/Mock/FakeCropView.swift +++ b/Tests/MantisTests/Mock/FakeCropView.swift @@ -18,7 +18,7 @@ class FakeCropView: UIView, CropViewProtocol { func initialSetup(delegate: CropViewDelegate, presetFixedRatioType: PresetFixedRatioType) { } - func getRatioType(byImageIsOriginalisHorizontal isHorizontal: Bool) -> RatioType { + func getRatioType(byImageIsOriginalHorizontal isHorizontal: Bool) -> RatioType { .horizontal } @@ -62,7 +62,7 @@ class FakeCropView: UIView, CropViewProtocol { Transformation(.zero, .zero, .zero, false, .zero, .zero, .zero) } - func getTransformInfo(byNormalizedInfo normailizedInfo: CGRect) -> Transformation { + func getTransformInfo(byNormalizedInfo normalizedInfo: CGRect) -> Transformation { Transformation(.zero, .zero, .zero, false, .zero, .zero, .zero) }