forked from TextureGroup/Texture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASDisplayNodeSnapshotTests.m
36 lines (27 loc) · 1.03 KB
/
ASDisplayNodeSnapshotTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// ASDisplayNodeSnapshotTests.m
// Texture
//
// Created by Adlai Holler on 8/16/16.
// Copyright © 2016 Facebook. All rights reserved.
//
#import "ASSnapshotTestCase.h"
#import <AsyncDisplayKit/AsyncDisplayKit.h>
@interface ASDisplayNodeSnapshotTests : ASSnapshotTestCase
@end
@implementation ASDisplayNodeSnapshotTests
- (void)testBasicHierarchySnapshotTesting
{
ASDisplayNode *node = [[ASDisplayNode alloc] init];
node.backgroundColor = [UIColor blueColor];
ASTextNode *subnode = [[ASTextNode alloc] init];
subnode.backgroundColor = [UIColor whiteColor];
subnode.attributedText = [[NSAttributedString alloc] initWithString:@"Hello"];
node.automaticallyManagesSubnodes = YES;
node.layoutSpecBlock = ^(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) {
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(5, 5, 5, 5) child:subnode];
};
ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY)));
ASSnapshotVerifyNode(node, nil);
}
@end