mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-13 07:39:37 +00:00
* Drop support for iOS 7 * Copy reference images * Update deployment for sample projects * Update version * Update "Life Without Cocoapods"
61 lines
2.0 KiB
Plaintext
61 lines
2.0 KiB
Plaintext
//
|
|
// ASWrapperSpecSnapshotTests.mm
|
|
// AsyncDisplayKit
|
|
//
|
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
|
|
|
|
#import "ASLayoutSpecSnapshotTestsHelper.h"
|
|
#import <AsyncDisplayKit/ASBackgroundLayoutSpec.h>
|
|
|
|
@interface ASWrapperSpecSnapshotTests : ASLayoutSpecSnapshotTestCase
|
|
@end
|
|
|
|
@implementation ASWrapperSpecSnapshotTests
|
|
|
|
- (void)setUp
|
|
{
|
|
[super setUp];
|
|
|
|
self.recordMode = NO;
|
|
}
|
|
|
|
- (void)testWrapperSpecWithOneElementShouldSizeToElement
|
|
{
|
|
ASDisplayNode *child = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50});
|
|
|
|
ASSizeRange sizeRange = ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY));
|
|
[self testWithChildren:@[child] sizeRange:sizeRange identifier:nil];
|
|
}
|
|
|
|
- (void)testWrapperSpecWithMultipleElementsShouldSizeToLargestElement
|
|
{
|
|
ASDisplayNode *firstChild = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50});
|
|
ASDisplayNode *secondChild = ASDisplayNodeWithBackgroundColor([UIColor greenColor], {100, 100});
|
|
|
|
ASSizeRange sizeRange = ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY));
|
|
[self testWithChildren:@[secondChild, firstChild] sizeRange:sizeRange identifier:nil];
|
|
}
|
|
|
|
- (void)testWithChildren:(NSArray *)children sizeRange:(ASSizeRange)sizeRange identifier:(NSString *)identifier
|
|
{
|
|
ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor whiteColor]);
|
|
|
|
NSMutableArray *subnodes = [NSMutableArray arrayWithArray:children];
|
|
[subnodes insertObject:backgroundNode atIndex:0];
|
|
|
|
ASLayoutSpec *layoutSpec =
|
|
[ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:
|
|
[ASWrapperLayoutSpec
|
|
wrapperWithLayoutElements:children]
|
|
background:backgroundNode];
|
|
|
|
[self testLayoutSpec:layoutSpec sizeRange:sizeRange subnodes:subnodes identifier:identifier];
|
|
}
|
|
|
|
@end
|