mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-03 11:44:46 +00:00
wip fixing pr comments
This commit is contained in:
@@ -16,11 +16,17 @@
|
||||
@interface ASVideoNode ()
|
||||
@property (atomic, readonly) AVPlayerItem *currentItem;
|
||||
@property (atomic) ASInterfaceState interfaceState;
|
||||
@property (atomic) ASDisplayNode *spinner;
|
||||
@end
|
||||
|
||||
@interface AVPlayerItem ()
|
||||
@property (nonatomic) AVPlayerItemStatus status;
|
||||
@end
|
||||
|
||||
@implementation ASVideoNodeTests
|
||||
|
||||
- (void)testVideoNodeReplacesAVPlayerItemWhenNewURLIsSet {
|
||||
- (void)testVideoNodeReplacesAVPlayerItemWhenNewURLIsSet
|
||||
{
|
||||
ASVideoNode *videoNode = [[ASVideoNode alloc] init];
|
||||
videoNode.interfaceState = ASInterfaceStateFetchData;
|
||||
videoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"firstURL"]];
|
||||
@@ -33,7 +39,8 @@
|
||||
XCTAssertNotEqualObjects(item, secondItem);
|
||||
}
|
||||
|
||||
- (void)testVideoNodeDoesNotReplaceAVPlayerItemWhenSameURLIsSet {
|
||||
- (void)testVideoNodeDoesNotReplaceAVPlayerItemWhenSameURLIsSet
|
||||
{
|
||||
ASVideoNode *videoNode = [[ASVideoNode alloc] init];
|
||||
videoNode.interfaceState = ASInterfaceStateFetchData;
|
||||
AVAsset *asset = [AVAsset assetWithURL:[NSURL URLWithString:@"firstURL"]];
|
||||
@@ -47,4 +54,57 @@
|
||||
XCTAssertEqualObjects(item, secondItem);
|
||||
}
|
||||
|
||||
//Touch Handling
|
||||
|
||||
- (void)testSpinnerDefaultsToNil
|
||||
{
|
||||
ASVideoNode *videoNode = [[ASVideoNode alloc] init];
|
||||
|
||||
XCTAssertNil(videoNode.spinner);
|
||||
}
|
||||
|
||||
- (void)testOnPlayIfVideoIsNotReadyInitializeSpinnerAndAddAsSubnode
|
||||
{
|
||||
ASVideoNode *videoNode = [[ASVideoNode alloc] init];
|
||||
videoNode.interfaceState = ASInterfaceStateFetchData;
|
||||
AVAsset *asset = [AVAsset assetWithURL:[NSURL URLWithString:@"firstURL"]];
|
||||
videoNode.asset = asset;
|
||||
|
||||
[videoNode play];
|
||||
|
||||
XCTAssertNotNil(videoNode.spinner);
|
||||
}
|
||||
|
||||
- (void)testOnPauseSpinnerIsPausedIfPresent
|
||||
{
|
||||
ASVideoNode *videoNode = [[ASVideoNode alloc] init];
|
||||
videoNode.interfaceState = ASInterfaceStateFetchData;
|
||||
AVAsset *asset = [AVAsset assetWithURL:[NSURL URLWithString:@"firstURL"]];
|
||||
videoNode.asset = asset;
|
||||
|
||||
[videoNode play];
|
||||
|
||||
[videoNode pause];
|
||||
|
||||
XCTAssertFalse(((UIActivityIndicatorView *)videoNode.spinner.view).isAnimating);
|
||||
}
|
||||
|
||||
- (void)testOnVideoReadySpinnerIsStoppedAndRemoved
|
||||
{
|
||||
ASVideoNode *videoNode = [[ASVideoNode alloc] init];
|
||||
videoNode.interfaceState = ASInterfaceStateFetchData;
|
||||
AVAsset *asset = [AVAsset assetWithURL:[NSURL URLWithString:@"firstURL"]];
|
||||
videoNode.asset = asset;
|
||||
|
||||
[videoNode play];
|
||||
[videoNode observeValueForKeyPath:@"status" ofObject:[videoNode currentItem] change:@{@"new" : @(AVPlayerItemStatusReadyToPlay)} context:NULL];
|
||||
|
||||
XCTAssertFalse(((UIActivityIndicatorView *)videoNode.spinner.view).isAnimating);
|
||||
}
|
||||
|
||||
- (void)testPlayButtonUserInteractionIsNotEnabled
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user