Swiftgram/AsyncDisplayKitTests/ASDisplayNodeLayoutTests.mm
2016-08-27 17:36:08 -07:00

38 lines
1.3 KiB
Plaintext

//
// ASDisplayNodeLayoutTests.m
// 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 "ASXCTExtensions.h"
#import <AsyncDisplayKit/AsyncDisplayKit.h>
#import "ASLayoutSpecSnapshotTestsHelper.h"
#import "ASDisplayNode+FrameworkPrivate.h"
@interface ASDisplayNodeLayoutTests : XCTestCase
@end
@implementation ASDisplayNodeLayoutTests
- (void)testMeasurePassOnLayoutIfNotHappenedBefore
{
ASStaticSizeDisplayNode *displayNode = [ASStaticSizeDisplayNode new];
displayNode.staticSize = CGSizeMake(100, 100);
displayNode.frame = CGRectMake(0, 0, 100, 100);
ASXCTAssertEqualSizes(displayNode.calculatedSize, CGSizeZero, @"Calculated size before measurement and layout should be 0");
// Trigger view creation and layout pass without a manual measure: call before so the automatic measurement
// pass will trigger in the layout pass
[displayNode.view layoutIfNeeded];
ASXCTAssertEqualSizes(displayNode.calculatedSize, CGSizeMake(100, 100), @"Automatic measurement pass should be happened in layout");
}
@end