Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vovasty committed Oct 3, 2019
1 parent 4e3fe9f commit 2b16d6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Tests/ASDisplayNodeAppearanceTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ - (void)checkAppearanceMethodsCalledWithRootNodeInWindowLayerBacked:(BOOL)isLaye
{
// ASDisplayNode visibility does not change if modifying a hierarchy that is not in a window. So create one and add the superview to it.
UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero];
[window makeKeyAndVisible];

DeclareNodeNamed(n);
DeclareViewNamed(superview);
Expand Down Expand Up @@ -154,6 +155,7 @@ - (void)checkManualAppearanceViewLoaded:(BOOL)isViewLoaded layerBacked:(BOOL)isL
{
// ASDisplayNode visibility does not change if modifying a hierarchy that is not in a window. So create one and add the superview to it.
UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero];
[window makeKeyAndVisible];

DeclareNodeNamed(parent);
DeclareNodeNamed(a);
Expand Down Expand Up @@ -253,6 +255,7 @@ - (void)testSynchronousIntermediaryView
layerBackedNode.layerBacked = YES;

UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero];
[window makeKeyAndVisible];
[parentSynchronousNode addSubnode:layerBackedNode];
[parentSynchronousNode addSubnode:viewBackedNode];

Expand Down Expand Up @@ -291,6 +294,7 @@ - (void)testSynchronousIntermediaryView
- (void)checkMoveAcrossHierarchyLayerBacked:(BOOL)isLayerBacked useManualCalls:(BOOL)useManualDisable useNodeAPI:(BOOL)useNodeAPI
{
UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero];
[window makeKeyAndVisible];

DeclareNodeNamed(parentA);
DeclareNodeNamed(parentB);
Expand Down Expand Up @@ -374,6 +378,8 @@ - (void)checkMoveAcrossHierarchyLayerBacked:(BOOL)isLayerBacked useManualCalls:(
// Make sure that we don't leave these unbalanced
XCTAssertFalse([child __visibilityNotificationsDisabled], @"Unbalanced visibility notifications calls");
XCTAssertFalse([child __selfOrParentHasVisibilityNotificationsDisabled], @"Should not have re-enabled yet");
[parentA removeFromSupernode];
[parentB removeFromSupernode];
}

- (void)testMoveAcrossHierarchyLayer
Expand Down
1 change: 1 addition & 0 deletions Tests/ASDisplayNodeTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,7 @@ - (void)testCornerRoundingTypeClippingRoundedCornersIsUsingASDisplayNodeCornerLa
- (void)testLayerActionForKeyIsCalled
{
UIWindow *window = [[UIWindow alloc] init];
[window makeKeyAndVisible];
ASDisplayNode *node = [[ASDisplayNode alloc] init];

id mockNode = OCMPartialMock(node);
Expand Down
2 changes: 1 addition & 1 deletion Tests/ASViewControllerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ - (void)testThatAutomaticSubnodeManagementScrollViewInsetsAreApplied
[window makeKeyAndVisible];
[window layoutIfNeeded];
XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(node.frame));
XCTAssertNotEqual(scrollNode.view.contentInset.top, 0);
XCTAssertEqual(scrollNode.view.contentInset.top, 0.0f);
}

- (void)testThatViewControllerFrameIsRightAfterCustomTransitionWithNonextendedEdges
Expand Down

0 comments on commit 2b16d6e

Please sign in to comment.