mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-24 03:45:58 +08:00
Add snapshot test for ASBackgroundLayoutSpec (#2131)
This commit is contained in:
committed by
Adlai Holler
parent
e3091737ca
commit
47d84aa7fe
42
AsyncDisplayKitTests/ASBackgroundLayoutSpecSnapshotTests.mm
Normal file
42
AsyncDisplayKitTests/ASBackgroundLayoutSpecSnapshotTests.mm
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// ASOverlayLayoutSpecSnapshotTests.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 "ASBackgroundLayoutSpec.h"
|
||||
#import "ASCenterLayoutSpec.h"
|
||||
|
||||
static const ASSizeRange kSize = {{320, 320}, {320, 320}};
|
||||
|
||||
@interface ASBackgroundLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase
|
||||
|
||||
@end
|
||||
|
||||
@implementation ASBackgroundLayoutSpecSnapshotTests
|
||||
|
||||
- (void)testBackground
|
||||
{
|
||||
ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor blueColor]);
|
||||
ASStaticSizeDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor blackColor]);
|
||||
foregroundNode.staticSize = {20, 20};
|
||||
|
||||
ASLayoutSpec *layoutSpec =
|
||||
[ASBackgroundLayoutSpec
|
||||
backgroundLayoutSpecWithChild:
|
||||
[ASCenterLayoutSpec
|
||||
centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY
|
||||
sizingOptions:{}
|
||||
child:foregroundNode]
|
||||
background:backgroundNode];
|
||||
|
||||
[self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier: nil];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user