Update test case `test27ThatEncodeWithFramesWorks`

This commit is contained in:
DreamPiggy 2023-07-26 23:00:02 +08:00
parent 1f4292ec82
commit 480f3b5158
2 changed files with 9 additions and 1 deletions

View File

@ -32,7 +32,7 @@
#if SD_MAC
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];
// Check weak assigned frames firstly
// Check weak animated data firstly
if ([imageRep isKindOfClass:[SDAnimatedImageRep class]]) {
SDAnimatedImageRep *animatedImageRep = (SDAnimatedImageRep *)imageRep;
NSData *imageData = [animatedImageRep animatedImageData];

View File

@ -446,6 +446,14 @@
UIImage *animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames];
NSData *data = [SDImageGIFCoder.sharedCoder encodedDataWithImage:animatedImage format:SDImageFormatGIF options:nil];
expect(data).notTo.beNil();
#if SD_MAC
// Test implementation use SDAnimatedImageRep
SDAnimatedImageRep *rep = (SDAnimatedImageRep *)animatedImage.representations.firstObject;
expect([rep isKindOfClass:SDAnimatedImageRep.class]);
expect(rep.animatedImageData).equal(data);
expect(rep.animatedImageFormat).equal(SDImageFormatGIF);
#endif
// Test new API
NSData *data2 = [SDImageGIFCoder.sharedCoder encodedDataWithFrames:frames loopCount:0 format:SDImageFormatGIF options:nil];