mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-03-29 08:39:00 +08:00
Add test for layout transition measurement completion block is called on main thread (#2162)
This commit is contained in:
committed by
Adlai Holler
parent
bab601460e
commit
cf08f3a73e
@@ -117,6 +117,23 @@
|
||||
XCTAssertEqual(node.subnodes[2], node2);
|
||||
}
|
||||
|
||||
- (void)testLayoutTransitionMeasurementCompletionBlockIsCalledOnMainThread
|
||||
{
|
||||
ASDisplayNode *displayNode = [ASDisplayNode new];
|
||||
|
||||
// Trigger explicit view creation to be able to use the Transition API
|
||||
[displayNode view];
|
||||
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:@"Call measurement completion block on main"];
|
||||
|
||||
[displayNode transitionLayoutWithSizeRange:ASSizeRangeMake(CGSizeZero, CGSizeZero) animated:YES measurementCompletion:^{
|
||||
XCTAssertTrue(ASDisplayNodeThreadIsMain(), @"Measurement completion block should be called on main thread");
|
||||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:2.0 handler:nil];
|
||||
}
|
||||
|
||||
- (void)testMeasurementInBackgroundThreadWithLoadedNode
|
||||
{
|
||||
ASDisplayNode *node1 = [[ASDisplayNode alloc] init];
|
||||
|
||||
Reference in New Issue
Block a user