[Layout] Automatic measurement on layout fixes (#2206)

* Don't measure range managed nodes automatically in the layout pass

* Fix auto measure a node mid transition
This commit is contained in:
Michael Schneider
2016-09-07 21:46:05 +02:00
committed by Adlai Holler
parent 8897614f0e
commit 0aeefaf25f
3 changed files with 13 additions and 27 deletions

View File

@@ -44,31 +44,6 @@
ASXCTAssertEqualSizes(buttonNode.calculatedSize, nodeSize, @"Automatic measurement pass should have happened in layout pass");
}
- (void)testMeasureOnLayoutIfNotHappenedBeforeForRangeManagedNodes
{
CGSize nodeSize = CGSizeMake(100, 100);
ASDisplayNode *displayNode = [ASDisplayNode new];
[displayNode setSizeWithCGSize:nodeSize];
ASButtonNode *buttonNode = [ASButtonNode new];
[displayNode addSubnode:buttonNode];
[displayNode enterHierarchyState:ASHierarchyStateRangeManaged];
displayNode.frame = {.size = nodeSize};
buttonNode.frame = {.size = nodeSize};
ASXCTAssertEqualSizes(displayNode.calculatedSize, CGSizeZero, @"Calculated size before measurement and layout should be 0");
ASXCTAssertEqualSizes(buttonNode.calculatedSize, CGSizeZero, @"Calculated size before measurement and layout should be 0");
// Trigger layout pass without a maeasurment pass before
[displayNode.view layoutIfNeeded];
ASXCTAssertEqualSizes(displayNode.calculatedSize, nodeSize, @"Automatic measurement pass should have happened in layout pass");
ASXCTAssertEqualSizes(buttonNode.calculatedSize, nodeSize, @"Automatic measurement pass should have happened in layout pass");
}
#if DEBUG
- (void)testNotAllowAddingSubnodesInLayoutSpecThatFits
{

View File

@@ -1988,7 +1988,7 @@ static bool stringContainsPointer(NSString *description, id p) {
// FIXME
// Supernode is measured, subnode isnt, transition starts, UIKit does a layout pass before measurement finishes
- (void)DISABLED_testThatItsSafeToAutomeasureANodeMidTransition
- (void)testThatItsSafeToAutomeasureANodeMidTransition
{
ASDisplayNode *supernode = [[ASDisplayNode alloc] init];
[supernode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))];