Fix some tests

This commit is contained in:
Michael Schneider
2016-11-14 14:28:40 -08:00
parent 5d84f21fda
commit 8f079bd1ca
10 changed files with 85 additions and 33 deletions

View File

@@ -9,6 +9,8 @@
//
#import "ASDisplayNodeTestsHelper.h"
#import "ASDisplayNode.h"
#import "ASLayout.h"
#import <QuartzCore/QuartzCore.h>
@@ -41,3 +43,12 @@ BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block)
}
return passed;
}
void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size) {
CGSize sizeThatFits = [node sizeThatFits:size];
node.bounds = (CGRect){.origin = CGPointZero, .size = sizeThatFits};
}
void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange) {
CGSize sizeThatFits = [node layoutThatFits:sizeRange].size;
node.bounds = (CGRect){.origin = CGPointZero, .size = sizeThatFits};
}