Fix the unit test compile issue

Fix the webp unit test for visionOS
This commit is contained in:
DreamPiggy 2024-02-23 16:43:16 +08:00
parent da55e08994
commit c99b60eed0
3 changed files with 12 additions and 2 deletions

View File

@ -9,8 +9,12 @@
#import "SDTestCase.h" #import "SDTestCase.h"
#import "UIColor+SDHexString.h" #import "UIColor+SDHexString.h"
#if !SD_VISION
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>) #if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>)
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h> #import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
#else
@import SDWebImageWebPCoder;
#endif
#endif #endif
@interface SDWebImageDecoderTests : SDTestCase @interface SDWebImageDecoderTests : SDTestCase

View File

@ -39,7 +39,9 @@ NSString *const kTestAPNGPURL = @"https://upload.wikimedia.org/wikipedia/commons
CGRect screenFrame = mainScreen.bounds; CGRect screenFrame = mainScreen.bounds;
#endif #endif
_window = [[UIWindow alloc] initWithFrame:screenFrame]; _window = [[UIWindow alloc] initWithFrame:screenFrame];
#else #endif // UIKit
#if SD_MAC
UIScreen *mainScreen = [UIScreen mainScreen];
_window = [[NSWindow alloc] initWithContentRect:mainScreen.frame styleMask:0 backing:NSBackingStoreBuffered defer:NO screen:mainScreen]; _window = [[NSWindow alloc] initWithContentRect:mainScreen.frame styleMask:0 backing:NSBackingStoreBuffered defer:NO screen:mainScreen];
#endif #endif
} }

View File

@ -10,8 +10,12 @@
#import "SDWebImageTestTransformer.h" #import "SDWebImageTestTransformer.h"
#import "SDWebImageTestCache.h" #import "SDWebImageTestCache.h"
#import "SDWebImageTestLoader.h" #import "SDWebImageTestLoader.h"
#if !SD_VISION
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>) #if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>)
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h> #import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
#else
@import SDWebImageWebPCoder;
#endif
#endif #endif
// Keep strong references for object // Keep strong references for object
@ -646,7 +650,7 @@
[self waitForExpectationsWithCommonTimeout]; [self waitForExpectationsWithCommonTimeout];
} }
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>) #if !SD_VISION
- (void)test22ThatForceDecodePolicyAlways { - (void)test22ThatForceDecodePolicyAlways {
XCTestExpectation *expectation = [self expectationWithDescription:@"Always policy with WebP image (libwebp) should force-decode"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Always policy with WebP image (libwebp) should force-decode"];
NSURL *url = [NSURL URLWithString:@"https://www.gstatic.com/webp/gallery/4.webp"]; NSURL *url = [NSURL URLWithString:@"https://www.gstatic.com/webp/gallery/4.webp"];