diff --git a/Cartfile.resolved b/Cartfile.resolved index e941b5d..5c1f3c5 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "krimpedance/KRActivityIndicatorView" "2.0.1" +github "krimpedance/KRActivityIndicatorView" "2.0.2" diff --git a/KRProgressHUD.podspec b/KRProgressHUD.podspec index 72599f2..4e5c924 100644 --- a/KRProgressHUD.podspec +++ b/KRProgressHUD.podspec @@ -14,5 +14,5 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/krimpedance/KRProgressHUD.git", :tag => s.version.to_s } s.source_files = "KRProgressHUD/**/*.swift" - s.dependency "KRActivityIndicator", "~> 2.0.1" + s.dependency "KRActivityIndicator", "~> 2.0.2" end diff --git a/KRProgressHUD.xcodeproj/project.pbxproj b/KRProgressHUD.xcodeproj/project.pbxproj index 78883ea..25a3a29 100644 --- a/KRProgressHUD.xcodeproj/project.pbxproj +++ b/KRProgressHUD.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 4BA70C341D02F28D009EB743 /* KRProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA70C331D02F28D009EB743 /* KRProgressHUD.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BA70C431D02F2ED009EB743 /* KRProgressHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA70C3F1D02F2ED009EB743 /* KRProgressHUD.swift */; }; 4BA70C441D02F2ED009EB743 /* KRProgressHUDIconType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA70C401D02F2ED009EB743 /* KRProgressHUDIconType.swift */; }; + 6B8AE6981ECE793600CE27A8 /* KRActivityIndicatorView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BD5F7C71EC3F3E4007A502E /* KRActivityIndicatorView.framework */; }; 6BD5F7C81EC3F3E4007A502E /* KRActivityIndicatorView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BD5F7C71EC3F3E4007A502E /* KRActivityIndicatorView.framework */; }; /* End PBXBuildFile section */ @@ -47,6 +48,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6B8AE6981ECE793600CE27A8 /* KRActivityIndicatorView.framework in Frameworks */, 4B7576E21D1BCD56003FF258 /* KRProgressHUD.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -278,9 +280,14 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = ""; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = KRProgressHUDTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/Carthage/Build/iOS"; + ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRProgressHUDTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; @@ -292,6 +299,10 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = ""; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = KRProgressHUDTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/Carthage/Build/iOS"; @@ -417,6 +428,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRProgressHUD; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; diff --git a/KRProgressHUD/Classes/InnerKRProgressHUD.swift b/KRProgressHUD/Classes/InnerKRProgressHUD.swift index 1c561eb..7b978fd 100644 --- a/KRProgressHUD/Classes/InnerKRProgressHUD.swift +++ b/KRProgressHUD/Classes/InnerKRProgressHUD.swift @@ -32,8 +32,10 @@ extension KRProgressHUD { hudView.autoresizingMask = [.flexibleTopMargin, .flexibleBottomMargin, .flexibleLeftMargin, .flexibleRightMargin] - iconView.frame = CGRect(origin: iconViewCenter, size: iconViewSize) + iconView.frame.size = iconViewSize + iconView.center = iconViewCenter iconView.backgroundColor = .clear + iconView.isHidden = false activityIndicatorView.frame.size = iconViewSize activityIndicatorView.isLarge = true @@ -58,6 +60,7 @@ extension KRProgressHUD { messageLabel.textAlignment = .center messageLabel.adjustsFontSizeToFitWidth = true messageLabel.minimumScaleFactor = 0.5 + messageLabel.numberOfLines = 1 iconDrawingView.layer.addSublayer(iconDrawingLayer) iconView.addSubview(imageView) @@ -99,7 +102,7 @@ extension KRProgressHUD { // MARK: - Private actions -------------------------- -fileprivate extension KRProgressHUD { +extension KRProgressHUD { func cancelCurrentDismissHandler() -> Bool { guard let handler = dismissHandler else { return true } defer { dismissHandler = nil } diff --git a/KRProgressHUDTests/KRProgressHUDTests.swift b/KRProgressHUDTests/KRProgressHUDTests.swift index e572be0..a82d8f6 100644 --- a/KRProgressHUDTests/KRProgressHUDTests.swift +++ b/KRProgressHUDTests/KRProgressHUDTests.swift @@ -7,29 +7,297 @@ // import XCTest +@testable import KRProgressHUD +import KRActivityIndicatorView class KRProgressHUDTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - + + override func setUp() { + super.setUp() + } + + override func tearDown() { + super.tearDown() + } + + // MARK: - Apply styles -------------- + + func testApplyStyles() { + // Initial style test + XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .white) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .black) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, nil) + XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, UIColor(white: 0, alpha: 0.2)) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .black) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .lightGray) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 13)) + + KRProgressHUD.appearance().style = .custom(background: .red, text: .white, icon: .green) + KRProgressHUD.appearance().maskType = .clear + KRProgressHUD.appearance().activityIndicatorStyle = .color(.yellow) + KRProgressHUD.appearance().font = UIFont.systemFont(ofSize: 20) + + KRProgressHUD.shared.applyStyles() + + // Set appearance style test + XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .red) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .white) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, UIColor.green.cgColor) + XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, .clear) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .yellow) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .yellow) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 20)) + + KRProgressHUD + .set(style: .custom(background: .red, text: .orange, icon: .black)) + .set(maskType: .white) + .set(activityIndicatorViewStyle: .gradationColor(head: .red, tail: .blue)) + .set(font: UIFont.systemFont(ofSize: 10)) + .shared + .applyStyles() + + // Set style test + XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .red) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .orange) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, UIColor.black.cgColor) + XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, UIColor(white: 1, alpha: 0.2)) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .red) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .blue) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 10)) + + KRProgressHUD + .resetStyles() + .shared + .applyStyles() + + // Reset style test + XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .red) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .white) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, UIColor.green.cgColor) + XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, .clear) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .yellow) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .yellow) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 20)) + } + + // MARK: - Center position -------------- + + func testCenterPosition() { + let centerPosition = CGPoint(x: UIScreen.main.bounds.width/2, y: UIScreen.main.bounds.height/2) + let image = UIImage() + + /** + Initial position test + */ + XCTAssertEqual(KRProgressHUD.shared.hudView.center, centerPosition) + + /** + Set appearance test + */ + KRProgressHUD.appearance().viewCenterPosition = CGPoint(x: 100, y: 100) + + // loading + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // loading with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // icon + KRProgressHUD.shared.updateLayouts(message: nil, iconType: .success, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // icon with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: .info, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // image + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // image with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // test conly + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: true) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + + /** + Set position test + */ + KRProgressHUD.set(centerPosition: CGPoint(x: 50, y: 50)) + + // loading + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 50, y: 50)) + // loading with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 50, y: 50)) + // icon + KRProgressHUD.shared.updateLayouts(message: nil, iconType: .success, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 50, y: 50)) + // icon with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: .info, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 50, y: 50)) + // image + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 50, y: 50)) + // image with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 50, y: 50)) + // test conly + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: true) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 50, y: 50)) + + /** + Reset position test + */ + KRProgressHUD.resetStyles() + + // loading + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // loading with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // icon + KRProgressHUD.shared.updateLayouts(message: nil, iconType: .success, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // icon with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: .info, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // image + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // image with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + // test conly + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: true) + XCTAssertEqual(KRProgressHUD.shared.hudView.center, CGPoint(x: 100, y: 100)) + } + + // MARK: - Layout -------------- + + func testLayouts() { + let image = UIImage() + let hudSize = CGSize(width: 150, height: 110) + let simpleHUDSize = CGSize(width: 100, height: 100) + let iconViewSize = CGSize(width: 50, height: 50) + let iconViewCenter = CGPoint(x: hudSize.width/2, y: 40) + let simpleHUDIconViewCenter = CGPoint(x: simpleHUDSize.width/2, y: 50) + let messageLabelMargin = CGFloat(10) + let messageLabelFrame = CGRect(x: messageLabelMargin, + y: iconViewCenter.y + iconViewSize.height / 2 + messageLabelMargin, + width: hudSize.width - messageLabelMargin * 2, + height: 20) + + KRProgressHUD.shared.configureProgressHUDView() + + // Initial layout test + XCTAssertEqual(KRProgressHUD.shared.hudView.frame.size, hudSize) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, iconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame, messageLabelFrame) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 1) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) + + // loading + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.frame.size, simpleHUDSize) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, simpleHUDIconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame, messageLabelFrame) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 1) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, true) + + // loading with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.frame.size, hudSize) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, iconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame, messageLabelFrame) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 1) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) + + // icon + KRProgressHUD.shared.updateLayouts(message: nil, iconType: .success, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.frame.size, simpleHUDSize) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, simpleHUDIconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, false) + XCTAssert(KRProgressHUD.shared.iconDrawingLayer.path != nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame, messageLabelFrame) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 1) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, true) + + // icon with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: .info, image: nil, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.frame.size, hudSize) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, iconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, false) + XCTAssert(KRProgressHUD.shared.iconDrawingLayer.path != nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame, messageLabelFrame) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 1) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) + + // image + KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.frame.size, simpleHUDSize) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, simpleHUDIconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, image) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame, messageLabelFrame) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 1) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, true) + + // image with message + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: image, isOnlyText: false) + XCTAssertEqual(KRProgressHUD.shared.hudView.frame.size, hudSize) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, iconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, image) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, false) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame, messageLabelFrame) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 1) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) + + // test conly + KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, isOnlyText: true) + XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.iconView.center, iconViewCenter) + XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) + XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.frame.origin, CGPoint(x: messageLabelMargin, y: messageLabelMargin)) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.numberOfLines, 0) + XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) + } }