File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,6 +252,23 @@ -(void)testCalcICCColorSpaceFromAVIFImage
252252 avifImageDestroy (img);
253253}
254254
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+
255272-(void )assertColor8 : (NSString *)filename img : (CGImageRef)img expectedColor : (UInt8*)expectedColor
256273{
257274 CFDataRef rawData = CGDataProviderCopyData (CGImageGetDataProvider (img));
You can’t perform that action at this time.
0 commit comments