Change all placeholder.com sample from http into https

This commit is contained in:
DreamPiggy 2023-02-06 18:54:56 +08:00
parent b6910be155
commit 1ec6cd06f7
4 changed files with 29 additions and 29 deletions

View File

@ -74,7 +74,7 @@
@"https://raw.githubusercontent.com/icons8/flat-color-icons/master/pdf/stack_of_photos.pdf", @"https://raw.githubusercontent.com/icons8/flat-color-icons/master/pdf/stack_of_photos.pdf",
@"https://nr-platform.s3.amazonaws.com/uploads/platform/published_extension/branding_icon/275/AmazonS3.png", @"https://nr-platform.s3.amazonaws.com/uploads/platform/published_extension/branding_icon/275/AmazonS3.png",
@"https://res.cloudinary.com/dwpjzbyux/raw/upload/v1666474070/RawDemo/raw_vebed5.NEF", @"https://res.cloudinary.com/dwpjzbyux/raw/upload/v1666474070/RawDemo/raw_vebed5.NEF",
@"http://via.placeholder.com/200x200.jpg", @"https://via.placeholder.com/200x200.jpg",
nil]; nil];
for (int i=1; i<25; i++) { for (int i=1; i<25; i++) {

View File

@ -174,7 +174,7 @@
- (void)test11ThatCancelWorks { - (void)test11ThatCancelWorks {
XCTestExpectation *expectation = [self expectationWithDescription:@"Cancel"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Cancel"];
NSURL *imageURL = [NSURL URLWithString:@"http://via.placeholder.com/1000x1000.png"]; NSURL *imageURL = [NSURL URLWithString:@"https://via.placeholder.com/1000x1000.png"];
SDWebImageDownloadToken *token = [[SDWebImageDownloader sharedDownloader] SDWebImageDownloadToken *token = [[SDWebImageDownloader sharedDownloader]
downloadImageWithURL:imageURL options:0 progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) { downloadImageWithURL:imageURL options:0 progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
expect(error).notTo.beNil(); expect(error).notTo.beNil();
@ -779,7 +779,7 @@
// We move the logic into SDWebImageDownloaderOperation, which decode each callback's thumbnail size with different decoding pipeline, and callback independently // We move the logic into SDWebImageDownloaderOperation, which decode each callback's thumbnail size with different decoding pipeline, and callback independently
// Note the progressiveLoad does not support this and always callback first size // Note the progressiveLoad does not support this and always callback first size
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/501x501.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/501x501.png"];
NSString *fullSizeKey = [SDWebImageManager.sharedManager cacheKeyForURL:url]; NSString *fullSizeKey = [SDWebImageManager.sharedManager cacheKeyForURL:url];
[SDImageCache.sharedImageCache removeImageFromDiskForKey:fullSizeKey]; [SDImageCache.sharedImageCache removeImageFromDiskForKey:fullSizeKey];
for (int i = 490; i < 500; i++) { for (int i = 490; i < 500; i++) {

View File

@ -105,7 +105,7 @@
- (void)test07ThatLoadImageWithSDWebImageRefreshCachedWorks { - (void)test07ThatLoadImageWithSDWebImageRefreshCachedWorks {
XCTestExpectation *expectation = [self expectationWithDescription:@"Image download twice with SDWebImageRefresh failed"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Image download twice with SDWebImageRefresh failed"];
NSURL *originalImageURL = [NSURL URLWithString:@"http://via.placeholder.com/10x10.png"]; NSURL *originalImageURL = [NSURL URLWithString:@"https://via.placeholder.com/10x10.png"];
__block BOOL firstCompletion = NO; __block BOOL firstCompletion = NO;
[[SDWebImageManager sharedManager] loadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { [[SDWebImageManager sharedManager] loadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
expect(image).toNot.beNil(); expect(image).toNot.beNil();
@ -115,7 +115,7 @@
// Because we call completion before remove the operation from queue, so need a dispatch to avoid get the same operation again. Attention this trap. // Because we call completion before remove the operation from queue, so need a dispatch to avoid get the same operation again. Attention this trap.
// One way to solve this is use another `NSURL instance` because we use `NSURL` as key but not `NSString`. However, this is implementation detail and no guarantee in the future. // One way to solve this is use another `NSURL instance` because we use `NSURL` as key but not `NSString`. However, this is implementation detail and no guarantee in the future.
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
NSURL *newImageURL = [NSURL URLWithString:@"http://via.placeholder.com/10x10.png"]; NSURL *newImageURL = [NSURL URLWithString:@"https://via.placeholder.com/10x10.png"];
[[SDWebImageManager sharedManager] loadImageWithURL:newImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage * _Nullable image2, NSData * _Nullable data2, NSError * _Nullable error2, SDImageCacheType cacheType2, BOOL finished2, NSURL * _Nullable imageURL2) { [[SDWebImageManager sharedManager] loadImageWithURL:newImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage * _Nullable image2, NSData * _Nullable data2, NSError * _Nullable error2, SDImageCacheType cacheType2, BOOL finished2, NSURL * _Nullable imageURL2) {
expect(image2).toNot.beNil(); expect(image2).toNot.beNil();
expect(error2).to.beNil(); expect(error2).to.beNil();
@ -132,7 +132,7 @@
- (void)test08ThatImageTransformerWork { - (void)test08ThatImageTransformerWork {
XCTestExpectation *expectation = [self expectationWithDescription:@"Image transformer work"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Image transformer work"];
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/80x60.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/80x60.png"];
SDWebImageTestTransformer *transformer = [[SDWebImageTestTransformer alloc] init]; SDWebImageTestTransformer *transformer = [[SDWebImageTestTransformer alloc] init];
transformer.testImage = [[UIImage alloc] initWithContentsOfFile:[self testJPEGPath]]; transformer.testImage = [[UIImage alloc] initWithContentsOfFile:[self testJPEGPath]];
@ -293,7 +293,7 @@
- (void)test13ThatScaleDownLargeImageUseThumbnailDecoding { - (void)test13ThatScaleDownLargeImageUseThumbnailDecoding {
XCTestExpectation *expectation = [self expectationWithDescription:@"SDWebImageScaleDownLargeImages should translate to thumbnail decoding"]; XCTestExpectation *expectation = [self expectationWithDescription:@"SDWebImageScaleDownLargeImages should translate to thumbnail decoding"];
NSURL *originalImageURL = [NSURL URLWithString:@"http://via.placeholder.com/3999x3999.png"]; // Max size for this API NSURL *originalImageURL = [NSURL URLWithString:@"https://via.placeholder.com/2000x2000.png"]; // Max size for this API
NSUInteger defaultLimitBytes = SDImageCoderHelper.defaultScaleDownLimitBytes; NSUInteger defaultLimitBytes = SDImageCoderHelper.defaultScaleDownLimitBytes;
SDImageCoderHelper.defaultScaleDownLimitBytes = 1000 * 1000 * 4; // Limit 1000x1000 pixel SDImageCoderHelper.defaultScaleDownLimitBytes = 1000 * 1000 * 4; // Limit 1000x1000 pixel
// From v5.5.0, the `SDWebImageScaleDownLargeImages` translate to `SDWebImageContextImageThumbnailPixelSize`, and works for progressive loading // From v5.5.0, the `SDWebImageScaleDownLargeImages` translate to `SDWebImageContextImageThumbnailPixelSize`, and works for progressive loading
@ -336,7 +336,7 @@
- (void)test14ThatCustomCacheAndLoaderWorks { - (void)test14ThatCustomCacheAndLoaderWorks {
XCTestExpectation *expectation = [self expectationWithDescription:@"Custom Cache and Loader during manger query"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Custom Cache and Loader during manger query"];
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/100x100.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/100x100.png"];
SDWebImageContext *context = @{ SDWebImageContext *context = @{
SDWebImageContextImageCache : SDWebImageTestCache.sharedCache, SDWebImageContextImageCache : SDWebImageTestCache.sharedCache,
SDWebImageContextImageLoader : SDWebImageTestLoader.sharedLoader SDWebImageContextImageLoader : SDWebImageTestLoader.sharedLoader
@ -360,7 +360,7 @@
- (void)test15ThatQueryCacheTypeWork { - (void)test15ThatQueryCacheTypeWork {
XCTestExpectation *expectation = [self expectationWithDescription:@"Image query cache type works"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Image query cache type works"];
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/101x101.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/101x101.png"];
NSString *key = [SDWebImageManager.sharedManager cacheKeyForURL:url]; NSString *key = [SDWebImageManager.sharedManager cacheKeyForURL:url];
NSData *testImageData = [NSData dataWithContentsOfFile:[self testJPEGPath]]; NSData *testImageData = [NSData dataWithContentsOfFile:[self testJPEGPath]];
[SDImageCache.sharedImageCache storeImageDataToDisk:testImageData forKey:key]; [SDImageCache.sharedImageCache storeImageDataToDisk:testImageData forKey:key];
@ -383,7 +383,7 @@
- (void)test15ThatOriginalQueryCacheTypeWork { - (void)test15ThatOriginalQueryCacheTypeWork {
XCTestExpectation *expectation = [self expectationWithDescription:@"Image original query cache type with transformer works"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Image original query cache type with transformer works"];
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/102x102.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/102x102.png"];
SDWebImageTestTransformer *transformer = [[SDWebImageTestTransformer alloc] init]; SDWebImageTestTransformer *transformer = [[SDWebImageTestTransformer alloc] init];
transformer.testImage = [[UIImage alloc] initWithContentsOfFile:[self testJPEGPath]]; transformer.testImage = [[UIImage alloc] initWithContentsOfFile:[self testJPEGPath]];
NSString *originalKey = [SDWebImageManager.sharedManager cacheKeyForURL:url]; NSString *originalKey = [SDWebImageManager.sharedManager cacheKeyForURL:url];
@ -419,7 +419,7 @@
- (void)test16ThatTransformerUseDifferentCacheForOriginalAndTransformedImage { - (void)test16ThatTransformerUseDifferentCacheForOriginalAndTransformedImage {
XCTestExpectation *expectation = [self expectationWithDescription:@"Image transformer use different cache instance for original image and transformed image works"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Image transformer use different cache instance for original image and transformed image works"];
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/103x103.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/103x103.png"];
SDWebImageTestTransformer *transformer = [[SDWebImageTestTransformer alloc] init]; SDWebImageTestTransformer *transformer = [[SDWebImageTestTransformer alloc] init];
transformer.testImage = [[UIImage alloc] initWithContentsOfFile:[self testJPEGPath]]; transformer.testImage = [[UIImage alloc] initWithContentsOfFile:[self testJPEGPath]];
NSString *originalKey = [SDWebImageManager.sharedManager cacheKeyForURL:url]; NSString *originalKey = [SDWebImageManager.sharedManager cacheKeyForURL:url];
@ -505,7 +505,7 @@
CGContextFillRect(context, CGRectMake(0, 0, fullSize.width, fullSize.height)); CGContextFillRect(context, CGRectMake(0, 0, fullSize.width, fullSize.height));
}]; }];
expect(fullSizeImage.size).equal(fullSize); expect(fullSizeImage.size).equal(fullSize);
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/500x500.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/500x500.png"];
NSString *fullSizeKey = [SDWebImageManager.sharedManager cacheKeyForURL:url]; NSString *fullSizeKey = [SDWebImageManager.sharedManager cacheKeyForURL:url];
NSData *fullSizeData = fullSizeImage.sd_imageData; NSData *fullSizeData = fullSizeImage.sd_imageData;
[SDImageCache.sharedImageCache storeImageDataToDisk:fullSizeData forKey:fullSizeKey]; [SDImageCache.sharedImageCache storeImageDataToDisk:fullSizeData forKey:fullSizeKey];
@ -535,7 +535,7 @@
// We move the logic into SDWebImageDownloaderOperation, which decode each callback's thumbnail size with different decoding pipeline, and callback independently // We move the logic into SDWebImageDownloaderOperation, which decode each callback's thumbnail size with different decoding pipeline, and callback independently
// Note the progressiveLoad does not support this and always callback first size // Note the progressiveLoad does not support this and always callback first size
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/501x501.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/501x501.png"];
NSString *fullSizeKey = [SDWebImageManager.sharedManager cacheKeyForURL:url]; NSString *fullSizeKey = [SDWebImageManager.sharedManager cacheKeyForURL:url];
[SDImageCache.sharedImageCache removeImageFromDiskForKey:fullSizeKey]; [SDImageCache.sharedImageCache removeImageFromDiskForKey:fullSizeKey];
for (int i = 490; i < 500; i++) { for (int i = 490; i < 500; i++) {
@ -563,7 +563,7 @@
- (void)test20ThatContextPassDecodeOptionsWorks { - (void)test20ThatContextPassDecodeOptionsWorks {
XCTestExpectation *expectation = [self expectationWithDescription:@"The SDWebImageContextImageDecodeOptions should passed to the coder"]; XCTestExpectation *expectation = [self expectationWithDescription:@"The SDWebImageContextImageDecodeOptions should passed to the coder"];
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/502x502.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/502x502.png"];
SDImageCoderOptions *originalDecodeOptions = @{@"Foo": @"Bar", SDImageCoderDecodeScaleFactor : @(2)}; // This will be override SDImageCoderOptions *originalDecodeOptions = @{@"Foo": @"Bar", SDImageCoderDecodeScaleFactor : @(2)}; // This will be override
[SDWebImageManager.sharedManager loadImageWithURL:url options:0 context:@{SDWebImageContextImageScaleFactor : @(1), SDWebImageContextImageDecodeOptions : originalDecodeOptions} progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { [SDWebImageManager.sharedManager loadImageWithURL:url options:0 context:@{SDWebImageContextImageScaleFactor : @(1), SDWebImageContextImageDecodeOptions : originalDecodeOptions} progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
@ -579,7 +579,7 @@
- (void)test21ThatQueryOriginalDiskCacheFromThumbnailShouldNotWriteBackDiskCache { - (void)test21ThatQueryOriginalDiskCacheFromThumbnailShouldNotWriteBackDiskCache {
XCTestExpectation *expectation = [self expectationWithDescription:@"Using original disk cache to do thumbnail decoding or transformer, should not save back disk data again"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Using original disk cache to do thumbnail decoding or transformer, should not save back disk data again"];
NSURL *url = [NSURL URLWithString:@"http://via.placeholder.com/503x503.png"]; NSURL *url = [NSURL URLWithString:@"https://via.placeholder.com/503x503.png"];
NSString *originalKey = url.absoluteString; NSString *originalKey = url.absoluteString;
// 1. Store the disk data to original cache // 1. Store the disk data to original cache
CGSize fullSize = CGSizeMake(503, 503); CGSize fullSize = CGSizeMake(503, 503);

View File

@ -34,9 +34,9 @@
- (void)test02PrefetchMultipleImages { - (void)test02PrefetchMultipleImages {
XCTestExpectation *expectation = [self expectationWithDescription:@"Correct prefetch of multiple images"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Correct prefetch of multiple images"];
NSArray *imageURLs = @[@"http://via.placeholder.com/20x20.jpg", NSArray *imageURLs = @[@"https://via.placeholder.com/20x20.jpg",
@"http://via.placeholder.com/30x30.jpg", @"https://via.placeholder.com/30x30.jpg",
@"http://via.placeholder.com/40x40.jpg"]; @"https://via.placeholder.com/40x40.jpg"];
__block NSUInteger numberOfPrefetched = 0; __block NSUInteger numberOfPrefetched = 0;
@ -72,10 +72,10 @@
- (void)test04PrefetchWithMultipleArrayDifferentQueueWorks { - (void)test04PrefetchWithMultipleArrayDifferentQueueWorks {
XCTestExpectation *expectation = [self expectationWithDescription:@"Prefetch with multiple array at different queue failed"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Prefetch with multiple array at different queue failed"];
NSArray *imageURLs1 = @[@"http://via.placeholder.com/20x20.jpg", NSArray *imageURLs1 = @[@"https://via.placeholder.com/20x20.jpg",
@"http://via.placeholder.com/30x30.jpg"]; @"https://via.placeholder.com/30x30.jpg"];
NSArray *imageURLs2 = @[@"http://via.placeholder.com/30x30.jpg", NSArray *imageURLs2 = @[@"https://via.placeholder.com/30x30.jpg",
@"http://via.placeholder.com/40x40.jpg"]; @"https://via.placeholder.com/40x40.jpg"];
dispatch_queue_t queue1 = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); dispatch_queue_t queue1 = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_queue_t queue2 = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); dispatch_queue_t queue2 = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
__block int numberOfPrefetched1 = 0; __block int numberOfPrefetched1 = 0;
@ -120,7 +120,7 @@
// This test also test large URLs and thread-safe problem. You can tested with 2000 urls and get the correct result locally. However, due to the limit of CI, 20 is enough. // This test also test large URLs and thread-safe problem. You can tested with 2000 urls and get the correct result locally. However, due to the limit of CI, 20 is enough.
NSMutableArray<NSURL *> *imageURLs = [NSMutableArray arrayWithCapacity:20]; NSMutableArray<NSURL *> *imageURLs = [NSMutableArray arrayWithCapacity:20];
for (size_t i = 1; i <= 20; i++) { for (size_t i = 1; i <= 20; i++) {
NSString *url = [NSString stringWithFormat:@"http://via.placeholder.com/%zux%zu.jpg", i, i]; NSString *url = [NSString stringWithFormat:@"https://via.placeholder.com/%zux%zu.jpg", i, i];
[imageURLs addObject:[NSURL URLWithString:url]]; [imageURLs addObject:[NSURL URLWithString:url]];
} }
self.prefetcher = [SDWebImagePrefetcher new]; self.prefetcher = [SDWebImagePrefetcher new];
@ -141,9 +141,9 @@
} }
- (void)test06PrefetchCancelToken { - (void)test06PrefetchCancelToken {
NSArray *imageURLs = @[@"http://via.placeholder.com/20x20.jpg", NSArray *imageURLs = @[@"https://via.placeholder.com/20x20.jpg",
@"http://via.placeholder.com/30x30.jpg", @"https://via.placeholder.com/30x30.jpg",
@"http://via.placeholder.com/40x40.jpg"]; @"https://via.placeholder.com/40x40.jpg"];
SDWebImagePrefetcher *prefetcher = [[SDWebImagePrefetcher alloc] init]; SDWebImagePrefetcher *prefetcher = [[SDWebImagePrefetcher alloc] init];
SDWebImagePrefetchToken *token = [prefetcher prefetchURLs:imageURLs]; SDWebImagePrefetchToken *token = [prefetcher prefetchURLs:imageURLs];
expect(prefetcher.runningTokens.count).equal(1); expect(prefetcher.runningTokens.count).equal(1);
@ -154,9 +154,9 @@
- (void)test07DownloaderCancelDuringPrefetching { - (void)test07DownloaderCancelDuringPrefetching {
XCTestExpectation *expectation = [self expectationWithDescription:@"Downloader cancel during prefetch should not hung up"]; XCTestExpectation *expectation = [self expectationWithDescription:@"Downloader cancel during prefetch should not hung up"];
NSArray *imageURLs = @[@"http://via.placeholder.com/5000x5000.jpg", NSArray *imageURLs = @[@"https://via.placeholder.com/5000x5000.jpg",
@"http://via.placeholder.com/6000x6000.jpg", @"https://via.placeholder.com/6000x6000.jpg",
@"http://via.placeholder.com/7000x7000.jpg"]; @"https://via.placeholder.com/7000x7000.jpg"];
for (NSString *url in imageURLs) { for (NSString *url in imageURLs) {
[SDImageCache.sharedImageCache removeImageFromDiskForKey:url]; [SDImageCache.sharedImageCache removeImageFromDiskForKey:url];
} }