More updates

This commit is contained in:
Adlai Holler 2015-09-16 15:34:24 -07:00
parent 814f72535c
commit 262d65eea9
4 changed files with 4 additions and 22 deletions

View File

@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
* *
* @returns A transformed image. * @returns A transformed image.
*/ */
typedef UIImage *(^asimagenode_modification_block_t)(UIImage *image); typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
/** /**
@ -86,7 +86,7 @@ typedef UIImage *(^asimagenode_modification_block_t)(UIImage *image);
* @discussion Can be used to add image effects (such as rounding, adding * @discussion Can be used to add image effects (such as rounding, adding
* borders, or other pattern overlays) without extraneous display calls. * borders, or other pattern overlays) without extraneous display calls.
*/ */
@property (nonatomic, readwrite, copy) asimagenode_modification_block_t imageModificationBlock; @property (nullable, nonatomic, readwrite, copy) asimagenode_modification_block_t imageModificationBlock;
/** /**
* @abstract Marks the receiver as needing display and performs a block after * @abstract Marks the receiver as needing display and performs a block after

View File

@ -50,7 +50,7 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) {
* @discussion If `cache` is nil, the receiver will not attempt to retrieve images from a cache before downloading them. * @discussion If `cache` is nil, the receiver will not attempt to retrieve images from a cache before downloading them.
* @returns An initialized ASMultiplexImageNode. * @returns An initialized ASMultiplexImageNode.
*/ */
- (instancetype)initWithCache:(id<ASImageCacheProtocol>)cache downloader:(id<ASImageDownloaderProtocol>)downloader NS_DESIGNATED_INITIALIZER; - (instancetype)initWithCache:(nullable id<ASImageCacheProtocol>)cache downloader:(nullable id<ASImageDownloaderProtocol>)downloader NS_DESIGNATED_INITIALIZER;
/** /**
* @abstract The delegate, which must conform to the <ASMultiplexImageNodeDelegate> protocol. * @abstract The delegate, which must conform to the <ASMultiplexImageNodeDelegate> protocol.

View File

@ -1042,7 +1042,6 @@ static inline BOOL _CGPointEqualToPointWithEpsilon(CGPoint point1, CGPoint point
- (void)testSubnodes - (void)testSubnodes
{ {
ASDisplayNode *parent = [[ASDisplayNode alloc] init]; ASDisplayNode *parent = [[ASDisplayNode alloc] init];
XCTAssertNoThrow([parent addSubnode:nil], @"Don't try to add nil, but we'll deal.");
XCTAssertNoThrow([parent addSubnode:parent], @"Not good, test that we recover"); XCTAssertNoThrow([parent addSubnode:parent], @"Not good, test that we recover");
XCTAssertEqual(0u, parent.subnodes.count, @"We shouldn't have any subnodes"); XCTAssertEqual(0u, parent.subnodes.count, @"We shouldn't have any subnodes");
} }
@ -1456,15 +1455,9 @@ static inline BOOL _CGPointEqualToPointWithEpsilon(CGPoint point1, CGPoint point
XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Incorrect insertion below"); XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Incorrect insertion below");
XCTAssertNodesHaveParent(parent, a, b, c); XCTAssertNodesHaveParent(parent, a, b, c);
// Check insertSubnode with no below
XCTAssertThrows([parent insertSubnode:b belowSubnode:nil], @"Can't insert below a nil");
// Check nothing was inserted // Check nothing was inserted
XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Incorrect insertion below"); XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Incorrect insertion below");
XCTAssertThrows([parent insertSubnode:nil belowSubnode:nil], @"Can't insert a nil subnode");
XCTAssertThrows([parent insertSubnode:nil belowSubnode:a], @"Can't insert a nil subnode");
// Check inserting below when you're already in the array // Check inserting below when you're already in the array
// (c,a,b) => (a,c,b) // (c,a,b) => (a,c,b)
[parent insertSubnode:c belowSubnode:b]; [parent insertSubnode:c belowSubnode:b];
@ -1535,17 +1528,6 @@ static inline BOOL _CGPointEqualToPointWithEpsilon(CGPoint point1, CGPoint point
[parent insertSubnode:c aboveSubnode:a]; [parent insertSubnode:c aboveSubnode:a];
XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"After insert c above a"); XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"After insert c above a");
// Check insertSubnode with invalid parameters throws and doesn't change anything
// (a,c,b) => (a,c,b)
XCTAssertThrows([parent insertSubnode:b aboveSubnode:nil], @"Can't insert below a nil");
XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business");
XCTAssertThrows([parent insertSubnode:nil aboveSubnode:nil], @"Can't insert a nil subnode");
XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business");
XCTAssertThrows([parent insertSubnode:nil aboveSubnode:a], @"Can't insert a nil subnode");
XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business");
// Check inserting above when you're already in the array // Check inserting above when you're already in the array
// (a,c,b) => (c,b,a) // (a,c,b) => (c,b,a)
[parent insertSubnode:a aboveSubnode:b]; [parent insertSubnode:a aboveSubnode:b];

View File

@ -57,7 +57,7 @@
layout.position = CGPointZero; layout.position = CGPointZero;
layout = [ASLayout layoutWithLayoutableObject:self size:layout.size sublayouts:@[layout]]; layout = [ASLayout layoutWithLayoutableObject:self size:layout.size sublayouts:@[layout]];
_layoutUnderTest = [layout flattenedLayoutUsingPredicateBlock:^BOOL(ASLayout *evaluatedLayout) { _layoutUnderTest = [layout flattenedLayoutUsingPredicateBlock:^BOOL(ASLayout *evaluatedLayout) {
return [self.subnodes containsObject:evaluatedLayout.layoutableObject]; return [self.subnodes containsObject:(ASDisplayNode *)evaluatedLayout.layoutableObject];
}]; }];
self.frame = CGRectMake(0, 0, _layoutUnderTest.size.width, _layoutUnderTest.size.height); self.frame = CGRectMake(0, 0, _layoutUnderTest.size.width, _layoutUnderTest.size.height);
[self measure:_layoutUnderTest.size]; [self measure:_layoutUnderTest.size];