File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,23 @@ -(void)testCalcICCColorSpaceFromAVIFImage
252
252
avifImageDestroy (img);
253
253
}
254
254
255
+ -(void )testEncodingAndDecoding
256
+ {
257
+ CGSize size = CGSizeMake (100 , 100 );
258
+ UIGraphicsBeginImageContextWithOptions (size, YES , 0 );
259
+ [[UIColor redColor ] setFill ];
260
+ UIRectFill (CGRectMake (0 , 0 , size.width , size.height ));
261
+ UIImage *image = UIGraphicsGetImageFromCurrentImageContext ();
262
+ UIGraphicsEndImageContext ();
263
+ NSData * encoded = [self ->coder encodedDataWithImage: image format: SDImageFormatAVIF options: nil ];
264
+ image = nil ;
265
+
266
+ XCTAssertTrue ([self ->coder canDecodeFromData: encoded]);
267
+
268
+ image = [self ->coder decodedImageWithData: encoded options: nil ];
269
+ [self assertColor8: @" <in-memory>" img: image.CGImage expectedColor: kRed8 ];
270
+ }
271
+
255
272
-(void )assertColor8 : (NSString *)filename img : (CGImageRef)img expectedColor : (UInt8*)expectedColor
256
273
{
257
274
CFDataRef rawData = CGDataProviderCopyData (CGImageGetDataProvider (img));
You can’t perform that action at this time.
0 commit comments