Fix the test case test26AnimatedImageStopAnimatingClearBuffer

This commit is contained in:
DreamPiggy 2023-04-26 14:39:48 +08:00
parent 858b64aef7
commit ef69460dc7
3 changed files with 7 additions and 14 deletions

View File

@ -17,7 +17,7 @@
NSRunLoopMode _runLoopMode;
}
@property (atomic, strong) SDImageFramePool *framePool;
@property (nonatomic, strong) SDImageFramePool *framePool;
@property (nonatomic, strong, readwrite) UIImage *currentFrame;
@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex;
@ -339,7 +339,6 @@
maxBufferCount = 1;
}
printf("current maxBufferCount: %lu\n", (unsigned long)maxBufferCount);
self.framePool.maxBufferCount = maxBufferCount;
}

View File

@ -146,11 +146,4 @@
}
}
- (NSMutableDictionary<NSNumber *,UIImage *> *)frameBuffer {
if (!_frameBuffer) {
_frameBuffer = [NSMutableDictionary dictionary];
}
return _frameBuffer;
}
@end

View File

@ -9,6 +9,7 @@
#import "SDTestCase.h"
#import "SDInternalMacros.h"
#import "SDImageFramePool.h"
#import <KVOController/KVOController.h>
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
@ -59,7 +60,7 @@ static BOOL _isCalled;
@interface SDAnimatedImagePlayer ()
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, UIImage *> *frameBuffer;
@property (nonatomic, strong) SDImageFramePool *framePool;
@end
@ -382,7 +383,7 @@ static BOOL _isCalled;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 0.5s is not finished, frame index should not be 0
expect(imageView.player.frameBuffer.count).beGreaterThan(0);
expect(imageView.player.framePool.currentFrameCount).beGreaterThan(0);
expect(imageView.currentFrameIndex).beGreaterThan(0);
});
@ -392,7 +393,7 @@ static BOOL _isCalled;
#else
imageView.animates = NO;
#endif
expect(imageView.player.frameBuffer.count).beGreaterThan(0);
expect(imageView.player.framePool.currentFrameCount).beGreaterThan(0);
expect(imageView.currentFrameIndex).beGreaterThan(0);
[imageView removeFromSuperview];
@ -420,7 +421,7 @@ static BOOL _isCalled;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 0.5s is not finished, frame index should not be 0
expect(imageView.player.frameBuffer.count).beGreaterThan(0);
expect(imageView.player.framePool.currentFrameCount).beGreaterThan(0);
expect(imageView.currentFrameIndex).beGreaterThan(0);
});
@ -430,7 +431,7 @@ static BOOL _isCalled;
#else
imageView.animates = NO;
#endif
expect(imageView.player.frameBuffer.count).equal(0);
expect(imageView.player.framePool.currentFrameCount).equal(0);
[imageView removeFromSuperview];
[expectation fulfill];