diff --git a/SDWebImageWebPCoderTests/SDWebImageWebPCoderTests.m b/SDWebImageWebPCoderTests/SDWebImageWebPCoderTests.m index f895071..d046396 100644 --- a/SDWebImageWebPCoderTests/SDWebImageWebPCoderTests.m +++ b/SDWebImageWebPCoderTests/SDWebImageWebPCoderTests.m @@ -10,6 +10,7 @@ @import XCTest; #import #import +#import const int64_t kAsyncTestTimeout = 5; @@ -172,6 +173,18 @@ const int64_t kAsyncTestTimeout = 5; } } +- (void)test34StaticImageNotCreateCGContext { + NSURL *staticWebPURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageStatic" withExtension:@"webp"]; + NSData *data = [NSData dataWithContentsOfURL:staticWebPURL]; + SDImageWebPCoder *coder = [[SDImageWebPCoder alloc] initWithAnimatedImageData:data options:nil]; + XCTAssertTrue(coder.animatedImageFrameCount == 1); + UIImage *image = [coder animatedImageFrameAtIndex:0]; + XCTAssertNotNil(image); + Ivar ivar = class_getInstanceVariable(coder.class, "_canvas"); + CGContextRef canvas = ((CGContextRef (*)(id, Ivar))object_getIvar)(coder, ivar); + XCTAssert(canvas == NULL); +} + @end @implementation SDWebImageWebPCoderTests (Helpers)