mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 03:09:56 +00:00
* Clean up snapshot test cases: - Drop 32bit snapshots - Update iOS 9 snapshots and move some others to the correct directory - Remove `setUp` overrides in subclasses of `ASLayoutSpecSnapshotTestCase` that set `recordMode` flag. Doing so in multiple places make it difficult to enable/dis able the flag for all layout spec test cases. It can always be overridden locally if need to. - Fix BUCK build * Fix testThatOnDidLoadThrowsIfCalledOnLoadedOffMain of ASDisplayNodeTests
54 lines
1.9 KiB
Plaintext
54 lines
1.9 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)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
|