Add one test case for this behavior: `test14AnimatedImageViewStopPlayingWhenHidden`

This commit is contained in:
DreamPiggy 2019-11-09 13:48:27 +08:00
parent 29027a693a
commit 983dd59e4f
1 changed files with 22 additions and 1 deletions

View File

@ -177,6 +177,27 @@ static const NSUInteger kTestGIFFrameCount = 5; // local TestImage.gif loop coun
expect(imageView.image).equal(image);
}
- (void)test14AnimatedImageViewStopPlayingWhenHidden {
SDAnimatedImageView *imageView = [SDAnimatedImageView new];
#if SD_UIKIT
[self.window addSubview:imageView];
#else
[self.window.contentView addSubview:imageView];
#endif
SDAnimatedImage *image = [SDAnimatedImage imageWithData:[self testGIFData]];
imageView.image = image;
#if SD_UIKIT
[imageView startAnimating];
#else
imageView.animates = YES;
#endif
SDAnimatedImagePlayer *player = imageView.player;
expect(player).notTo.beNil();
expect(player.isPlaying).beTruthy();
imageView.hidden = YES;
expect(player.isPlaying).beFalsy();
}
- (void)test20AnimatedImageViewRendering {
XCTestExpectation *expectation = [self expectationWithDescription:@"test SDAnimatedImageView rendering"];
SDAnimatedImageView *imageView = [[SDAnimatedImageView alloc] init];
@ -338,7 +359,7 @@ static const NSUInteger kTestGIFFrameCount = 5; // local TestImage.gif loop coun
[self waitForExpectationsWithCommonTimeout];
}
- (void)test25AnimatedImageStopAnimatingClearBuffer {
- (void)test26AnimatedImageStopAnimatingClearBuffer {
XCTestExpectation *expectation = [self expectationWithDescription:@"test SDAnimatedImageView stopAnimating clear buffer when stopped"];
SDAnimatedImageView *imageView = [SDAnimatedImageView new];