Fix the test case compile issue on macOS

This commit is contained in:
DreamPiggy 2020-02-01 18:18:52 +08:00
parent 3363162b03
commit f56c39aab2
1 changed files with 4 additions and 0 deletions

View File

@ -110,7 +110,11 @@ class WebImageTests: XCTestCase {
let expectation = self.expectation(description: "WebImage onSuccess when memory hit") let expectation = self.expectation(description: "WebImage onSuccess when memory hit")
let imageUrl = URL(string: "https://foo.bar/buzz.png") let imageUrl = URL(string: "https://foo.bar/buzz.png")
let cacheKey = SDWebImageManager.shared.cacheKey(for: imageUrl) let cacheKey = SDWebImageManager.shared.cacheKey(for: imageUrl)
#if os(macOS)
let testImage = TestUtils.testImageBundle().image(forResource: "TestImage")
#else
let testImage = UIImage(named: "TestImage", in: TestUtils.testImageBundle(), compatibleWith: nil) let testImage = UIImage(named: "TestImage", in: TestUtils.testImageBundle(), compatibleWith: nil)
#endif
SDImageCache.shared.storeImage(toMemory: testImage, forKey: cacheKey) SDImageCache.shared.storeImage(toMemory: testImage, forKey: cacheKey)
let imageView = WebImage(url: imageUrl) let imageView = WebImage(url: imageUrl)
let introspectView = imageView.onSuccess { image, cacheType in let introspectView = imageView.onSuccess { image, cacheType in