Fix the macOS test case

This commit is contained in:
DreamPiggy 2020-05-12 19:49:56 +08:00
parent 62b4f2570d
commit fdd36a0566
1 changed files with 5 additions and 0 deletions

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)