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 10
10
@import XCTest;
11
11
#import < SDWebImage/SDWebImage.h>
12
12
#import < SDWebImageWebPCoder/SDWebImageWebPCoder.h>
13
+ #import < objc/runtime.h>
13
14
14
15
const int64_t kAsyncTestTimeout = 5 ;
15
16
@@ -172,6 +173,18 @@ - (void)test33AnimatedImageBlendMethod {
172
173
}
173
174
}
174
175
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
+
175
188
@end
176
189
177
190
@implementation SDWebImageWebPCoderTests (Helpers)
You can’t perform that action at this time.
0 commit comments