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 "UIColor+SDHexString.h"
#if !SD_VISION
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>)
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
#else
@import SDWebImageWebPCoder;
#endif
#endif
@interface SDWebImageDecoderTests : SDTestCase

View File

@ -39,7 +39,9 @@ NSString *const kTestAPNGPURL = @"https://upload.wikimedia.org/wikipedia/commons
CGRect screenFrame = mainScreen.bounds;
#endif
_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];
#endif
}

View File

@ -10,8 +10,12 @@
#import "SDWebImageTestTransformer.h"
#import "SDWebImageTestCache.h"
#import "SDWebImageTestLoader.h"
#if !SD_VISION
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>)
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
#else
@import SDWebImageWebPCoder;
#endif
#endif
// Keep strong references for object
@ -646,7 +650,7 @@
[self waitForExpectationsWithCommonTimeout];
}
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>)
#if !SD_VISION
- (void)test22ThatForceDecodePolicyAlways {
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"];