Clean up snapshot test cases (#3091)
* 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
@ -313,7 +313,6 @@
|
|||||||
CC0F88601E4280B800576FED /* _ASCollectionViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = CC0F885E1E4280B800576FED /* _ASCollectionViewCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
CC0F88601E4280B800576FED /* _ASCollectionViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = CC0F885E1E4280B800576FED /* _ASCollectionViewCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||||
CC0F88621E4281E200576FED /* ASSectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCE04B1E1E313EA7006AEBBB /* ASSectionController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
CC0F88621E4281E200576FED /* ASSectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCE04B1E1E313EA7006AEBBB /* ASSectionController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
CC0F88631E4281E700576FED /* ASSupplementaryNodeSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CCE04B2B1E314A32006AEBBB /* ASSupplementaryNodeSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
CC0F88631E4281E700576FED /* ASSupplementaryNodeSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CCE04B2B1E314A32006AEBBB /* ASSupplementaryNodeSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
CC0F886B1E4286FA00576FED /* ReferenceImages_32 in Resources */ = {isa = PBXBuildFile; fileRef = CC0F88681E4286FA00576FED /* ReferenceImages_32 */; };
|
|
||||||
CC0F886C1E4286FA00576FED /* ReferenceImages_64 in Resources */ = {isa = PBXBuildFile; fileRef = CC0F88691E4286FA00576FED /* ReferenceImages_64 */; };
|
CC0F886C1E4286FA00576FED /* ReferenceImages_64 in Resources */ = {isa = PBXBuildFile; fileRef = CC0F88691E4286FA00576FED /* ReferenceImages_64 */; };
|
||||||
CC0F886D1E4286FA00576FED /* ReferenceImages_iOS_10 in Resources */ = {isa = PBXBuildFile; fileRef = CC0F886A1E4286FA00576FED /* ReferenceImages_iOS_10 */; };
|
CC0F886D1E4286FA00576FED /* ReferenceImages_iOS_10 in Resources */ = {isa = PBXBuildFile; fileRef = CC0F886A1E4286FA00576FED /* ReferenceImages_iOS_10 */; };
|
||||||
CC11F97A1DB181180024D77B /* ASNetworkImageNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC11F9791DB181180024D77B /* ASNetworkImageNodeTests.m */; };
|
CC11F97A1DB181180024D77B /* ASNetworkImageNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC11F9791DB181180024D77B /* ASNetworkImageNodeTests.m */; };
|
||||||
@ -700,7 +699,6 @@
|
|||||||
CC0F885A1E42807F00576FED /* ASCollectionViewFlowLayoutInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionViewFlowLayoutInspector.h; sourceTree = "<group>"; };
|
CC0F885A1E42807F00576FED /* ASCollectionViewFlowLayoutInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionViewFlowLayoutInspector.h; sourceTree = "<group>"; };
|
||||||
CC0F885D1E4280B800576FED /* _ASCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _ASCollectionViewCell.m; sourceTree = "<group>"; };
|
CC0F885D1E4280B800576FED /* _ASCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _ASCollectionViewCell.m; sourceTree = "<group>"; };
|
||||||
CC0F885E1E4280B800576FED /* _ASCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _ASCollectionViewCell.h; sourceTree = "<group>"; };
|
CC0F885E1E4280B800576FED /* _ASCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _ASCollectionViewCell.h; sourceTree = "<group>"; };
|
||||||
CC0F88681E4286FA00576FED /* ReferenceImages_32 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ReferenceImages_32; sourceTree = "<group>"; };
|
|
||||||
CC0F88691E4286FA00576FED /* ReferenceImages_64 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ReferenceImages_64; sourceTree = "<group>"; };
|
CC0F88691E4286FA00576FED /* ReferenceImages_64 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ReferenceImages_64; sourceTree = "<group>"; };
|
||||||
CC0F886A1E4286FA00576FED /* ReferenceImages_iOS_10 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ReferenceImages_iOS_10; sourceTree = "<group>"; };
|
CC0F886A1E4286FA00576FED /* ReferenceImages_iOS_10 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ReferenceImages_iOS_10; sourceTree = "<group>"; };
|
||||||
CC11F9791DB181180024D77B /* ASNetworkImageNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASNetworkImageNodeTests.m; sourceTree = "<group>"; };
|
CC11F9791DB181180024D77B /* ASNetworkImageNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASNetworkImageNodeTests.m; sourceTree = "<group>"; };
|
||||||
@ -1036,7 +1034,6 @@
|
|||||||
058D09C6195D04C000B7D73C /* Supporting Files */ = {
|
058D09C6195D04C000B7D73C /* Supporting Files */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
CC0F88681E4286FA00576FED /* ReferenceImages_32 */,
|
|
||||||
CC0F88691E4286FA00576FED /* ReferenceImages_64 */,
|
CC0F88691E4286FA00576FED /* ReferenceImages_64 */,
|
||||||
CC0F886A1E4286FA00576FED /* ReferenceImages_iOS_10 */,
|
CC0F886A1E4286FA00576FED /* ReferenceImages_iOS_10 */,
|
||||||
058D09C7195D04C000B7D73C /* AsyncDisplayKitTests-Info.plist */,
|
058D09C7195D04C000B7D73C /* AsyncDisplayKitTests-Info.plist */,
|
||||||
@ -1671,7 +1668,6 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
CC0F886B1E4286FA00576FED /* ReferenceImages_32 in Resources */,
|
|
||||||
CC0F886C1E4286FA00576FED /* ReferenceImages_64 in Resources */,
|
CC0F886C1E4286FA00576FED /* ReferenceImages_64 in Resources */,
|
||||||
CC0F886D1E4286FA00576FED /* ReferenceImages_iOS_10 in Resources */,
|
CC0F886D1E4286FA00576FED /* ReferenceImages_iOS_10 in Resources */,
|
||||||
052EE06B1A15A0D8002C6279 /* TestResources in Resources */,
|
052EE06B1A15A0D8002C6279 /* TestResources in Resources */,
|
||||||
|
|||||||
25
BUCK
@ -43,7 +43,7 @@ def asyncdisplaykit_library(
|
|||||||
apple_library(
|
apple_library(
|
||||||
name = name,
|
name = name,
|
||||||
prefix_header = 'Source/AsyncDisplayKit-Prefix.pch',
|
prefix_header = 'Source/AsyncDisplayKit-Prefix.pch',
|
||||||
header_path_prefix = 'Source',
|
header_path_prefix = 'AsyncDisplayKit',
|
||||||
exported_headers = ASYNCDISPLAYKIT_EXPORTED_HEADERS,
|
exported_headers = ASYNCDISPLAYKIT_EXPORTED_HEADERS,
|
||||||
headers = ASYNCDISPLAYKIT_PRIVATE_HEADERS,
|
headers = ASYNCDISPLAYKIT_PRIVATE_HEADERS,
|
||||||
srcs = glob([
|
srcs = glob([
|
||||||
@ -58,8 +58,6 @@ def asyncdisplaykit_library(
|
|||||||
'Photos',
|
'Photos',
|
||||||
'-weak_framework',
|
'-weak_framework',
|
||||||
'MapKit',
|
'MapKit',
|
||||||
'-weak_framework',
|
|
||||||
'AssetsLibrary',
|
|
||||||
],
|
],
|
||||||
deps = deps,
|
deps = deps,
|
||||||
frameworks = [
|
frameworks = [
|
||||||
@ -72,6 +70,9 @@ def asyncdisplaykit_library(
|
|||||||
'$SDKROOT/System/Library/Frameworks/CoreGraphics.framework',
|
'$SDKROOT/System/Library/Frameworks/CoreGraphics.framework',
|
||||||
'$SDKROOT/System/Library/Frameworks/CoreLocation.framework',
|
'$SDKROOT/System/Library/Frameworks/CoreLocation.framework',
|
||||||
'$SDKROOT/System/Library/Frameworks/AVFoundation.framework',
|
'$SDKROOT/System/Library/Frameworks/AVFoundation.framework',
|
||||||
|
|
||||||
|
# TODO somehow AssetsLibrary can't be weak_framework
|
||||||
|
'$SDKROOT/System/Library/Frameworks/AssetsLibrary.framework',
|
||||||
] + additional_frameworks,
|
] + additional_frameworks,
|
||||||
visibility = ['PUBLIC'],
|
visibility = ['PUBLIC'],
|
||||||
)
|
)
|
||||||
@ -100,12 +101,6 @@ for name in ['AsyncDisplayKit', 'AsyncDisplayKit-PINRemoteImage']:
|
|||||||
# Test Host
|
# Test Host
|
||||||
# TODO: Split to smaller BUCK files and parse in parallel
|
# TODO: Split to smaller BUCK files and parse in parallel
|
||||||
#####################################
|
#####################################
|
||||||
apple_resource(
|
|
||||||
name = 'TestHostResources',
|
|
||||||
files = ['Default-568h@2x.png'],
|
|
||||||
dirs = [],
|
|
||||||
)
|
|
||||||
|
|
||||||
apple_bundle(
|
apple_bundle(
|
||||||
name = 'TestHost',
|
name = 'TestHost',
|
||||||
binary = ':TestHostBinary',
|
binary = ':TestHostBinary',
|
||||||
@ -120,14 +115,10 @@ apple_bundle(
|
|||||||
apple_binary(
|
apple_binary(
|
||||||
name = 'TestHostBinary',
|
name = 'TestHostBinary',
|
||||||
headers = glob(['Tests/TestHost/*.h']),
|
headers = glob(['Tests/TestHost/*.h']),
|
||||||
srcs = glob([
|
srcs = glob(['Tests/TestHost/*.m']),
|
||||||
'Tests/TestHost/*.m',
|
|
||||||
'Tests/TestHost/*.mm',
|
|
||||||
]),
|
|
||||||
lang_preprocessor_flags = COMMON_LANG_PREPROCESSOR_FLAGS,
|
lang_preprocessor_flags = COMMON_LANG_PREPROCESSOR_FLAGS,
|
||||||
linker_flags = COMMON_LINKER_FLAGS,
|
linker_flags = COMMON_LINKER_FLAGS,
|
||||||
deps = [
|
deps = [
|
||||||
':TestHostResources',
|
|
||||||
':AsyncDisplayKit-Core',
|
':AsyncDisplayKit-Core',
|
||||||
],
|
],
|
||||||
frameworks = [
|
frameworks = [
|
||||||
@ -158,10 +149,9 @@ apple_test(
|
|||||||
'PRODUCT_BUNDLE_IDENTIFIER': 'com.facebook.AsyncDisplayKitTests',
|
'PRODUCT_BUNDLE_IDENTIFIER': 'com.facebook.AsyncDisplayKitTests',
|
||||||
},
|
},
|
||||||
prefix_header = 'Tests/AsyncDisplayKitTests-Prefix.pch',
|
prefix_header = 'Tests/AsyncDisplayKitTests-Prefix.pch',
|
||||||
|
header_path_prefix = 'AsyncDisplayKit',
|
||||||
# Expose all ASDK headers to tests
|
# Expose all ASDK headers to tests
|
||||||
headers = ASYNCDISPLAYKIT_EXPORTED_HEADERS + ASYNCDISPLAYKIT_PRIVATE_HEADERS + glob([
|
headers = ASYNCDISPLAYKIT_EXPORTED_HEADERS + ASYNCDISPLAYKIT_PRIVATE_HEADERS + glob(['Tests/*.h']),
|
||||||
'Tests/*.h',
|
|
||||||
]),
|
|
||||||
srcs = glob([
|
srcs = glob([
|
||||||
'Tests/*.m',
|
'Tests/*.m',
|
||||||
'Tests/*.mm'
|
'Tests/*.mm'
|
||||||
@ -172,6 +162,7 @@ apple_test(
|
|||||||
snapshot_reference_images_path='Tests/ReferenceImages',
|
snapshot_reference_images_path='Tests/ReferenceImages',
|
||||||
preprocessor_flags = COMMON_PREPROCESSOR_FLAGS + [
|
preprocessor_flags = COMMON_PREPROCESSOR_FLAGS + [
|
||||||
'-Wno-implicit-function-declaration',
|
'-Wno-implicit-function-declaration',
|
||||||
|
'-Wno-deprecated-declarations',
|
||||||
],
|
],
|
||||||
lang_preprocessor_flags = COMMON_LANG_PREPROCESSOR_FLAGS,
|
lang_preprocessor_flags = COMMON_LANG_PREPROCESSOR_FLAGS,
|
||||||
linker_flags = COMMON_LINKER_FLAGS,
|
linker_flags = COMMON_LINKER_FLAGS,
|
||||||
|
|||||||
@ -2149,12 +2149,9 @@ static bool stringContainsPointer(NSString *description, id p) {
|
|||||||
{
|
{
|
||||||
ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init];
|
ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init];
|
||||||
[node view];
|
[node view];
|
||||||
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
[self executeOffThread:^{
|
||||||
[NSThread detachNewThreadWithBlock:^{
|
|
||||||
XCTAssertThrows([node onDidLoad:^(ASDisplayNode * _Nonnull node) { }]);
|
XCTAssertThrows([node onDidLoad:^(ASDisplayNode * _Nonnull node) { }]);
|
||||||
dispatch_semaphore_signal(sem);
|
|
||||||
}];
|
}];
|
||||||
dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testThatOnDidLoadWorks
|
- (void)testThatOnDidLoadWorks
|
||||||
|
|||||||
@ -17,6 +17,13 @@
|
|||||||
|
|
||||||
@implementation ASImageNodeSnapshotTests
|
@implementation ASImageNodeSnapshotTests
|
||||||
|
|
||||||
|
- (void)setUp
|
||||||
|
{
|
||||||
|
[super setUp];
|
||||||
|
|
||||||
|
self.recordMode = NO;
|
||||||
|
}
|
||||||
|
|
||||||
- (UIImage *)testImage
|
- (UIImage *)testImage
|
||||||
{
|
{
|
||||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"logo-square"
|
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"logo-square"
|
||||||
|
|||||||
@ -23,14 +23,6 @@ static const ASSizeRange kSize = {{100, 120}, {320, 160}};
|
|||||||
|
|
||||||
#pragma mark - XCTestCase
|
#pragma mark - XCTestCase
|
||||||
|
|
||||||
- (void)setUp
|
|
||||||
{
|
|
||||||
[super setUp];
|
|
||||||
|
|
||||||
self.recordMode = NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)testWithOptions
|
- (void)testWithOptions
|
||||||
{
|
{
|
||||||
[self testAllVerticalPositionsForHorizontalPosition:ASRelativeLayoutSpecPositionStart];
|
[self testAllVerticalPositionsForHorizontalPosition:ASRelativeLayoutSpecPositionStart];
|
||||||
|
|||||||
@ -21,16 +21,11 @@ NSOrderedSet *ASSnapshotTestCaseDefaultSuffixes(void)
|
|||||||
// or on iOS 10 (text rasterization). If the test folders find any image that exactly matches,
|
// or on iOS 10 (text rasterization). If the test folders find any image that exactly matches,
|
||||||
// they pass; if an image is not present at all, or it fails, it moves on to check the others.
|
// they pass; if an image is not present at all, or it fails, it moves on to check the others.
|
||||||
// This means the order doesn't matter besides reducing logging / performance.
|
// This means the order doesn't matter besides reducing logging / performance.
|
||||||
[suffixesSet addObject:@"_32"];
|
|
||||||
[suffixesSet addObject:@"_64"];
|
|
||||||
if (AS_AT_LEAST_IOS10) {
|
if (AS_AT_LEAST_IOS10) {
|
||||||
[suffixesSet addObject:@"_iOS_10"];
|
[suffixesSet addObject:@"_iOS_10"];
|
||||||
}
|
}
|
||||||
#if __LP64__
|
[suffixesSet addObject:@"_64"];
|
||||||
return [suffixesSet reversedOrderedSet];
|
|
||||||
#else
|
|
||||||
return [suffixesSet copy];
|
return [suffixesSet copy];
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation ASSnapshotTestCase
|
@implementation ASSnapshotTestCase
|
||||||
|
|||||||
@ -17,13 +17,6 @@
|
|||||||
|
|
||||||
@implementation ASWrapperSpecSnapshotTests
|
@implementation ASWrapperSpecSnapshotTests
|
||||||
|
|
||||||
- (void)setUp
|
|
||||||
{
|
|
||||||
[super setUp];
|
|
||||||
|
|
||||||
self.recordMode = NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)testWrapperSpecWithOneElementShouldSizeToElement
|
- (void)testWrapperSpecWithOneElementShouldSizeToElement
|
||||||
{
|
{
|
||||||
ASDisplayNode *child = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50});
|
ASDisplayNode *child = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50});
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |