Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Classes/PINRemoteImageManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ - (void)downloadImageWithURL:(NSURL *)url

__weak typeof(self) weakSelf = self;
NSUUID *downloadTaskUUID = [self downloadImageWithURL:url
options:options | PINRemoteImageManagerDownloadOptionsSkipEarlyCheck
options:options | PINRemoteImageManagerDownloadOptionsSkipEarlyCheck | PINRemoteImageManagerDisallowAlternateRepresentations
completion:^(PINRemoteImageManagerResult *result)
{
typeof(self) strongSelf = weakSelf;
Expand Down
31 changes: 31 additions & 0 deletions Tests/PINRemoteImageTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,37 @@ - (void)testGIFDownload
[self waitForExpectationsWithTimeout:[self timeoutTimeInterval] handler:nil];
}

- (void)testGIFDownloadWithProcessor
{
XCTestExpectation * expectation = [self expectationWithDescription:@"Download and process GIF"];

CGSize processingTargetSize = CGSizeMake(10, 10);

[self.imageManager downloadImageWithURL:[self GIFURL]
options:PINRemoteImageManagerDownloadOptionsNone
processorKey:@"process"
processor:^UIImage * _Nullable(PINRemoteImageManagerResult * _Nonnull result, NSUInteger * _Nonnull cost) {
XCTAssert(result.image != nil, @"Expect image when processing GIF.");
UIGraphicsBeginImageContext(processingTargetSize);
[result.image drawInRect:(CGRect){.origin = CGPointZero, .size = processingTargetSize}];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
return image;
}
completion:^(PINRemoteImageManagerResult * _Nonnull result) {

XCTAssert(result.error == nil, @"GIF download with processor should not fail.");

XCTAssert(result.image != nil, @"Expect processed (still) GIF image.");
XCTAssert(result.alternativeRepresentation == nil, @"AlternativeRepresentation should not available after processing.");

XCTAssert(CGSizeEqualToSize(result.image.size, processingTargetSize), @"Expect correct GIF processing output.");

[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:[self timeoutTimeInterval] handler:nil];
}

- (void)testInitWithNilConfiguration
{
self.imageManager = [[PINRemoteImageManager alloc] initWithSessionConfiguration:nil];
Expand Down