mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-06 12:43:58 +00:00
Add ASDisplayNodeLayoutTests (#2157)
This commit is contained in:
parent
ff37535140
commit
d0c77d7965
@ -209,6 +209,7 @@
|
||||
697C0DE61CF38F28001DE0D4 /* ASLayoutValidation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 697C0DE21CF38F28001DE0D4 /* ASLayoutValidation.mm */; };
|
||||
698548641CA9E025008A345F /* ASEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 698548611CA9E025008A345F /* ASEnvironment.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
698C8B621CAB49FC0052DC3F /* ASLayoutableExtensibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
69B225671D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */; };
|
||||
69CB62AC1CB8165900024920 /* _ASDisplayViewAccessiblity.h in Headers */ = {isa = PBXBuildFile; fileRef = 69CB62A91CB8165900024920 /* _ASDisplayViewAccessiblity.h */; };
|
||||
69CB62AD1CB8165900024920 /* _ASDisplayViewAccessiblity.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69CB62AA1CB8165900024920 /* _ASDisplayViewAccessiblity.mm */; };
|
||||
69CB62AE1CB8165900024920 /* _ASDisplayViewAccessiblity.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69CB62AA1CB8165900024920 /* _ASDisplayViewAccessiblity.mm */; };
|
||||
@ -972,6 +973,8 @@
|
||||
697C0DE21CF38F28001DE0D4 /* ASLayoutValidation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASLayoutValidation.mm; path = AsyncDisplayKit/Layout/ASLayoutValidation.mm; sourceTree = "<group>"; };
|
||||
698548611CA9E025008A345F /* ASEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironment.h; sourceTree = "<group>"; };
|
||||
698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutableExtensibility.h; path = AsyncDisplayKit/Layout/ASLayoutableExtensibility.h; sourceTree = "<group>"; };
|
||||
69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayNodeLayoutTests.mm; sourceTree = "<group>"; };
|
||||
69B225681D7265DA00B25B22 /* ASXCTExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASXCTExtensions.h; sourceTree = "<group>"; };
|
||||
69CB62A91CB8165900024920 /* _ASDisplayViewAccessiblity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _ASDisplayViewAccessiblity.h; sourceTree = "<group>"; };
|
||||
69CB62AA1CB8165900024920 /* _ASDisplayViewAccessiblity.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _ASDisplayViewAccessiblity.mm; sourceTree = "<group>"; };
|
||||
69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironmentInternal.h; sourceTree = "<group>"; };
|
||||
@ -1335,6 +1338,7 @@
|
||||
058D09C5195D04C000B7D73C /* AsyncDisplayKitTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
69B225681D7265DA00B25B22 /* ASXCTExtensions.h */,
|
||||
CC54A81D1D7008B300296A24 /* ASDispatchTests.m */,
|
||||
CCA221D21D6FA7EF00AF6A0F /* ASViewControllerTests.m */,
|
||||
CC0AEEA31D66316E005D1C78 /* ASUICollectionViewTests.m */,
|
||||
@ -1369,6 +1373,7 @@
|
||||
058D0A2D195D057000B7D73C /* ASDisplayLayerTests.m */,
|
||||
058D0A2E195D057000B7D73C /* ASDisplayNodeAppearanceTests.m */,
|
||||
058D0A2F195D057000B7D73C /* ASDisplayNodeTests.m */,
|
||||
69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */,
|
||||
058D0A30195D057000B7D73C /* ASDisplayNodeTestsHelper.h */,
|
||||
058D0A31195D057000B7D73C /* ASDisplayNodeTestsHelper.m */,
|
||||
697B31591CFE4B410049936F /* ASEditableTextNodeTests.m */,
|
||||
@ -2219,6 +2224,7 @@
|
||||
697B315A1CFE4B410049936F /* ASEditableTextNodeTests.m in Sources */,
|
||||
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm in Sources */,
|
||||
CC0AEEA41D66316E005D1C78 /* ASUICollectionViewTests.m in Sources */,
|
||||
69B225671D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm in Sources */,
|
||||
ACF6ED621B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm in Sources */,
|
||||
7AB338691C55B97B0055FDE8 /* ASRelativeLayoutSpecSnapshotTests.mm in Sources */,
|
||||
254C6B541BF8FF2A003EC431 /* ASTextKitTests.mm in Sources */,
|
||||
|
37
AsyncDisplayKitTests/ASDisplayNodeLayoutTests.mm
Normal file
37
AsyncDisplayKitTests/ASDisplayNodeLayoutTests.mm
Normal file
@ -0,0 +1,37 @@
|
||||
//
|
||||
// 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
|
37
AsyncDisplayKitTests/ASXCTExtensions.h
Normal file
37
AsyncDisplayKitTests/ASXCTExtensions.h
Normal file
@ -0,0 +1,37 @@
|
||||
//
|
||||
// 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 <XCTest/XCTestAssertionsImpl.h>
|
||||
|
||||
/**
|
||||
* XCTest extensions for CGGeometry.
|
||||
*
|
||||
* Prefer these to XCTAssert(CGRectEqualToRect(...)) because you get output
|
||||
* that tells you what went wrong.
|
||||
* Could use NSValue, but using strings makes the description messages shorter.
|
||||
*/
|
||||
|
||||
#define ASXCTAssertEqualSizes(s0, s1, ...) \
|
||||
_XCTPrimitiveAssertEqualObjects(self, NSStringFromCGSize(s0), @#s0, NSStringFromCGSize(s1), @#s1, __VA_ARGS__)
|
||||
|
||||
#define ASXCTAssertNotEqualSizes(s0, s1, ...) \
|
||||
_XCTPrimitiveAssertNotEqualObjects(self, NSStringFromCGSize(s0), @#s0, NSStringFromCGSize(s1), @#s1, __VA_ARGS__)
|
||||
|
||||
#define ASXCTAssertEqualPoints(p0, p1, ...) \
|
||||
_XCTPrimitiveAssertEqualObjects(self, NSStringFromCGPoint(p0), @#p0, NSStringFromCGPoint(p1), @#p1, __VA_ARGS__)
|
||||
|
||||
#define ASXCTAssertNotEqualPoints(p0, p1, ...) \
|
||||
_XCTPrimitiveAssertNotEqualObjects(self, NSStringFromCGPoint(p0), @#p0, NSStringFromCGPoint(p1), @#p1, __VA_ARGS__)
|
||||
|
||||
#define ASXCTAssertEqualRects(r0, r1, ...) \
|
||||
_XCTPrimitiveAssertEqualObjects(self, NSStringFromCGRect(r0), @#r0, NSStringFromCGRect(r1), @#r1, __VA_ARGS__)
|
||||
|
||||
#define ASXCTAssertNotEqualRects(r0, r1, ...) \
|
||||
_XCTPrimitiveAssertNotEqualObjects(self, NSStringFromCGRect(r0), @#r0, NSStringFromCGRect(r1), @#r1, __VA_ARGS__)
|
Loading…
x
Reference in New Issue
Block a user