mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-10 16:29:55 +00:00
upgrade snaphot tests to support IOS 10 (#2295)
This commit is contained in:
parent
4326fc90bf
commit
679f68e169
File diff suppressed because it is too large
Load Diff
@ -12,18 +12,23 @@
|
||||
|
||||
@class ASDisplayNode;
|
||||
|
||||
NSOrderedSet *ASSnapshotTestCaseDefaultSuffixes(void);
|
||||
|
||||
#define ASSnapshotVerifyNode(node__, identifier__) \
|
||||
{ \
|
||||
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:node__]; \
|
||||
FBSnapshotVerifyLayer(node__.layer, identifier__); \
|
||||
FBSnapshotVerifyLayerWithOptions(node__.layer, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0) \
|
||||
[node__ setShouldRasterizeDescendants:YES]; \
|
||||
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:node__]; \
|
||||
FBSnapshotVerifyLayer(node__.layer, identifier__); \
|
||||
FBSnapshotVerifyLayerWithOptions(node__.layer, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0) \
|
||||
[node__ setShouldRasterizeDescendants:NO]; \
|
||||
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:node__]; \
|
||||
FBSnapshotVerifyLayer(node__.layer, identifier__); \
|
||||
FBSnapshotVerifyLayerWithOptions(node__.layer, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0) \
|
||||
}
|
||||
|
||||
#define ASSnapshotVerifyLayer(layer__, identifier__) \
|
||||
FBSnapshotVerifyLayerWithOptions(layer__, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0);
|
||||
|
||||
@interface ASSnapshotTestCase : FBSnapshotTestCase
|
||||
|
||||
/**
|
||||
|
||||
@ -9,10 +9,30 @@
|
||||
//
|
||||
|
||||
#import "ASSnapshotTestCase.h"
|
||||
#import "ASAvailability.h"
|
||||
#import "ASDisplayNode+Beta.h"
|
||||
#import "ASDisplayNodeExtras.h"
|
||||
#import "ASDisplayNode+Subclasses.h"
|
||||
|
||||
NSOrderedSet *ASSnapshotTestCaseDefaultSuffixes(void)
|
||||
{
|
||||
NSMutableOrderedSet *suffixesSet = [[NSMutableOrderedSet alloc] init];
|
||||
// In some rare cases, slightly different rendering may occur on 32 vs 64 bit architectures,
|
||||
// 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.
|
||||
// This means the order doesn't matter besides reducing logging / performance.
|
||||
[suffixesSet addObject:@"_32"];
|
||||
[suffixesSet addObject:@"_64"];
|
||||
if (AS_AT_LEAST_IOS10) {
|
||||
[suffixesSet addObject:@"_iOS_10"];
|
||||
}
|
||||
#if __LP64__
|
||||
return [suffixesSet reversedOrderedSet];
|
||||
#else
|
||||
return [suffixesSet copy];
|
||||
#endif
|
||||
}
|
||||
|
||||
@implementation ASSnapshotTestCase
|
||||
|
||||
+ (void)hackilySynchronouslyRecursivelyRenderNode:(ASDisplayNode *)node
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
textNode.highlightRange = NSMakeRange(0, textNode.attributedText.length);
|
||||
|
||||
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:textNode];
|
||||
FBSnapshotVerifyLayer(backgroundView.layer, nil);
|
||||
ASSnapshotVerifyLayer(backgroundView.layer, nil);
|
||||
}
|
||||
|
||||
- (void)testTextContainerInsetHighlight
|
||||
@ -72,7 +72,7 @@
|
||||
textNode.highlightRange = NSMakeRange(0, textNode.attributedText.length);
|
||||
|
||||
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:textNode];
|
||||
FBSnapshotVerifyLayer(backgroundView.layer, nil);
|
||||
ASSnapshotVerifyLayer(backgroundView.layer, nil);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
@ -33,6 +33,10 @@
|
||||
#define kCFCoreFoundationVersionNumber_iOS_9_0 1240.10
|
||||
#endif
|
||||
|
||||
#ifndef kCFCoreFoundationVersionNumber_iOS_10_0
|
||||
#define kCFCoreFoundationVersionNumber_iOS_10_0 1348.00
|
||||
#endif
|
||||
|
||||
#ifndef __IPHONE_7_0
|
||||
#define __IPHONE_7_0 70000
|
||||
#endif
|
||||
@ -45,11 +49,16 @@
|
||||
#define __IPHONE_9_0 90000
|
||||
#endif
|
||||
|
||||
#ifndef __IPHONE_10_0
|
||||
#define __IPHONE_10_0 100000
|
||||
#endif
|
||||
|
||||
#ifndef AS_IOS8_SDK_OR_LATER
|
||||
#define AS_IOS8_SDK_OR_LATER __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0
|
||||
#endif
|
||||
|
||||
#define AS_AT_LEAST_IOS7 (kCFCoreFoundationVersionNumber > kCFCoreFoundationVersionNumber_iOS_6_1)
|
||||
#define AS_AT_LEAST_IOS7 (kCFCoreFoundationVersionNumber > kCFCoreFoundationVersionNumber_iOS_6_1)
|
||||
#define AS_AT_LEAST_IOS7_1 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_1)
|
||||
#define AS_AT_LEAST_IOS8 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0)
|
||||
#define AS_AT_LEAST_IOS9 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_9_0)
|
||||
#define AS_AT_LEAST_IOS8 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0)
|
||||
#define AS_AT_LEAST_IOS9 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_9_0)
|
||||
#define AS_AT_LEAST_IOS10 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_10_0)
|
||||
|
||||
3
Podfile
3
Podfile
@ -4,5 +4,6 @@ platform :ios, '7.0'
|
||||
|
||||
target :'AsyncDisplayKitTests' do
|
||||
pod 'OCMock', '~> 2.2'
|
||||
pod 'FBSnapshotTestCase/Core', '~> 2.1'
|
||||
# this is identical to FBSnapshotTestCase 2.1.3 except that the deployment was changed from 8.0 -> 7.0
|
||||
pod 'FBSnapshotTestCase/Core', :git => "https://github.com/hannahmbanana/ios-snapshot-test-case.git"
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user