File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1010@import XCTest;
1111#import < SDWebImage/SDWebImage.h>
1212#import < SDWebImageWebPCoder/SDWebImageWebPCoder.h>
13+ #import < objc/runtime.h>
1314
1415const int64_t kAsyncTestTimeout = 5 ;
1516
@@ -172,6 +173,18 @@ - (void)test33AnimatedImageBlendMethod {
172173 }
173174}
174175
176+ - (void )test34StaticImageNotCreateCGContext {
177+ NSURL *staticWebPURL = [[NSBundle bundleForClass: [self class ]] URLForResource: @" TestImageStatic" withExtension: @" webp" ];
178+ NSData *data = [NSData dataWithContentsOfURL: staticWebPURL];
179+ SDImageWebPCoder *coder = [[SDImageWebPCoder alloc ] initWithAnimatedImageData: data options: nil ];
180+ XCTAssertTrue (coder.animatedImageFrameCount == 1 );
181+ UIImage *image = [coder animatedImageFrameAtIndex: 0 ];
182+ XCTAssertNotNil (image);
183+ Ivar ivar = class_getInstanceVariable (coder.class , " _canvas" );
184+ CGContextRef canvas = ((CGContextRef (*)(id , Ivar ))object_getIvar )(coder, ivar);
185+ XCTAssert (canvas == NULL );
186+ }
187+
175188@end
176189
177190@implementation SDWebImageWebPCoderTests (Helpers)
You can’t perform that action at this time.
0 commit comments