Merge pull request #98 from SDWebImage/travis_catalina

Update the Travis-CI to use Catalina and enable macOS test case
This commit is contained in:
DreamPiggy 2020-05-12 20:20:02 +08:00 committed by GitHub
commit 28e68492ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
language: swift
osx_image: xcode11.3
osx_image: xcode11.4
env:
global:
@ -43,13 +43,12 @@ script:
- echo Run the tests
- xcodebuild clean test -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUITests' -destination 'name=iPhone 11 Pro Max' -configuration Debug | xcpretty -c
- mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS
# Catalina
# - xcodebuild clean test -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUITests macOS' -destination 'platform=macOS,arch=x86_64' -configuration Debug | xcpretty -c
# - mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS
- xcodebuild clean test -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUITests macOS' -destination 'platform=macOS,arch=x86_64' -configuration Debug | xcpretty -c
- mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS
- xcodebuild clean test -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUITests tvOS' -destination 'platform=tvOS Simulator,name=Apple TV' -configuration Debug | xcpretty -c
- mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/tvOS
after_success:
# - bash <(curl -s https://codecov.io/bash) -D './DerivedData/macOS' -J '^SDWebImageSwiftUI$' -F macos
- bash <(curl -s https://codecov.io/bash) -D './DerivedData/iOS' -J '^SDWebImageSwiftUI$' -F ios
- bash <(curl -s https://codecov.io/bash) -D './DerivedData/macOS' -J '^SDWebImageSwiftUI$' -F macos
- bash <(curl -s https://codecov.io/bash) -D './DerivedData/tvOS' -J '^SDWebImageSwiftUI$'-F tvos

View File

@ -158,10 +158,15 @@ class WebImageTests: XCTestCase {
let imageUrl = URL(string: "https://raw.githubusercontent.com/recurser/exif-orientation-examples/master/Landscape_5.jpg")
let imageView = WebImage(url: imageUrl)
let introspectView = imageView.onSuccess { image, data, cacheType in
#if os(macOS)
let displayImage = try? imageView.inspect().group().image(0).nsImage()
XCTAssertNotNil(displayImage)
#else
let displayImage = try? imageView.inspect().group().image(0).cgImage()
let orientation = try! imageView.inspect().group().image(0).orientation()
XCTAssertNotNil(displayImage)
XCTAssertEqual(orientation, .leftMirrored)
#endif
expectation.fulfill()
}.onFailure { error in
XCTFail(error.localizedDescription)