Simplified and improved video node's handling of state changes:

- Simplified visibility state change handling.
- Placeholder image is now updated after switching assets.
- Improves memory usage by clearing the placeholder image in clearFetchedData.
This commit is contained in:
Eric Jensen
2016-04-18 16:20:47 -07:00
parent 33e36de5dc
commit e65d63a502
2 changed files with 174 additions and 170 deletions

View File

@@ -362,4 +362,31 @@
XCTAssertNotEqual(_videoNode, firstButton.supernode);
}
- (void)testChangingAssetsChangesPlaceholderImage
{
UIImage *firstImage = [[UIImage alloc] init];
_videoNode.asset = _firstAsset;
[_videoNode setPlaceholderImage:firstImage];
XCTAssertEqual(firstImage, _videoNode.placeholderImageNode.image);
_videoNode.asset = _secondAsset;
XCTAssertNotEqual(firstImage, _videoNode.placeholderImageNode.image);
}
- (void)testClearingFetchedContentShouldClearAssetData
{
_videoNode.asset = _firstAsset;
[_videoNode fetchData];
[_videoNode setPlaceholderImage:[[UIImage alloc] init]];
XCTAssertNotNil(_videoNode.player);
XCTAssertNotNil(_videoNode.currentItem);
XCTAssertNotNil(_videoNode.placeholderImageNode.image);
[_videoNode clearFetchedData];
XCTAssertNil(_videoNode.player);
XCTAssertNil(_videoNode.currentItem);
XCTAssertNil(_videoNode.placeholderImageNode.image);
}
@end