mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-23 11:27:56 +08:00
[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:
committed by
Adlai Holler
parent
8897614f0e
commit
0aeefaf25f
@@ -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
|
||||
{
|
||||
|
||||
@@ -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))];
|
||||
|
||||
Reference in New Issue
Block a user