Sfoglia il codice sorgente

Fix testDownsamplingWithEdgeCaseSize fail

Kittisak Phetrungnapha 1 anno fa
parent
commit
2e775c92d7
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      Tests/KingfisherTests/ImageExtensionTests.swift

+ 3 - 3
Tests/KingfisherTests/ImageExtensionTests.swift

@@ -331,9 +331,9 @@ class ImageExtensionTests: XCTestCase {
 
     func testDownsamplingWithEdgeCaseSize() {
 
-        // Zero size would fail downsampling.
-        let nilImage = KingfisherWrapper<KFCrossPlatformImage>.downsampledImage(data: testImageData, to: .zero, scale: 1)
-        XCTAssertNil(nilImage)
+        // Zero size would downsampling to 64x64 (previously nil).
+        let image = KingfisherWrapper<KFCrossPlatformImage>.downsampledImage(data: testImageData, to: .zero, scale: 1)
+        XCTAssertEqual(image?.size, CGSize(width: 64, height: 64))
 
         let largerSize = CGSize(width: 100, height: 100)
         let largerImage = KingfisherWrapper<KFCrossPlatformImage>.downsampledImage(data: testImageData, to: largerSize, scale: 1)