Add test case to ensure the `SDImageIOAnimatedCoder` abstract class can not be used as normal coder

This commit is contained in:
DreamPiggy 2019-09-19 16:43:33 +08:00
parent 2aa4e7d8a7
commit fb6819add0
1 changed files with 18 additions and 0 deletions

View File

@ -177,4 +177,22 @@
}
}
- (void)test16ThatImageIOAnimatedCoderAbstractClass {
SDImageIOAnimatedCoder *coder = [[SDImageIOAnimatedCoder alloc] init];
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"png"];
NSData *testImageData = [NSData dataWithContentsOfFile:testImagePath];
@try {
[coder canEncodeToFormat:SDImageFormatPNG];
XCTFail("Should throw exception");
} @catch (NSException *exception) {
expect(exception);
}
@try {
[coder decodedImageWithData:testImageData options:nil];
XCTFail("Should throw exception");
} @catch (NSException *exception) {
expect(exception);
}
}
@end