Add unit tests for the layout engine (#424)

* Build testing platform & tests for the layout engine

* Add our license header to debugbreak.

* Remove thing

* Address review comments

* Beef up the logging

* Update -[ASLayout isEqual:]

* testLayoutTransitionWithAsyncMeasurement passes now

* Disable testASetNeedsLayoutInterferingWithTheCurrentTransition

* Fix build errors
This commit is contained in:
Adlai Holler
2017-12-01 09:05:47 -08:00
committed by Huy Nguyen
parent bccde6cf0f
commit 0dc7002f0b
16 changed files with 1176 additions and 8 deletions

View File

@@ -99,6 +99,29 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyState(ASHierarchyStat
return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]];
}
#define HIERARCHY_STATE_DELTA(Name) ({ \
if ((oldState & ASHierarchyState##Name) != (newState & ASHierarchyState##Name)) { \
[changes appendFormat:@"%c%s ", (newState & ASHierarchyState##Name ? '+' : '-'), #Name]; \
} \
})
__unused static NSString * _Nonnull NSStringFromASHierarchyStateChange(ASHierarchyState oldState, ASHierarchyState newState)
{
if (oldState == newState) {
return @"{ }";
}
NSMutableString *changes = [NSMutableString stringWithString:@"{ "];
HIERARCHY_STATE_DELTA(Rasterized);
HIERARCHY_STATE_DELTA(RangeManaged);
HIERARCHY_STATE_DELTA(TransitioningSupernodes);
HIERARCHY_STATE_DELTA(LayoutPending);
[changes appendString:@"}"];
return changes;
}
#undef HIERARCHY_STATE_DELTA
@interface ASDisplayNode () <ASDescriptionProvider, ASDebugDescriptionProvider>
{
@protected