- Release 0.1.1
This commit is contained in:
1 parent
9203c1c6ae
commit
c38e3a1657
55 files changed
+2621
-567
No files matched your search
@@ -12,7 +12,6 @@ Pod::Spec.new do |s|
|
||||
s.version = "0.1.0"
|
||||
s.summary = "CodFis-Helper help you to validate Tax Code"
|
||||
s.homepage = "https://github.com/giuseppenucifora/CodFis-Helper"
|
||||
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
|
||||
s.license = 'MIT'
|
||||
s.author = { "Giuseppe Nucifora" => "me@giuseppenucifora.com" }
|
||||
s.source = { :git => "https://github.com/giuseppenucifora/CodFis-Helper.git", :tag => s.version.to_s }
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "CodFisResponse.h"
|
||||
|
||||
@interface CodFis_Helper : NSObject
|
||||
|
||||
@@ -30,7 +31,14 @@ typedef enum {
|
||||
@property (nonatomic, strong) NSString *place;
|
||||
@property (nonatomic) BOOL collision;
|
||||
|
||||
- (NSString*) calculate;
|
||||
|
||||
+ (CodFisResponse*) calculateFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision;
|
||||
|
||||
+ (BOOL) checkCodFisFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision andCodFis:(NSString*) codFis;
|
||||
|
||||
- (instancetype) initFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision;
|
||||
|
||||
- (CodFisResponse*) calculate;
|
||||
|
||||
- (BOOL) check:(NSString*) codFis;
|
||||
|
||||
@@ -38,4 +46,5 @@ typedef enum {
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+230
-30
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// CodFis+Helper.m
|
||||
// CodFis+self.m
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 08/07/15.
|
||||
@@ -11,46 +11,134 @@
|
||||
#define DEF_SURNAME_COD_LENGHT 3
|
||||
#define DEF_NAME_COD_LENGHT 3
|
||||
|
||||
@interface CodFis_Helper() {
|
||||
|
||||
NSNumberFormatter* numberFormatter;
|
||||
}
|
||||
|
||||
@property (nonatomic, strong) NSString *codFis;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CodFis_Helper
|
||||
|
||||
- (instancetype) init {
|
||||
+ (CodFisResponse*) calculateFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision {
|
||||
|
||||
return [[[self alloc] initFromSurname:surname name:name birthDay:birthDay birthMonth:birthMonth birthYear:birthYear gender:gender state:state place:place collision:collision] calculate];
|
||||
}
|
||||
|
||||
+ (BOOL) checkCodFisFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision andCodFis:(NSString*) codFis {
|
||||
|
||||
return [[[self alloc] initFromSurname:surname name:name birthDay:birthDay birthMonth:birthMonth birthYear:birthYear gender:gender state:state place:place collision:collision] check:codFis];
|
||||
}
|
||||
|
||||
- (instancetype) initFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision {
|
||||
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
|
||||
[self setSurname:surname];
|
||||
|
||||
[self setName:name];
|
||||
|
||||
[self setBirthDay:birthDay];
|
||||
|
||||
[self setBirthMonth:birthMonth];
|
||||
|
||||
[self setBirthYear:birthYear];
|
||||
|
||||
[self setGender:gender];
|
||||
|
||||
[self setState:state];
|
||||
|
||||
[self setPlace:place];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString*) calculate {
|
||||
|
||||
|
||||
- (CodFisResponse*) calculate {
|
||||
|
||||
NSError *error;
|
||||
|
||||
NSMutableString *resposeString = [[NSMutableString alloc] init];
|
||||
|
||||
[resposeString appendString:[self getCodFisSurname]];
|
||||
NSString *tempResponse = [self getCodFisSurname];
|
||||
|
||||
[resposeString appendString:[self getCodFisName]];
|
||||
if (!tempResponse) {
|
||||
error = [NSError errorWithDomain:NSLocalizedString(@"Bad Request in Surname", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Surname", @""),@"Message", nil],@"Meta", nil]];
|
||||
}
|
||||
else {
|
||||
[resposeString appendString:tempResponse];
|
||||
}
|
||||
|
||||
[resposeString appendString:[self getCodFisYear]];
|
||||
tempResponse = [self getCodFisName];
|
||||
|
||||
[resposeString appendString:[self getCodFisMonth]];
|
||||
if (!tempResponse) {
|
||||
error = [NSError errorWithDomain:NSLocalizedString(@"Bad Request in Name", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Name", @""),@"Message", nil],@"Meta", nil]];
|
||||
}
|
||||
else {
|
||||
[resposeString appendString:tempResponse];
|
||||
}
|
||||
|
||||
[resposeString appendString:[self getCodFisDay]];
|
||||
tempResponse = [self getCodFisYear];
|
||||
|
||||
[resposeString appendString:[self getCodFisPlace]];
|
||||
if (!tempResponse) {
|
||||
error = [NSError errorWithDomain:NSLocalizedString(@"Bad Request in Year", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Year", @""),@"Message", nil],@"Meta", nil]];
|
||||
}
|
||||
else {
|
||||
[resposeString appendString:tempResponse];
|
||||
}
|
||||
|
||||
tempResponse = [self getCodFisMonth];
|
||||
|
||||
return [resposeString stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||
if (!tempResponse) {
|
||||
error = [NSError errorWithDomain:NSLocalizedString(@"Bad Request in Month", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Month", @""),@"Message", nil],@"Meta", nil]];
|
||||
}
|
||||
else {
|
||||
[resposeString appendString:tempResponse];
|
||||
}
|
||||
|
||||
tempResponse = [self getCodFisDay];
|
||||
|
||||
if (!tempResponse) {
|
||||
error = [NSError errorWithDomain:NSLocalizedString(@"Bad Request in Day", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Day", @""),@"Message", nil],@"Meta", nil]];
|
||||
}
|
||||
else {
|
||||
[resposeString appendString:tempResponse];
|
||||
}
|
||||
|
||||
tempResponse = [self getCodFisPlace];
|
||||
|
||||
if (!tempResponse) {
|
||||
error = [NSError errorWithDomain:NSLocalizedString(@"Bad Request in Place", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Place", @""),@"Message", nil],@"Meta", nil]];
|
||||
}
|
||||
else {
|
||||
[resposeString appendString:tempResponse];
|
||||
}
|
||||
|
||||
|
||||
|
||||
_codFis = [resposeString stringByReplacingOccurrencesOfString:@" " withString:@""];;
|
||||
|
||||
[resposeString appendString:[self getCodFisControlCode]];
|
||||
|
||||
return [[CodFisResponse alloc] initWithResponse:resposeString andError:error];
|
||||
}
|
||||
|
||||
- (BOOL) check:(NSString*) codFis {
|
||||
return YES;
|
||||
|
||||
return [[[self calculate] response] isEqualToString:[codFis uppercaseString]];
|
||||
}
|
||||
|
||||
- (NSString *) getCodFisSurname {
|
||||
NSMutableString *resultString = [[NSMutableString alloc] init];
|
||||
NSString *vowels = @"aeiouàèìòùáéíóúäëïöü";
|
||||
NSString *chars = @"qwrtypsdfghjklzxcvbnm";
|
||||
|
||||
NSArray* consonantsArray = [[_surname lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:vowels]];
|
||||
NSArray* vowelArray = [[_surname lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:chars]];
|
||||
NSMutableArray *consonantsArray = [NSMutableArray arrayWithArray:[self getConsonantArray:_surname]];
|
||||
|
||||
NSMutableArray *vowelArray = [NSMutableArray arrayWithArray:[self getVowelsArray:_surname]];
|
||||
|
||||
for (NSString *chr in consonantsArray) {
|
||||
if (![chr isEqualToString:@""]) {
|
||||
@@ -58,7 +146,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
|
||||
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
|
||||
return [[resultString substringToIndex:DEF_SURNAME_COD_LENGHT] uppercaseString];
|
||||
}
|
||||
|
||||
@@ -68,7 +156,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
|
||||
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
|
||||
[resultString setString:[resultString substringToIndex:DEF_SURNAME_COD_LENGHT]];
|
||||
}
|
||||
else {
|
||||
@@ -80,12 +168,12 @@
|
||||
}
|
||||
|
||||
- (NSString *) getCodFisName {
|
||||
NSMutableString *resultString = [[NSMutableString alloc] init];
|
||||
NSString *vowels = @"aeiouàèìòùáéíóúäëïöü";
|
||||
NSString *chars = @"qwrtypsdfghjklzxcvbnm";
|
||||
|
||||
NSMutableArray* consonantsArray = [NSMutableArray arrayWithArray:[[_name lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:vowels]]];
|
||||
NSArray* vowelArray = [NSMutableArray arrayWithArray:[[_name lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:chars]]];
|
||||
NSMutableString *resultString = [[NSMutableString alloc] init];
|
||||
|
||||
NSMutableArray *consonantsArray = [NSMutableArray arrayWithArray:[self getConsonantArray:_name]];
|
||||
|
||||
NSMutableArray *vowelArray = [NSMutableArray arrayWithArray:[self getVowelsArray:_name]];
|
||||
|
||||
for (NSString *chr in [consonantsArray mutableCopy]) {
|
||||
if ([chr isEqualToString:@""]) {
|
||||
@@ -105,7 +193,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
|
||||
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
|
||||
return [[resultString substringToIndex:DEF_SURNAME_COD_LENGHT] uppercaseString];
|
||||
}
|
||||
|
||||
@@ -115,7 +203,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
|
||||
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
|
||||
[resultString setString:[resultString substringToIndex:DEF_SURNAME_COD_LENGHT]];
|
||||
}
|
||||
else {
|
||||
@@ -130,10 +218,10 @@
|
||||
- (NSString *) getCodFisYear {
|
||||
|
||||
if (_birthYear < 100) {
|
||||
return [NSString stringWithFormat:@"%ld",_birthYear];
|
||||
return [NSString stringWithFormat:@"%ld",(long)_birthYear];
|
||||
}
|
||||
else {
|
||||
NSString * allDigits = [NSString stringWithFormat:@"%ld",_birthYear];
|
||||
NSString * allDigits = [NSString stringWithFormat:@"%ld",(long)_birthYear];
|
||||
return [allDigits substringWithRange:NSMakeRange(allDigits.length -2, 2)];
|
||||
}
|
||||
return nil;
|
||||
@@ -188,23 +276,111 @@
|
||||
break;
|
||||
}
|
||||
if (checkMonth) {
|
||||
return [NSString stringWithFormat:@"%02ld",_birthDay + increment];
|
||||
return [NSString stringWithFormat:@"%02ld",(long)_birthDay + increment];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray*) getConsonantArray:(NSString*) string {
|
||||
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"([A,Á,Ã,E,É,Ê,I,Í,O,Ô,Ó,Õ,U,Û,Ü,Ú]?)" options:NSRegularExpressionCaseInsensitive error:nil];
|
||||
|
||||
string = [[string uppercaseString] stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||
|
||||
NSString *resultString = [regex stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];
|
||||
|
||||
NSMutableArray *responseArray = [[NSMutableArray alloc] init];
|
||||
|
||||
for (int i = 0; i < [resultString length]; i++) {
|
||||
[responseArray addObject:[resultString substringWithRange:NSMakeRange(i, 1)]];
|
||||
}
|
||||
|
||||
return responseArray;
|
||||
}
|
||||
|
||||
- (NSArray*) getVowelsArray:(NSString *) string {
|
||||
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"([Q,W,R,T,Y,P,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M]?)" options:NSRegularExpressionCaseInsensitive error:nil];
|
||||
|
||||
string = [[string uppercaseString] stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||
|
||||
NSString *resultString = [regex stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];
|
||||
|
||||
NSMutableArray *responseArray = [[NSMutableArray alloc] init];
|
||||
|
||||
for (int i = 0; i < [resultString length]; i++) {
|
||||
[responseArray addObject:[resultString substringWithRange:NSMakeRange(i, 1)]];
|
||||
}
|
||||
|
||||
return responseArray;
|
||||
}
|
||||
|
||||
- (NSString *) getCodFisPlace {
|
||||
|
||||
NSString *responseString;
|
||||
|
||||
NSError *error = nil;
|
||||
|
||||
NSDictionary *dict = [NSKeyedUnarchiver unarchiveObjectWithData:[[NSData alloc] initWithContentsOfFile:[self getCodFisPlaceListFile] options:NSDataReadingMappedAlways error:&error]];
|
||||
|
||||
NSLog(@"%@",dict);
|
||||
NSData *data = [[NSData alloc] initWithContentsOfFile:[self getCodFisPlaceListFile] options:NSDataReadingMappedAlways error:&error];
|
||||
|
||||
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
||||
|
||||
@try {
|
||||
responseString = [json objectForKey:[_place uppercaseString]];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
|
||||
}
|
||||
@finally {
|
||||
if (responseString) {
|
||||
return responseString;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) getCodFisControlCode {
|
||||
|
||||
NSArray *contributeCode = @[@"1",@"0",@"5",@"7",@"9",@"13",@"15",@"17",@"19",@"21",@"2",@"4",@"18",@"20",@"11",@"3",@"6",@"8",@"12",@"14",@"16",@"10",@"22",@"25",@"24",@"23"];
|
||||
|
||||
NSArray *reponseCode = @[@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z"];
|
||||
|
||||
NSInteger tempIndex = 0;
|
||||
|
||||
NSInteger index = 1;
|
||||
for (NSString *chr in [self getcodFisArray]) {
|
||||
|
||||
if ([self isNumeric:chr]) {
|
||||
|
||||
if (index%2 == 0) {
|
||||
tempIndex += [chr integerValue]; }
|
||||
else {
|
||||
tempIndex += [[contributeCode objectAtIndex:[chr integerValue]] integerValue];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (index%2 == 0) {
|
||||
tempIndex += [self getAlphabetContributeCode:chr];
|
||||
}
|
||||
else {
|
||||
tempIndex += [[contributeCode objectAtIndex:[self getAlphabetContributeCode:chr]] integerValue];
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
return [reponseCode objectAtIndex:ceil((int)tempIndex%26)];
|
||||
}
|
||||
|
||||
- (NSInteger) getAlphabetContributeCode:(NSString *) chr {
|
||||
|
||||
unichar c = [chr characterAtIndex:0];
|
||||
|
||||
return (NSInteger)(((short)c)-65);
|
||||
}
|
||||
|
||||
|
||||
- (NSString*) getCodFisPlaceListFile {
|
||||
|
||||
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"codFisCodes" ofType:@"json"];
|
||||
@@ -212,4 +388,28 @@
|
||||
return filePath;
|
||||
}
|
||||
|
||||
- (NSArray *) getcodFisArray
|
||||
{
|
||||
NSMutableArray *arr = [[NSMutableArray alloc]init];
|
||||
for (int i=0; i < _codFis.length; i++) {
|
||||
NSString *tmp_str = [_codFis substringWithRange:NSMakeRange(i, 1)];
|
||||
[arr addObject:[tmp_str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
-(BOOL) isNumeric:(NSString*) hexText
|
||||
{
|
||||
if (!numberFormatter) {
|
||||
numberFormatter = [[NSNumberFormatter alloc] init];
|
||||
}
|
||||
|
||||
NSNumber* number = [numberFormatter numberFromString:hexText];
|
||||
|
||||
if (number != nil) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// CodFisResponse.h
|
||||
// CodFis-Helper
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 09/07/15.
|
||||
// Copyright (c) 2015 Giuseppe Nucifora. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ResponseConstants.h"
|
||||
|
||||
@interface CodFisResponse : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSError *responseError;
|
||||
@property (nonatomic, strong, readonly) NSString *response;
|
||||
|
||||
- (instancetype) initWithResponse:(NSString*) response andError:(NSError*) responseError;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// CodFisResponse.m
|
||||
// CodFis-Helper
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 09/07/15.
|
||||
// Copyright (c) 2015 Giuseppe Nucifora. All rights reserved.
|
||||
//
|
||||
|
||||
#import "CodFisResponse.h"
|
||||
|
||||
@implementation CodFisResponse
|
||||
|
||||
- (instancetype) initWithResponse:(NSString*) response andError:(NSError*) responseError {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_responseError = responseError;
|
||||
_response = response;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// ResponseConstants.h
|
||||
// cinecitta
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 30/06/14.
|
||||
// Copyright (c) 2014 meedori. All rights reserved.
|
||||
//
|
||||
|
||||
typedef enum {
|
||||
// Informational
|
||||
ResponseStatusContinue = 100,
|
||||
ResponseStatusSwitchingProtocols = 101,
|
||||
|
||||
// Successful
|
||||
ResponseStatusOK = 200,
|
||||
ResponseStatusCreated = 201,
|
||||
ResponseStatusAccepted = 202,
|
||||
ResponseStatusNonAuthoritativeInformation = 203,
|
||||
ResponseStatusNoContent = 204,
|
||||
ResponseStatusResetContent = 205,
|
||||
ResponseStatusPartialContent = 206,
|
||||
|
||||
// Redirection
|
||||
ResponseStatusMutltipleChoices = 300,
|
||||
ResponseStatusMovedPermanently = 301,
|
||||
ResponseStatusFound = 302,
|
||||
ResponseStatusSeeOther = 303,
|
||||
ResponseStatusNotModified = 304,
|
||||
ResponseStatusUseProxy = 305,
|
||||
ResponseStatusSwitchProxy = 306,
|
||||
ResponseStatusTemporaryRedirect = 307,
|
||||
|
||||
// Client Errors
|
||||
ResponseStatusBadRequest = 400,
|
||||
ResponseStatusUnauthorized = 401,
|
||||
ResponseStatusPaymentRequired = 402,
|
||||
ResponseStatusForbidden = 403,
|
||||
ResponseStatusNotFound = 404,
|
||||
ResponseStatusMethodNotAllowed = 405,
|
||||
ResponseStatusNotAcceptable = 406,
|
||||
ResponseStatusProxyAuthenticationRequired = 407,
|
||||
ResponseStatusRequestTimeout = 408,
|
||||
ResponseStatusConflict = 409,
|
||||
ResponseStatusGone = 410,
|
||||
ResponseStatusLengthRequired = 411,
|
||||
ResponseStatusPreconditionFailed = 412,
|
||||
ResponseStatusRequestEntityTooLarge = 413,
|
||||
ResponseStatusRequestURITooLong = 414,
|
||||
ResponseStatusUnsupportedMediaType = 415,
|
||||
ResponseStatusRequestedRangeNotSatisfiable = 416,
|
||||
ResponseStatusExpectationFailed = 417,
|
||||
|
||||
// Server Errors
|
||||
ResponseStatusInternalServerError = 500,
|
||||
ResponseStatusNotImpemented = 501,
|
||||
ResponseStatusBadGateway = 502,
|
||||
ResponseStatusServiceUnavailable = 503,
|
||||
ResponseStatusGatewayTimeout = 504,
|
||||
ResponseStatusVersionNotSupported = 505
|
||||
|
||||
} ResponseStatus;
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
[[{"ABANO TERME":"A001"},{"ABBADIA CERRETO":"A004"},{"ABBADIA LARIANA":"A005"},{"ABBADIA SAN SALVATORE":"A006"},{"ABBASANTA":"A007"},{"ABBATEGGIO":"A008"},{"ABBIATEGRASSO":"A010"},{"ABETONE":"A012"},{"ABRIOLA":"A013"},{"ACATE":"A014"},{"ACCADIA":"A015"},{"ACCEGLIO":"A016"},{"ACCETTURA":"A017"},{"ACCIANO":"A018"},{"ACCUMOLI":"A019"},{"ACERENZA":"A020"},{"ACERNO":"A023"},{"ACERRA":"A024"},{"ACI BONACCORSI":"A025"},{"ACI CASTELLO":"A026"},{"ACI CATENA":"A027"},{"ACI SANT\'ANTONIO":"A029"},{"ACIREALE":"A028"},{"ACQUACANINA":"A031"},{"ACQUAFONDATA":"A032"},{"ACQUAFORMOSA":"A033"},{"ACQUAFREDDA":"A034"},{"ACQUALAGNA":"A035"},{"ACQUANEGRA CREMONESE":"A039"},{"ACQUANEGRA SUL CHIESE":"A038"},{"ACQUAPENDENTE":"A040"},{"ACQUAPPESA":"A041"},{"ACQUARICA DEL CAPO":"A042"},{"ACQUARO":"A043"},{"ACQUASANTA TERME":"A044"},{"ACQUASPARTA":"A045"},{"ACQUAVIVA COLLECROCE":"A050"},{"ACQUAVIVA D\'ISERNIA":"A051"},{"ACQUAVIVA DELLE FONTI":"A048"},{"ACQUAVIVA PICENA":"A047"},{"ACQUAVIVA PLATANI":"A049"},{"ACQUEDOLCI":"M211"},{"ACQUI TERME":"A052"},{"ACRI":"A053"},{"ACUTO":"A054"},{"ADELFIA":"A055"},{"ADRANO":"A056"},{"ADRARA SAN MARTINO":"A057"},{"ADRARA SAN ROCCO":"A058"},{"ADRIA":"A059"},{"ADRO":"A060"},{"AFFI":"A061"},{"AFFILE":"A062"},{"AFRAGOLA":"A064"},{"AFRICO":"A065"},{"AGAZZANO":"A067"},{"AGEROLA":"A068"},{"AGGIUS":"A069"},{"AGIRA":"A070"},{"AGLIANA":"A071"},{"AGLIANO":"A072"},{"AGLIE\'":"A074"},{"AGLIENTU":"H848"},{"AGNA":"A075"},{"AGNADELLO":"A076"},{"AGNANA CALABRA":"A077"},{"AGNONE":"A080"},{"AGNOSINE":"A082"},{"AGORDO":"A083"},{"AGOSTA":"A084"},{"AGRA":"A085"},{"AGRATE BRIANZA":"A087"},{"AGRATE CONTURBIA":"A088"},{"AGRIGENTO":"A089"},{"AGROPOLI":"A091"},{"AGUGLIANO":"A092"},{"AGUGLIARO":"A093"},{"AICURZIO":"A096"},{"AIDOMAGGIORE":"A097"},{"AIDONE":"A098"},{"AIELLI":"A100"},{"AIELLO CALABRO":"A102"},{"AIELLO DEL FRIULI":"A103"},{"AIELLO DEL SABATO":"A101"},{"AIETA":"A105"},{"AILANO":"A106"},{"AILOCHE":"A107"},{"AIRASCA":"A109"},{"AIROLA":"A110"},{"AIROLE":"A111"},{"AIRUNO":"A112"},{"AISONE":"A113"},{"ALA":"A116"},{"ALA DI STURA":"A117"},{"ALA\' DEI SARDI":"A115"},{"ALAGNA":"A118"},{"ALAGNA VALSESIA":"A119"},{"ALANNO":"A120"},{"ALANO DI PIAVE":"A121"},{"ALASSIO":"A122"},{"ALATRI":"A123"},{"ALBA":"A124"},{"ALBA ADRIATICA":"A125"},{"ALBAGIARA":"A126"},{"ALBAIRATE":"A127"},{"ALBANELLA":"A128"},{"ALBANO DI LUCANIA":"A131"},{"ALBANO LAZIALE":"A132"},{"ALBANO SANT\'ALESSANDRO":"A129"},{"ALBANO VERCELLESE":"A130"},{"ALBAREDO ARNABOLDI":"A134"},{"ALBAREDO D\'ADIGE":"A137"},{"ALBAREDO PER SAN MARCO":"A135"},{"ALBARETO":"A138"},{"ALBARETTO DELLA TORRE":"A139"},{"ALBAVILLA":"A143"},{"ALBENGA":"A145"},{"ALBERA LIGURE":"A146"},{"ALBEROBELLO":"A149"},{"ALBERONA":"A150"},{"ALBESE CON CASSANO":"A153"},{"ALBETTONE":"A154"},{"ALBI":"A155"},{"ALBIANO":"A158"},{"ALBIANO D\'IVREA":"A157"},{"ALBIATE":"A159"},{"ALBIDONA":"A160"},{"ALBIGNASEGO":"A161"},{"ALBINEA":"A162"},{"ALBINO":"A163"},{"ALBIOLO":"A164"},{"ALBISOLA MARINA":"A165"},{"ALBISOLA SUPERIORE":"A166"},{"ALBIZZATE":"A167"},{"ALBONESE":"A171"},{"ALBOSAGGIA":"A172"},{"ALBUGNANO":"A173"},{"ALBUZZANO":"A175"},{"ALCAMO":"A176"},{"ALCARA LI FUSI":"A177"},{"ALDENO":"A178"},{"ALDINO":"A179"},{"ALES":"A180"},{"ALESSANDRIA":"A182"},{"ALESSANDRIA DEL CARRETTO":"A183"},{"ALESSANDRIA DELLA ROCCA":"A181"},{"ALESSANO":"A184"},{"ALEZIO":"A185"},{"ALFANO":"A186"},{"ALFEDENA":"A187"},{"ALFIANELLO":"A188"},{"ALFIANO NATTA":"A189"},{"ALFONSINE":"A191"},{"ALGHERO":"A192"},{"ALGUA":"A193"},{"ALI\'":"A194"},{"ALI\' TERME":"A201"},{"ALIA":"A195"},{"ALIANO":"A196"},{"ALICE BEL COLLE":"A197"},{"ALICE CASTELLO":"A198"},{"ALICE SUPERIORE":"A199"},{"ALIFE":"A200"},{"ALIMENA":"A202"},{"ALIMINUSA":"A203"},{"ALLAI":"A204"},{"ALLEGHE":"A206"},{"ALLEIN":"A205"},{"ALLERONA":"A207"},{"ALLISTE":"A208"},{"ALLUMIERE":"A210"},{"ALLUVIONI CAMBIO\'":"A211"},{"ALME\'":"A214"},{"ALMENNO SAN BARTOLOMEO":"A216"},{"ALMENNO SAN SALVATORE":"A217"},{"ALMESE":"A218"},{"ALONTE":"A220"},{"ALPETTE":"A221"},{"ALPIGNANO":"A222"},{"ALSENO":"A223"},{"ALSERIO":"A224"},{"ALTAMURA":"A225"},{"ALTARE":"A226"},{"ALTAVILLA IRPINA":"A228"},{"ALTAVILLA MILICIA":"A229"},{"ALTAVILLA MONFERRATO":"A227"},{"ALTAVILLA SILENTINA":"A230"},{"ALTAVILLA VICENTINA":"A231"},{"ALTIDONA":"A233"},{"ALTILIA":"A234"},{"ALTINO":"A235"},{"ALTISSIMO":"A236"},{"ALTIVOLE":"A237"},{"ALTO":"A238"},{"ALTOFONTE":"A239"},{"ALTOMONTE":"A240"},{"ALTOPASCIO":"A241"},{"ALVIANO":"A242"},{"ALVIGNANO":"A243"},{"ALVITO":"A244"},{"ALZANO LOMBARDO":"A246"},{"ALZANO SCRIVIA":"A245"},{"ALZATE BRIANZA":"A249"},{"AMALFI":"A251"},{"AMANDOLA":"A252"},{"AMANTEA":"A253"},{"AMARO":"A254"},{"AMARONI":"A255"},{"AMASENO":"A256"},{"AMATO":"A257"},{"AMATRICE":"A258"},{"AMBIVERE":"A259"},{"AMBLAR":"A260"},{"AMEGLIA":"A261"},{"AMELIA":"A262"},{"AMENDOLARA":"A263"},{"AMENO":"A264"},{"AMOROSI":"A265"},{"AMPEZZO":"A267"},{"ANACAPRI":"A268"},{"ANAGNI":"A269"},{"ANCARANO":"A270"},{"ANCONA":"A271"},{"ANDALI":"A272"},{"ANDALO":"A274"},{"ANDALO VALTELLINO":"A273"},{"ANDEZENO":"A275"},{"ANDORA":"A278"},{"ANDORLine truncated
|
||||
{"ABANO TERME":"A001","ABBADIA CERRETO":"A004","ABBADIA LARIANA":"A005","ABBADIA SAN SALVATORE":"A006","ABBASANTA":"A007","ABBATEGGIO":"A008","ABBIATEGRASSO":"A010","ABETONE":"A012","ABRIOLA":"A013","ACATE":"A014","ACCADIA":"A015","ACCEGLIO":"A016","ACCETTURA":"A017","ACCIANO":"A018","ACCUMOLI":"A019","ACERENZA":"A020","ACERNO":"A023","ACERRA":"A024","ACI BONACCORSI":"A025","ACI CASTELLO":"A026","ACI CATENA":"A027","ACI SANT'ANTONIO":"A029","ACIREALE":"A028","ACQUACANINA":"A031","ACQUAFONDATA":"A032","ACQUAFORMOSA":"A033","ACQUAFREDDA":"A034","ACQUALAGNA":"A035","ACQUANEGRA CREMONESE":"A039","ACQUANEGRA SUL CHIESE":"A038","ACQUAPENDENTE":"A040","ACQUAPPESA":"A041","ACQUARICA DEL CAPO":"A042","ACQUARO":"A043","ACQUASANTA TERME":"A044","ACQUASPARTA":"A045","ACQUAVIVA COLLECROCE":"A050","ACQUAVIVA D'ISERNIA":"A051","ACQUAVIVA DELLE FONTI":"A048","ACQUAVIVA PICENA":"A047","ACQUAVIVA PLATANI":"A049","ACQUEDOLCI":"M211","ACQUI TERME":"A052","ACRI":"A053","ACUTO":"A054","ADELFIA":"A055","ADRANO":"A056","ADRARA SAN MARTINO":"A057","ADRARA SAN ROCCO":"A058","ADRIA":"A059","ADRO":"A060","AFFI":"A061","AFFILE":"A062","AFRAGOLA":"A064","AFRICO":"A065","AGAZZANO":"A067","AGEROLA":"A068","AGGIUS":"A069","AGIRA":"A070","AGLIANA":"A071","AGLIANO":"A072","AGLIE'":"A074","AGLIENTU":"H848","AGNA":"A075","AGNADELLO":"A076","AGNANA CALABRA":"A077","AGNONE":"A080","AGNOSINE":"A082","AGORDO":"A083","AGOSTA":"A084","AGRA":"A085","AGRATE BRIANZA":"A087","AGRATE CONTURBIA":"A088","AGRIGENTO":"A089","AGROPOLI":"A091","AGUGLIANO":"A092","AGUGLIARO":"A093","AICURZIO":"A096","AIDOMAGGIORE":"A097","AIDONE":"A098","AIELLI":"A100","AIELLO CALABRO":"A102","AIELLO DEL FRIULI":"A103","AIELLO DEL SABATO":"A101","AIETA":"A105","AILANO":"A106","AILOCHE":"A107","AIRASCA":"A109","AIROLA":"A110","AIROLE":"A111","AIRUNO":"A112","AISONE":"A113","ALA":"A116","ALA DI STURA":"A117","ALA' DEI SARDI":"A115","ALAGNA":"A118","ALAGNA VALSESIA":"A119","ALANNO":"A120","ALANO DI PIAVE":"A121","ALASSIO":"A122","ALATRI":"A123","ALBA":"A124","ALBA ADRIATICA":"A125","ALBAGIARA":"A126","ALBAIRATE":"A127","ALBANELLA":"A128","ALBANO DI LUCANIA":"A131","ALBANO LAZIALE":"A132","ALBANO SANT'ALESSANDRO":"A129","ALBANO VERCELLESE":"A130","ALBAREDO ARNABOLDI":"A134","ALBAREDO D'ADIGE":"A137","ALBAREDO PER SAN MARCO":"A135","ALBARETO":"A138","ALBARETTO DELLA TORRE":"A139","ALBAVILLA":"A143","ALBENGA":"A145","ALBERA LIGURE":"A146","ALBEROBELLO":"A149","ALBERONA":"A150","ALBESE CON CASSANO":"A153","ALBETTONE":"A154","ALBI":"A155","ALBIANO":"A158","ALBIANO D'IVREA":"A157","ALBIATE":"A159","ALBIDONA":"A160","ALBIGNASEGO":"A161","ALBINEA":"A162","ALBINO":"A163","ALBIOLO":"A164","ALBISOLA MARINA":"A165","ALBISOLA SUPERIORE":"A166","ALBIZZATE":"A167","ALBONESE":"A171","ALBOSAGGIA":"A172","ALBUGNANO":"A173","ALBUZZANO":"A175","ALCAMO":"A176","ALCARA LI FUSI":"A177","ALDENO":"A178","ALDINO":"A179","ALES":"A180","ALESSANDRIA":"A182","ALESSANDRIA DEL CARRETTO":"A183","ALESSANDRIA DELLA ROCCA":"A181","ALESSANO":"A184","ALEZIO":"A185","ALFANO":"A186","ALFEDENA":"A187","ALFIANELLO":"A188","ALFIANO NATTA":"A189","ALFONSINE":"A191","ALGHERO":"A192","ALGUA":"A193","ALI'":"A194","ALI' TERME":"A201","ALIA":"A195","ALIANO":"A196","ALICE BEL COLLE":"A197","ALICE CASTELLO":"A198","ALICE SUPERIORE":"A199","ALIFE":"A200","ALIMENA":"A202","ALIMINUSA":"A203","ALLAI":"A204","ALLEGHE":"A206","ALLEIN":"A205","ALLERONA":"A207","ALLISTE":"A208","ALLUMIERE":"A210","ALLUVIONI CAMBIO'":"A211","ALME'":"A214","ALMENNO SAN BARTOLOMEO":"A216","ALMENNO SAN SALVATORE":"A217","ALMESE":"A218","ALONTE":"A220","ALPETTE":"A221","ALPIGNANO":"A222","ALSENO":"A223","ALSERIO":"A224","ALTAMURA":"A225","ALTARE":"A226","ALTAVILLA IRPINA":"A228","ALTAVILLA MILICIA":"A229","ALTAVILLA MONFERRATO":"A227","ALTAVILLA SILENTINA":"A230","ALTAVILLA VICENTINA":"A231","ALTIDONA":"A233","ALTILIA":"A234","ALTINO":"A235","ALTISSIMO":"A236","ALTIVOLE":"A237","ALTO":"A238","ALTOFONTE":"A239","ALTOMONTE":"A240","ALTOPASCIO":"A241","ALVIANO":"A242","ALVIGNANO":"A243","ALVITO":"A244","ALZANO LOMBARDO":"A246","ALZANO SCRIVIA":"A245","ALZATE BRIANZA":"A249","AMALFI":"A251","AMANDOLA":"A252","AMANTEA":"A253","AMARO":"A254","AMARONI":"A255","AMASENO":"A256","AMATO":"A257","AMATRICE":"A258","AMBIVERE":"A259","AMBLAR":"A260","AMEGLIA":"A261","AMELIA":"A262","AMENDOLARA":"A263","AMENO":"A264","AMOROSI":"A265","AMPEZZO":"A267","ANACAPRI":"A268","ANAGNI":"A269","ANCARANO":"A270","ANCONA":"A271","ANDALI":"A272","ANDALO":"A274","ANDALO VALTELLINO":"A273","ANDEZENO":"A275","ANDORA":"A278","ANDORNO MICCA":"A280","ANDRANO":"A281","ANDRATE":"A282","ANDREIS":"A283","ANDRETTA":"A284","ANDRIA":"A285","ANDRIANO":"A286","ANELA":"A287","ANFO":"A288","ANGERA":"A290","ANGHIARI":"A291","ANGIARI":"A292","ANGOLO TERME":"A293","ANGRI":"A294","ANGROGNA":"A295","ANGUILLARA SABAZIA":"A297","ANGUILLARA VENETA":"A296","ANNICCO":"A299","ANNONE DI BRIANZA":"A301","ANNONE VENETO":"A302","ANOIA":"A303","ANTEGNATE":"A304","ANTERIVO":"A306","ANTEY-SAINT-ANDRE'":"A305","ANTICOLI COLine truncated
|
||||
@@ -21,6 +21,9 @@
|
||||
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
|
||||
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
|
||||
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
|
||||
682E62E61B4DD3BA00CD5476 /* codFisCodes.json in Resources */ = {isa = PBXBuildFile; fileRef = 682ECFD31B4DCE9C005659B6 /* codFisCodes.json */; };
|
||||
682E62E91B4E78E500CD5476 /* CodFisResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 682E62E81B4E78E500CD5476 /* CodFisResponse.m */; };
|
||||
682ECFD41B4DCE9C005659B6 /* CodFis+Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = 682ECFD21B4DCE9C005659B6 /* CodFis+Helper.m */; };
|
||||
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
|
||||
91AC20C3FDDAB28D136716A5 /* Pods_CodFis_Helper_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 522AA81E364FC60CEA095D19 /* Pods_CodFis_Helper_Example.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -59,6 +62,12 @@
|
||||
6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
|
||||
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
|
||||
682E62E71B4E78E500CD5476 /* CodFisResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodFisResponse.h; sourceTree = "<group>"; };
|
||||
682E62E81B4E78E500CD5476 /* CodFisResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CodFisResponse.m; sourceTree = "<group>"; };
|
||||
682E62EA1B4E79F200CD5476 /* ResponseConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ResponseConstants.h; sourceTree = "<group>"; };
|
||||
682ECFD11B4DCE9C005659B6 /* CodFis+Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CodFis+Helper.h"; sourceTree = "<group>"; };
|
||||
682ECFD21B4DCE9C005659B6 /* CodFis+Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CodFis+Helper.m"; sourceTree = "<group>"; };
|
||||
682ECFD31B4DCE9C005659B6 /* codFisCodes.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = codFisCodes.json; sourceTree = "<group>"; };
|
||||
6840FB021B4D78B5009724FE /* CodFisResources.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodFisResources.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6840FB051B4D78B5009724FE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
69D594011BE85121E72B1E7C /* CodFis-Helper.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = "CodFis-Helper.podspec"; path = "../CodFis-Helper.podspec"; sourceTree = "<group>"; };
|
||||
@@ -141,6 +150,7 @@
|
||||
6003F593195388D20070C39A /* Example for CodFis-Helper */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
682ECFD01B4DCE9C005659B6 /* CodFis-Helper */,
|
||||
6003F59C195388D20070C39A /* CodFisHelperAppDelegate.h */,
|
||||
6003F59D195388D20070C39A /* CodFisHelperAppDelegate.m */,
|
||||
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
|
||||
@@ -193,6 +203,20 @@
|
||||
name = "Podspec Metadata";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
682ECFD01B4DCE9C005659B6 /* CodFis-Helper */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
682ECFD11B4DCE9C005659B6 /* CodFis+Helper.h */,
|
||||
682ECFD21B4DCE9C005659B6 /* CodFis+Helper.m */,
|
||||
682E62E71B4E78E500CD5476 /* CodFisResponse.h */,
|
||||
682E62E81B4E78E500CD5476 /* CodFisResponse.m */,
|
||||
682E62EA1B4E79F200CD5476 /* ResponseConstants.h */,
|
||||
682ECFD31B4DCE9C005659B6 /* codFisCodes.json */,
|
||||
);
|
||||
name = "CodFis-Helper";
|
||||
path = "../../CodFis-Helper";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6840FB031B4D78B5009724FE /* CodFisResources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -326,6 +350,7 @@
|
||||
files = (
|
||||
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */,
|
||||
6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
|
||||
682E62E61B4DD3BA00CD5476 /* codFisCodes.json in Resources */,
|
||||
6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -445,7 +470,9 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
682E62E91B4E78E500CD5476 /* CodFisResponse.m in Sources */,
|
||||
6003F59E195388D20070C39A /* CodFisHelperAppDelegate.m in Sources */,
|
||||
682ECFD41B4DCE9C005659B6 /* CodFis+Helper.m in Sources */,
|
||||
6003F5A7195388D20070C39A /* CodFisHelperViewController.m in Sources */,
|
||||
6003F59A195388D20070C39A /* main.m in Sources */,
|
||||
);
|
||||
@@ -528,7 +555,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -561,7 +588,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
@@ -577,6 +604,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "CodFis-Helper/CodFis-Helper-Prefix.pch";
|
||||
INFOPLIST_FILE = "CodFis-Helper/CodFis-Helper-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -592,6 +620,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "CodFis-Helper/CodFis-Helper-Prefix.pch";
|
||||
INFOPLIST_FILE = "CodFis-Helper/CodFis-Helper-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -720,6 +749,7 @@
|
||||
6840FB081B4D78B5009724FE /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "CodFisHelperAppDelegate.h"
|
||||
#import "CodFis+Helper.h"
|
||||
|
||||
@implementation CodFisHelperAppDelegate
|
||||
|
||||
@@ -16,21 +17,26 @@
|
||||
|
||||
CodFis_Helper *helper = [[CodFis_Helper alloc] init];
|
||||
|
||||
[helper setSurname:@"Nucifora"];
|
||||
[helper setSurname:@"Rose"];
|
||||
|
||||
[helper setName:@"Giuseppe Emanuel"];
|
||||
[helper setName:@"Jean Christophe Domi"];
|
||||
|
||||
[helper setBirthDay:9];
|
||||
[helper setBirthDay:12];
|
||||
|
||||
[helper setBirthMonth:8];
|
||||
[helper setBirthMonth:3];
|
||||
|
||||
[helper setBirthYear:85];
|
||||
[helper setBirthYear:87];
|
||||
|
||||
[helper setGender:Gender_Man];
|
||||
|
||||
[helper setState:Italy];
|
||||
[helper setState:OtherCountries];
|
||||
|
||||
NSLog(@"%@",[helper calculate]);
|
||||
[helper setPlace:@"Maurizio"];
|
||||
|
||||
NSLog(@"%@",[[helper calculate] responseError]);
|
||||
NSLog(@"%@",[[helper calculate] response]);
|
||||
|
||||
NSLog(@"%@",[NSNumber numberWithBool:[helper check:@"TESTCFASDASDASD"]]);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -8,4 +8,5 @@ end
|
||||
target 'CodFis-Helper_Tests', :exclusive => true do
|
||||
pod "CodFis-Helper", :path => "../"
|
||||
|
||||
pod 'FBSnapshotTestCase'
|
||||
end
|
||||
@@ -1,8 +1,14 @@
|
||||
PODS:
|
||||
- CodFis-Helper (0.1.0)
|
||||
- FBSnapshotTestCase (2.0.2):
|
||||
- FBSnapshotTestCase/SwiftSupport (= 2.0.2)
|
||||
- FBSnapshotTestCase/Core (2.0.2)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.2):
|
||||
- FBSnapshotTestCase/Core
|
||||
|
||||
DEPENDENCIES:
|
||||
- CodFis-Helper (from `../`)
|
||||
- FBSnapshotTestCase
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
CodFis-Helper:
|
||||
@@ -10,5 +16,6 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
CodFis-Helper: 16b94c06d9483db0c57582a4b699691e33c8cb0f
|
||||
FBSnapshotTestCase: fd500d5b282c4ec60215d26d0b58b0cf271dd0d6
|
||||
|
||||
COCOAPODS: 0.37.2
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 <FBSnapshotTestCase/FBSnapshotTestCasePlatform.h>
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
/**
|
||||
Similar to our much-loved XCTAssert() macros. Use this to perform your test. No need to write an explanation, though.
|
||||
@param view The view to snapshot
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param suffixes An NSOrderedSet of strings for the different suffixes
|
||||
@param tolerance The percentage of pixels that can differ and still count as an 'identical' view
|
||||
*/
|
||||
#define FBSnapshotVerifyViewWithOptions(view__, identifier__, suffixes__, tolerance__) \
|
||||
{ \
|
||||
NSString *envReferenceImageDirectory = [NSProcessInfo processInfo].environment[@"FB_REFERENCE_IMAGE_DIR"]; \
|
||||
NSError *error__ = nil; \
|
||||
BOOL comparisonSuccess__; \
|
||||
XCTAssertTrue((suffixes__.count > 0), @"Suffixes set cannot be empty %@", suffixes__); \
|
||||
XCTAssertNotNil(envReferenceImageDirectory, @"Missing value for referenceImagesDirectory - Set FB_REFERENCE_IMAGE_DIR as Environment variable in your scheme.");\
|
||||
for (NSString *suffix__ in suffixes__) { \
|
||||
NSString *referenceImagesDirectory__ = [NSString stringWithFormat:@"%@%@", envReferenceImageDirectory, suffix__]; \
|
||||
comparisonSuccess__ = [self compareSnapshotOfView:(view__) referenceImagesDirectory:referenceImagesDirectory__ identifier:(identifier__) tolerance:(tolerance__) error:&error__]; \
|
||||
if (comparisonSuccess__ || self.recordMode) break; \
|
||||
} \
|
||||
XCTAssertTrue(comparisonSuccess__, @"Snapshot comparison failed: %@", error__); \
|
||||
XCTAssertFalse(self.recordMode, @"Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!"); \
|
||||
}
|
||||
|
||||
#define FBSnapshotVerifyView(view__, identifier__) \
|
||||
{ \
|
||||
FBSnapshotVerifyViewWithOptions(view__, identifier__, FBSnapshotTestCaseDefaultSuffixes(), 0); \
|
||||
}
|
||||
|
||||
/**
|
||||
Similar to our much-loved XCTAssert() macros. Use this to perform your test. No need to write an explanation, though.
|
||||
@param layer The layer to snapshot
|
||||
@param identifier An optional identifier, used is there are multiple snapshot tests in a given -test method.
|
||||
@param suffixes An NSOrderedSet of strings for the different suffixes
|
||||
@param tolerance The percentage of pixels that can differ and still count as an 'identical' layer
|
||||
*/
|
||||
#define FBSnapshotVerifyLayerWithOptions(layer__, identifier__, suffixes__, tolerance__) \
|
||||
{ \
|
||||
NSString *envReferenceImageDirectory = [NSProcessInfo processInfo].environment[@"FB_REFERENCE_IMAGE_DIR"]; \
|
||||
NSError *error__ = nil; \
|
||||
BOOL comparisonSuccess__; \
|
||||
XCTAssertTrue((suffixes__.count > 0), @"Suffixes set cannot be empty %@", suffixes__); \
|
||||
XCTAssertNotNil(envReferenceImageDirectory, @"Missing value for referenceImagesDirectory - Set FB_REFERENCE_IMAGE_DIR as Environment variable in your scheme.");\
|
||||
for (NSString *suffix__ in suffixes__) { \
|
||||
NSString *referenceImagesDirectory__ = [NSString stringWithFormat:@"%@%@", envReferenceImageDirectory, suffix__]; \
|
||||
comparisonSuccess__ = [self compareSnapshotOfLayer:(layer__) referenceImagesDirectory:referenceImagesDirectory__ identifier:(identifier__) tolerance:(tolerance__) error:&error__]; \
|
||||
if (comparisonSuccess__ || self.recordMode) break; \
|
||||
} \
|
||||
XCTAssertTrue(comparisonSuccess__, @"Snapshot comparison failed: %@", error__); \
|
||||
XCTAssertFalse(self.recordMode, @"Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!"); \
|
||||
}
|
||||
|
||||
#define FBSnapshotVerifyLayer(layer__, identifier__) \
|
||||
{ \
|
||||
FBSnapshotVerifyLayerWithOptions(layer__, identifier__, FBSnapshotTestCaseDefaultSuffixes(), 0); \
|
||||
}
|
||||
|
||||
/**
|
||||
The base class of view snapshotting tests. If you have small UI component, it's often easier to configure it in a test
|
||||
and compare an image of the view to a reference image that write lots of complex layout-code tests.
|
||||
|
||||
In order to flip the tests in your subclass to record the reference images set @c recordMode to @c YES.
|
||||
|
||||
For example:
|
||||
@code
|
||||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
self.recordMode = YES;
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
@interface FBSnapshotTestCase : XCTestCase
|
||||
|
||||
/**
|
||||
When YES, the test macros will save reference images, rather than performing an actual test.
|
||||
*/
|
||||
@property (readwrite, nonatomic, assign) BOOL recordMode;
|
||||
|
||||
/**
|
||||
Performs the comparison or records a snapshot of the layer if recordMode is YES.
|
||||
@param layer The Layer to snapshot
|
||||
@param referenceImagesDirectory The directory in which reference images are stored.
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param tolerance The percentage difference to still count as identical - 0 mean pixel perfect, 1 means I don't care
|
||||
@param errorPtr An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs the comparison or records a snapshot of the view if recordMode is YES.
|
||||
@param view The view to snapshot
|
||||
@param referenceImagesDirectory The directory in which reference images are stored.
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param tolerance The percentage difference to still count as identical - 0 mean pixel perfect, 1 means I don't care
|
||||
@param errorPtr An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 "FBSnapshotTestCase.h"
|
||||
|
||||
#import "FBSnapshotTestController.h"
|
||||
|
||||
@implementation FBSnapshotTestCase
|
||||
{
|
||||
FBSnapshotTestController *_snapshotController;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
_snapshotController = [[FBSnapshotTestController alloc] initWithTestName:NSStringFromClass([self class])];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
{
|
||||
_snapshotController = nil;
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (BOOL)recordMode
|
||||
{
|
||||
return _snapshotController.recordMode;
|
||||
}
|
||||
|
||||
- (void)setRecordMode:(BOOL)recordMode
|
||||
{
|
||||
NSAssert1(_snapshotController, @"%s cannot be called before [super setUp]", __FUNCTION__);
|
||||
_snapshotController.recordMode = recordMode;
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self _compareSnapshotOfViewOrLayer:layer
|
||||
referenceImagesDirectory:referenceImagesDirectory
|
||||
identifier:identifier
|
||||
tolerance:tolerance
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self _compareSnapshotOfViewOrLayer:view
|
||||
referenceImagesDirectory:referenceImagesDirectory
|
||||
identifier:identifier
|
||||
tolerance:tolerance
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Private API
|
||||
|
||||
- (BOOL)_compareSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
_snapshotController.referenceImagesDirectory = referenceImagesDirectory;
|
||||
return [_snapshotController compareSnapshotOfViewOrLayer:viewOrLayer
|
||||
selector:self.invocation.selector
|
||||
identifier:identifier
|
||||
tolerance:tolerance
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
@end
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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 <Foundation/Foundation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Returns a Boolean value that indicates whether the snapshot test is running in 64Bit.
|
||||
This method is a convenience for creating the suffixes set based on the architecture
|
||||
that the test is running.
|
||||
|
||||
@returns @c YES if the test is running in 64bit, otherwise @c NO.
|
||||
*/
|
||||
BOOL FBSnapshotTestCaseIs64Bit(void);
|
||||
|
||||
/**
|
||||
Returns a default set of strings that is used to append a suffix based on the architectures.
|
||||
@warning Do not modify this function, you can create your own and use it with @c FBSnapshotVerifyViewWithOptions()
|
||||
|
||||
@returns An @c NSOrderedSet object containing strings that are appended to the reference images directory.
|
||||
*/
|
||||
NSOrderedSet *FBSnapshotTestCaseDefaultSuffixes(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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 <FBSnapshotTestCase/FBSnapshotTestCasePlatform.h>
|
||||
|
||||
BOOL FBSnapshotTestCaseIs64Bit(void)
|
||||
{
|
||||
#if __LP64__
|
||||
return YES;
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
NSOrderedSet *FBSnapshotTestCaseDefaultSuffixes(void)
|
||||
{
|
||||
NSMutableOrderedSet *suffixesSet = [[NSMutableOrderedSet alloc] init];
|
||||
[suffixesSet addObject:@"_32"];
|
||||
[suffixesSet addObject:@"_64"];
|
||||
if (FBSnapshotTestCaseIs64Bit()) {
|
||||
return [suffixesSet reversedOrderedSet];
|
||||
}
|
||||
return [suffixesSet copy];
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, FBSnapshotTestControllerErrorCode) {
|
||||
FBSnapshotTestControllerErrorCodeUnknown,
|
||||
FBSnapshotTestControllerErrorCodeNeedsRecord,
|
||||
FBSnapshotTestControllerErrorCodePNGCreationFailed,
|
||||
FBSnapshotTestControllerErrorCodeImagesDifferentSizes,
|
||||
FBSnapshotTestControllerErrorCodeImagesDifferent,
|
||||
};
|
||||
/**
|
||||
Errors returned by the methods of FBSnapshotTestController use this domain.
|
||||
*/
|
||||
extern NSString *const FBSnapshotTestControllerErrorDomain;
|
||||
|
||||
/**
|
||||
Errors returned by the methods of FBSnapshotTestController sometimes contain this key in the `userInfo` dictionary.
|
||||
*/
|
||||
extern NSString *const FBReferenceImageFilePathKey;
|
||||
|
||||
/**
|
||||
Provides the heavy-lifting for FBSnapshotTestCase. It loads and saves images, along with performing the actual pixel-
|
||||
by-pixel comparison of images.
|
||||
Instances are initialized with the test class, and directories to read and write to.
|
||||
*/
|
||||
@interface FBSnapshotTestController : NSObject
|
||||
|
||||
/**
|
||||
Record snapshots.
|
||||
**/
|
||||
@property (readwrite, nonatomic, assign) BOOL recordMode;
|
||||
|
||||
/**
|
||||
@param testClass The subclass of FBSnapshotTestCase that is using this controller.
|
||||
@returns An instance of FBSnapshotTestController.
|
||||
*/
|
||||
- (instancetype)initWithTestClass:(Class)testClass;
|
||||
|
||||
/**
|
||||
Designated initializer.
|
||||
@param testName The name of the tests.
|
||||
@returns An instance of FBSnapshotTestController.
|
||||
*/
|
||||
- (instancetype)initWithTestName:(NSString *)testName;
|
||||
|
||||
|
||||
/**
|
||||
Performs the comparison of the layer.
|
||||
@param layer The Layer to snapshot.
|
||||
@param selector The test method being run.
|
||||
@param identifier An optional identifier, used is there are muliptle snapshot tests in a given -test method.
|
||||
@param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs the comparison of the view.
|
||||
@param view The view to snapshot.
|
||||
@param selector The test method being run.
|
||||
@param identifier An optional identifier, used is there are muliptle snapshot tests in a given -test method.
|
||||
@param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs the comparison of a view or layer.
|
||||
@param view The view or layer to snapshot.
|
||||
@param selector The test method being run.
|
||||
@param identifier An optional identifier, used is there are muliptle snapshot tests in a given -test method.
|
||||
@param tolerance The percentage of pixels that can differ and still be considered 'identical'
|
||||
@param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
|
||||
/**
|
||||
The directory in which referfence images are stored.
|
||||
*/
|
||||
@property (readwrite, nonatomic, copy) NSString *referenceImagesDirectory;
|
||||
|
||||
/**
|
||||
Loads a reference image.
|
||||
@param selector The test method being run.
|
||||
@param identifier The optional identifier, used when multiple images are tested in a single -test method.
|
||||
@param errorPtr An error, if this methods returns nil, the error will be something useful.
|
||||
@returns An image.
|
||||
*/
|
||||
- (UIImage *)referenceImageForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Saves a reference image.
|
||||
@param selector The test method being run.
|
||||
@param identifier The optional identifier, used when multiple images are tested in a single -test method.
|
||||
@param errorPtr An error, if this methods returns NO, the error will be something useful.
|
||||
@returns An image.
|
||||
*/
|
||||
- (BOOL)saveReferenceImage:(UIImage *)image
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs a pixel-by-pixel comparison of the two images with an allowable margin of error.
|
||||
@param referenceImage The reference (correct) image.
|
||||
@param image The image to test against the reference.
|
||||
@param tolerance The percentage of pixels that can differ and still be considered 'identical'
|
||||
@param errorPtr An error that indicates why the comparison failed if it does.
|
||||
@returns YES if the comparison succeeded and the images are the same(ish).
|
||||
*/
|
||||
- (BOOL)compareReferenceImage:(UIImage *)referenceImage
|
||||
toImage:(UIImage *)image
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Saves the reference image and the test image to `failedOutputDirectory`.
|
||||
@param referenceImage The reference (correct) image.
|
||||
@param testImage The image to test against the reference.
|
||||
@param selector The test method being run.
|
||||
@param identifier The optional identifier, used when multiple images are tested in a single -test method.
|
||||
@param errorPtr An error that indicates why the comparison failed if it does.
|
||||
@returns YES if the save succeeded.
|
||||
*/
|
||||
- (BOOL)saveFailedReferenceImage:(UIImage *)referenceImage
|
||||
testImage:(UIImage *)testImage
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
@end
|
||||
+384
@@ -0,0 +1,384 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 "FBSnapshotTestController.h"
|
||||
|
||||
#import "UIImage+Compare.h"
|
||||
#import "UIImage+Diff.h"
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NSString *const FBSnapshotTestControllerErrorDomain = @"FBSnapshotTestControllerErrorDomain";
|
||||
|
||||
NSString *const FBReferenceImageFilePathKey = @"FBReferenceImageFilePathKey";
|
||||
|
||||
@implementation FBSnapshotTestController
|
||||
{
|
||||
NSString *_testName;
|
||||
NSFileManager *_fileManager;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Lifecycle
|
||||
|
||||
- (instancetype)initWithTestClass:(Class)testClass;
|
||||
{
|
||||
return [self initWithTestName:NSStringFromClass(testClass)];
|
||||
}
|
||||
|
||||
- (instancetype)initWithTestName:(NSString *)testName
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_testName = [testName copy];
|
||||
_fileManager = [[NSFileManager alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Properties
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ %@", [super description], _referenceImagesDirectory];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Public API
|
||||
|
||||
- (UIImage *)referenceImageForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
NSString *filePath = [self _referenceFilePathForSelector:selector identifier:identifier];
|
||||
UIImage *image = [UIImage imageWithContentsOfFile:filePath];
|
||||
if (nil == image && NULL != errorPtr) {
|
||||
BOOL exists = [_fileManager fileExistsAtPath:filePath];
|
||||
if (!exists) {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodeNeedsRecord
|
||||
userInfo:@{
|
||||
FBReferenceImageFilePathKey: filePath,
|
||||
NSLocalizedDescriptionKey: @"Unable to load reference image.",
|
||||
NSLocalizedFailureReasonErrorKey: @"Reference image not found. You need to run the test in record mode",
|
||||
}];
|
||||
} else {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodeUnknown
|
||||
userInfo:nil];
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
- (BOOL)saveReferenceImage:(UIImage *)image
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
BOOL didWrite = NO;
|
||||
if (nil != image) {
|
||||
NSString *filePath = [self _referenceFilePathForSelector:selector identifier:identifier];
|
||||
NSData *pngData = UIImagePNGRepresentation(image);
|
||||
if (nil != pngData) {
|
||||
NSError *creationError = nil;
|
||||
BOOL didCreateDir = [_fileManager createDirectoryAtPath:[filePath stringByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&creationError];
|
||||
if (!didCreateDir) {
|
||||
if (NULL != errorPtr) {
|
||||
*errorPtr = creationError;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
didWrite = [pngData writeToFile:filePath options:NSDataWritingAtomic error:errorPtr];
|
||||
if (didWrite) {
|
||||
NSLog(@"Reference image save at: %@", filePath);
|
||||
}
|
||||
} else {
|
||||
if (nil != errorPtr) {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodePNGCreationFailed
|
||||
userInfo:@{
|
||||
FBReferenceImageFilePathKey: filePath,
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
return didWrite;
|
||||
}
|
||||
|
||||
- (BOOL)saveFailedReferenceImage:(UIImage *)referenceImage
|
||||
testImage:(UIImage *)testImage
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
NSData *referencePNGData = UIImagePNGRepresentation(referenceImage);
|
||||
NSData *testPNGData = UIImagePNGRepresentation(testImage);
|
||||
|
||||
NSString *referencePath = [self _failedFilePathForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeFailedReference];
|
||||
|
||||
NSError *creationError = nil;
|
||||
BOOL didCreateDir = [_fileManager createDirectoryAtPath:[referencePath stringByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&creationError];
|
||||
if (!didCreateDir) {
|
||||
if (NULL != errorPtr) {
|
||||
*errorPtr = creationError;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![referencePNGData writeToFile:referencePath options:NSDataWritingAtomic error:errorPtr]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *testPath = [self _failedFilePathForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeFailedTest];
|
||||
|
||||
if (![testPNGData writeToFile:testPath options:NSDataWritingAtomic error:errorPtr]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *diffPath = [self _failedFilePathForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeFailedTestDiff];
|
||||
|
||||
UIImage *diffImage = [referenceImage diffWithImage:testImage];
|
||||
NSData *diffImageData = UIImagePNGRepresentation(diffImage);
|
||||
|
||||
if (![diffImageData writeToFile:diffPath options:NSDataWritingAtomic error:errorPtr]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSLog(@"If you have Kaleidoscope installed you can run this command to see an image diff:\n"
|
||||
@"ksdiff \"%@\" \"%@\"", referencePath, testPath);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)compareReferenceImage:(UIImage *)referenceImage
|
||||
toImage:(UIImage *)image
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr {
|
||||
if (CGSizeEqualToSize(referenceImage.size, image.size)) {
|
||||
|
||||
BOOL imagesEqual = [referenceImage compareWithImage:image tolerance:tolerance];
|
||||
if (NULL != errorPtr) {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodeImagesDifferent
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey: @"Images different",
|
||||
}];
|
||||
}
|
||||
return imagesEqual;
|
||||
}
|
||||
if (NULL != errorPtr) {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodeImagesDifferentSizes
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey: @"Images different sizes",
|
||||
NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"referenceImage:%@, image:%@",
|
||||
NSStringFromCGSize(referenceImage.size),
|
||||
NSStringFromCGSize(image.size)],
|
||||
}];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Private API
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FBTestSnapshotFileNameType) {
|
||||
FBTestSnapshotFileNameTypeReference,
|
||||
FBTestSnapshotFileNameTypeFailedReference,
|
||||
FBTestSnapshotFileNameTypeFailedTest,
|
||||
FBTestSnapshotFileNameTypeFailedTestDiff,
|
||||
};
|
||||
|
||||
- (NSString *)_fileNameForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
fileNameType:(FBTestSnapshotFileNameType)fileNameType
|
||||
{
|
||||
NSString *fileName = nil;
|
||||
switch (fileNameType) {
|
||||
case FBTestSnapshotFileNameTypeFailedReference:
|
||||
fileName = @"reference_";
|
||||
break;
|
||||
case FBTestSnapshotFileNameTypeFailedTest:
|
||||
fileName = @"failed_";
|
||||
break;
|
||||
case FBTestSnapshotFileNameTypeFailedTestDiff:
|
||||
fileName = @"diff_";
|
||||
break;
|
||||
default:
|
||||
fileName = @"";
|
||||
break;
|
||||
}
|
||||
fileName = [fileName stringByAppendingString:NSStringFromSelector(selector)];
|
||||
if (0 < identifier.length) {
|
||||
fileName = [fileName stringByAppendingFormat:@"_%@", identifier];
|
||||
}
|
||||
if ([[UIScreen mainScreen] scale] > 1) {
|
||||
fileName = [fileName stringByAppendingFormat:@"@%.fx", [[UIScreen mainScreen] scale]];
|
||||
}
|
||||
fileName = [fileName stringByAppendingPathExtension:@"png"];
|
||||
return fileName;
|
||||
}
|
||||
|
||||
- (NSString *)_referenceFilePathForSelector:(SEL)selector identifier:(NSString *)identifier
|
||||
{
|
||||
NSString *fileName = [self _fileNameForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeReference];
|
||||
NSString *filePath = [_referenceImagesDirectory stringByAppendingPathComponent:_testName];
|
||||
filePath = [filePath stringByAppendingPathComponent:fileName];
|
||||
return filePath;
|
||||
}
|
||||
|
||||
- (NSString *)_failedFilePathForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
fileNameType:(FBTestSnapshotFileNameType)fileNameType
|
||||
{
|
||||
NSString *fileName = [self _fileNameForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:fileNameType];
|
||||
NSString *folderPath = NSTemporaryDirectory();
|
||||
if (getenv("IMAGE_DIFF_DIR")) {
|
||||
folderPath = @(getenv("IMAGE_DIFF_DIR"));
|
||||
}
|
||||
NSString *filePath = [folderPath stringByAppendingPathComponent:_testName];
|
||||
filePath = [filePath stringByAppendingPathComponent:fileName];
|
||||
return filePath;
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self compareSnapshotOfViewOrLayer:layer
|
||||
selector:selector
|
||||
identifier:identifier
|
||||
tolerance:0
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self compareSnapshotOfViewOrLayer:view
|
||||
selector:selector
|
||||
identifier:identifier
|
||||
tolerance:0
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
if (self.recordMode) {
|
||||
return [self _recordSnapshotOfViewOrLayer:viewOrLayer selector:selector identifier:identifier error:errorPtr];
|
||||
} else {
|
||||
return [self _performPixelComparisonWithViewOrLayer:viewOrLayer selector:selector identifier:identifier tolerance:tolerance error:errorPtr];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Private API
|
||||
|
||||
- (BOOL)_performPixelComparisonWithViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
UIImage *referenceImage = [self referenceImageForSelector:selector identifier:identifier error:errorPtr];
|
||||
if (nil != referenceImage) {
|
||||
UIImage *snapshot = [self _snapshotViewOrLayer:viewOrLayer];
|
||||
BOOL imagesSame = [self compareReferenceImage:referenceImage toImage:snapshot tolerance:tolerance error:errorPtr];
|
||||
if (!imagesSame) {
|
||||
[self saveFailedReferenceImage:referenceImage
|
||||
testImage:snapshot
|
||||
selector:selector
|
||||
identifier:identifier
|
||||
error:errorPtr];
|
||||
}
|
||||
return imagesSame;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)_recordSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
UIImage *snapshot = [self _snapshotViewOrLayer:viewOrLayer];
|
||||
return [self saveReferenceImage:snapshot selector:selector identifier:identifier error:errorPtr];
|
||||
}
|
||||
|
||||
- (UIImage *)_snapshotViewOrLayer:(id)viewOrLayer
|
||||
{
|
||||
CALayer *layer = nil;
|
||||
|
||||
if ([viewOrLayer isKindOfClass:[UIView class]]) {
|
||||
return [self _renderView:viewOrLayer];
|
||||
} else if ([viewOrLayer isKindOfClass:[CALayer class]]) {
|
||||
layer = (CALayer *)viewOrLayer;
|
||||
[layer layoutIfNeeded];
|
||||
return [self _renderLayer:layer];
|
||||
} else {
|
||||
[NSException raise:@"Only UIView and CALayer classes can be snapshotted" format:@"%@", viewOrLayer];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UIImage *)_renderLayer:(CALayer *)layer
|
||||
{
|
||||
CGRect bounds = layer.bounds;
|
||||
|
||||
NSAssert1(CGRectGetWidth(bounds), @"Zero width for layer %@", layer);
|
||||
NSAssert1(CGRectGetHeight(bounds), @"Zero height for layer %@", layer);
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
NSAssert1(context, @"Could not generate context for layer %@", layer);
|
||||
|
||||
CGContextSaveGState(context);
|
||||
{
|
||||
[layer renderInContext:context];
|
||||
}
|
||||
CGContextRestoreGState(context);
|
||||
|
||||
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
- (UIImage *)_renderView:(UIView *)view
|
||||
{
|
||||
[view layoutIfNeeded];
|
||||
return [self _renderLayer:view.layer];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
public extension FBSnapshotTestCase {
|
||||
public func FBSnapshotVerifyView(view: UIView, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), file: String = __FILE__, line: UInt = __LINE__) {
|
||||
let envReferenceImageDirectory = NSProcessInfo.processInfo().environment["FB_REFERENCE_IMAGE_DIR"] as? String
|
||||
var error: NSError?
|
||||
|
||||
if let envReferenceImageDirectory = envReferenceImageDirectory {
|
||||
for suffix in suffixes {
|
||||
let referenceImagesDirectory = "\(envReferenceImageDirectory)\(suffix)"
|
||||
let comparisonSuccess = compareSnapshotOfView(view, referenceImagesDirectory: referenceImagesDirectory, identifier: identifier, tolerance: 0, error: &error)
|
||||
if comparisonSuccess || recordMode {
|
||||
break
|
||||
}
|
||||
|
||||
assert(comparisonSuccess, message: "Snapshot comparison failed: \(error)", file: file, line: line)
|
||||
assert(recordMode == false, message: "Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!", file: file, line: line)
|
||||
}
|
||||
} else {
|
||||
assert(false, message: "Missing value for referenceImagesDirectory - Set FB_REFERENCE_IMAGE_DIR as Environment variable in your scheme.", file: file, line: line)
|
||||
}
|
||||
}
|
||||
|
||||
public func FBSnapshotVerifyLayer(layer: CALayer, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), file: String = __FILE__, line: UInt = __LINE__) {
|
||||
let envReferenceImageDirectory = NSProcessInfo.processInfo().environment["FB_REFERENCE_IMAGE_DIR"] as? String
|
||||
var error: NSError?
|
||||
var comparisonSuccess = false
|
||||
|
||||
if let envReferenceImageDirectory = envReferenceImageDirectory {
|
||||
for suffix in suffixes {
|
||||
let referenceImagesDirectory = "\(envReferenceImageDirectory)\(suffix)"
|
||||
comparisonSuccess = compareSnapshotOfLayer(layer, referenceImagesDirectory: referenceImagesDirectory, identifier: identifier, tolerance: 0, error: &error)
|
||||
if comparisonSuccess || recordMode {
|
||||
break
|
||||
}
|
||||
|
||||
assert(comparisonSuccess, message: "Snapshot comparison failed: \(error)", file: file, line: line)
|
||||
assert(recordMode == false, message: "Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!", file: file, line: line)
|
||||
}
|
||||
} else {
|
||||
XCTFail("Missing value for referenceImagesDirectory - Set FB_REFERENCE_IMAGE_DIR as Environment variable in your scheme.")
|
||||
}
|
||||
}
|
||||
|
||||
func assert(assertion: Bool, message: String, file: String, line: UInt) {
|
||||
if !assertion {
|
||||
XCTFail(message, file: file, line: line)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIImage (Compare)
|
||||
|
||||
- (BOOL)compareWithImage:(UIImage *)image tolerance:(CGFloat)tolerance;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "UIImage+Compare.h"
|
||||
|
||||
// This makes debugging much more fun
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
unsigned char bytes[4];
|
||||
struct {
|
||||
char red;
|
||||
char green;
|
||||
char blue;
|
||||
char alpha;
|
||||
} __attribute__ ((packed)) pixels;
|
||||
} FBComparePixel;
|
||||
|
||||
@implementation UIImage (Compare)
|
||||
|
||||
- (BOOL)compareWithImage:(UIImage *)image tolerance:(CGFloat)tolerance
|
||||
{
|
||||
NSAssert(CGSizeEqualToSize(self.size, image.size), @"Images must be same size.");
|
||||
|
||||
CGSize referenceImageSize = CGSizeMake(CGImageGetWidth(self.CGImage), CGImageGetHeight(self.CGImage));
|
||||
CGSize imageSize = CGSizeMake(CGImageGetWidth(image.CGImage), CGImageGetHeight(image.CGImage));
|
||||
|
||||
// The images have the equal size, so we could use the smallest amount of bytes because of byte padding
|
||||
size_t minBytesPerRow = MIN(CGImageGetBytesPerRow(self.CGImage), CGImageGetBytesPerRow(image.CGImage));
|
||||
size_t referenceImageSizeBytes = referenceImageSize.height * minBytesPerRow;
|
||||
void *referenceImagePixels = calloc(1, referenceImageSizeBytes);
|
||||
void *imagePixels = calloc(1, referenceImageSizeBytes);
|
||||
|
||||
if (!referenceImagePixels || !imagePixels) {
|
||||
free(referenceImagePixels);
|
||||
free(imagePixels);
|
||||
return NO;
|
||||
}
|
||||
|
||||
CGContextRef referenceImageContext = CGBitmapContextCreate(referenceImagePixels,
|
||||
referenceImageSize.width,
|
||||
referenceImageSize.height,
|
||||
CGImageGetBitsPerComponent(self.CGImage),
|
||||
minBytesPerRow,
|
||||
CGImageGetColorSpace(self.CGImage),
|
||||
(CGBitmapInfo)kCGImageAlphaPremultipliedLast
|
||||
);
|
||||
CGContextRef imageContext = CGBitmapContextCreate(imagePixels,
|
||||
imageSize.width,
|
||||
imageSize.height,
|
||||
CGImageGetBitsPerComponent(image.CGImage),
|
||||
minBytesPerRow,
|
||||
CGImageGetColorSpace(image.CGImage),
|
||||
(CGBitmapInfo)kCGImageAlphaPremultipliedLast
|
||||
);
|
||||
|
||||
if (!referenceImageContext || !imageContext) {
|
||||
CGContextRelease(referenceImageContext);
|
||||
CGContextRelease(imageContext);
|
||||
free(referenceImagePixels);
|
||||
free(imagePixels);
|
||||
return NO;
|
||||
}
|
||||
|
||||
CGContextDrawImage(referenceImageContext, CGRectMake(0, 0, referenceImageSize.width, referenceImageSize.height), self.CGImage);
|
||||
CGContextDrawImage(imageContext, CGRectMake(0, 0, imageSize.width, imageSize.height), image.CGImage);
|
||||
|
||||
CGContextRelease(referenceImageContext);
|
||||
CGContextRelease(imageContext);
|
||||
|
||||
BOOL imageEqual = YES;
|
||||
|
||||
// Do a fast compare if we can
|
||||
if (tolerance == 0) {
|
||||
imageEqual = (memcmp(referenceImagePixels, imagePixels, referenceImageSizeBytes) == 0);
|
||||
} else {
|
||||
// Go through each pixel in turn and see if it is different
|
||||
const NSInteger pixelCount = self.size.width * self.size.height;
|
||||
|
||||
FBComparePixel *p1 = referenceImagePixels;
|
||||
FBComparePixel *p2 = imagePixels;
|
||||
|
||||
NSInteger numDiffPixels = 0;
|
||||
for (int n = 0; n < pixelCount; ++n) {
|
||||
// If this pixel is different, increment the pixel diff count and see
|
||||
// if we have hit our limit.
|
||||
if (p1->raw != p2->raw) {
|
||||
numDiffPixels ++;
|
||||
|
||||
CGFloat percent = (CGFloat)numDiffPixels / pixelCount;
|
||||
if (percent > tolerance) {
|
||||
imageEqual = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
}
|
||||
|
||||
free(referenceImagePixels);
|
||||
free(imagePixels);
|
||||
|
||||
return imageEqual;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIImage (Diff)
|
||||
|
||||
- (UIImage *)diffWithImage:(UIImage *)image;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "UIImage+Diff.h"
|
||||
|
||||
@implementation UIImage (Diff)
|
||||
|
||||
- (UIImage *)diffWithImage:(UIImage *)image
|
||||
{
|
||||
if (!image) {
|
||||
return nil;
|
||||
}
|
||||
CGSize imageSize = CGSizeMake(MAX(self.size.width, image.size.width), MAX(self.size.height, image.size.height));
|
||||
UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
[self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)];
|
||||
CGContextSetAlpha(context, 0.5);
|
||||
CGContextBeginTransparencyLayer(context, NULL);
|
||||
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
CGContextSetBlendMode(context, kCGBlendModeDifference);
|
||||
CGContextSetFillColorWithColor(context,[UIColor whiteColor].CGColor);
|
||||
CGContextFillRect(context, CGRectMake(0, 0, self.size.width, self.size.height));
|
||||
CGContextEndTransparencyLayer(context);
|
||||
UIImage *returnImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return returnImage;
|
||||
}
|
||||
|
||||
@end
|
||||
Generated
+29
@@ -0,0 +1,29 @@
|
||||
BSD License
|
||||
|
||||
For the FBSnapshotTestCase software
|
||||
|
||||
Copyright (c) 2013, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name Facebook nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
FBSnapshotTestCase
|
||||
======================
|
||||
|
||||
[](https://travis-ci.org/facebook/ios-snapshot-test-case) [](http://cocoadocs.org/docsets/FBSnapshotTestCase/)
|
||||
|
||||
What it does
|
||||
------------
|
||||
|
||||
A "snapshot test case" takes a configured `UIView` or `CALayer` and uses the
|
||||
`renderInContext:` method to get an image snapshot of its contents. It
|
||||
compares this snapshot to a "reference image" stored in your source code
|
||||
repository and fails the test if the two images don't match.
|
||||
|
||||
Why?
|
||||
----
|
||||
|
||||
At Facebook we write a lot of UI code. As you might imagine, each type of
|
||||
feed story is rendered using a subclass of `UIView`. There are a lot of edge
|
||||
cases that we want to handle correctly:
|
||||
|
||||
- What if there is more text than can fit in the space available?
|
||||
- What if an image doesn't match the size of an image view?
|
||||
- What should the highlighted state look like?
|
||||
|
||||
It's straightforward to test logic code, but less obvious how you should test
|
||||
views. You can do a lot of rectangle asserts, but these are hard to understand
|
||||
or visualize. Looking at an image diff shows you exactly what changed and how
|
||||
it will look to users.
|
||||
|
||||
We developed `FBSnapshotTestCase` to make snapshot tests easy.
|
||||
|
||||
Installation with CocoaPods
|
||||
---------------------------
|
||||
|
||||
1. Add the following lines to your Podfile:
|
||||
|
||||
```
|
||||
target "Tests" do
|
||||
pod 'FBSnapshotTestCase'
|
||||
end
|
||||
```
|
||||
|
||||
If you support iOS 7 use `FBSnapshotTestCase/Core` instead, which doesn't contain Swift support.
|
||||
|
||||
Replace "Tests" with the name of your test project.
|
||||
|
||||
2. Define `FB_REFERENCE_IMAGE_DIR` in your scheme. This should
|
||||
point to the directory where you want reference images to be stored. At Facebook,
|
||||
we normally use this:
|
||||
|
||||
|Name|Value|
|
||||
|:---|:----|
|
||||
|`FB_REFERENCE_IMAGE_DIR`|`$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/ReferenceImages`|
|
||||
|
||||
|
||||

|
||||
|
||||
Creating a snapshot test
|
||||
------------------------
|
||||
|
||||
1. Subclass `FBSnapshotTestCase` instead of `XCTestCase`.
|
||||
2. From within your test, use `FBSnapshotVerifyView`.
|
||||
3. Run the test once with `self.recordMode = YES;` in the test's `-setUp`
|
||||
method. (This creates the reference images on disk.)
|
||||
4. Remove the line enabling record mode and run the test.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Automatically names reference images on disk according to test class and
|
||||
selector.
|
||||
- Prints a descriptive error message to the console on failure. (Bonus:
|
||||
failure message includes a one-line command to see an image diff if
|
||||
you have [Kaleidoscope](http://www.kaleidoscopeapp.com) installed.)
|
||||
- Supply an optional "identifier" if you want to perform multiple snapshots
|
||||
in a single test method.
|
||||
- Support for `CALayer` via `FBSnapshotVerifyLayer`.
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
Your unit test must be an "application test", not a "logic test." (That is, it
|
||||
must be run within the Simulator so that it has access to UIKit.) In Xcode 5
|
||||
and later new projects only offer application tests, but older projects will
|
||||
have separate targets for the two types.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
`FBSnapshotTestCase` was written at Facebook by
|
||||
[Jonathan Dann](https://facebook.com/j.p.dann) with significant contributions by
|
||||
[Todd Krabach](https://facebook.com/toddkrabach).
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
`FBSnapshotTestCase` is BSD-licensed. See `LICENSE`.
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestCase.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestCasePlatform.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestController.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/UIImage+Compare.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/UIImage+Diff.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestCase.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestCasePlatform.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestController.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/UIImage+Compare.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../FBSnapshotTestCase/FBSnapshotTestCase/UIImage+Diff.h
|
||||
Generated
+7
@@ -1,8 +1,14 @@
|
||||
PODS:
|
||||
- CodFis-Helper (0.1.0)
|
||||
- FBSnapshotTestCase (2.0.2):
|
||||
- FBSnapshotTestCase/SwiftSupport (= 2.0.2)
|
||||
- FBSnapshotTestCase/Core (2.0.2)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.2):
|
||||
- FBSnapshotTestCase/Core
|
||||
|
||||
DEPENDENCIES:
|
||||
- CodFis-Helper (from `../`)
|
||||
- FBSnapshotTestCase
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
CodFis-Helper:
|
||||
@@ -10,5 +16,6 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
CodFis-Helper: 16b94c06d9483db0c57582a4b699691e33c8cb0f
|
||||
FBSnapshotTestCase: fd500d5b282c4ec60215d26d0b58b0cf271dd0d6
|
||||
|
||||
COCOAPODS: 0.37.2
|
||||
+766
-515
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "25C88DDA6FC26EF63AFCBCCE"
|
||||
BlueprintIdentifier = "ADB261BDD4DF67A60AAD892E"
|
||||
BuildableName = "CodFis-Helper.bundle"
|
||||
BlueprintName = "Pods-CodFis-Helper_Example-CodFis-Helper-CodFis-Helper"
|
||||
ReferencedContainer = "container:Pods.xcodeproj">
|
||||
|
||||
Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-CodFis-Helper_Example-CodFis-Helper.xcscheme
Generated
+1
-1
@@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1280F924D5223B5FEB6CF976"
|
||||
BlueprintIdentifier = "FD508D06D3936BDA8CAF7646"
|
||||
BuildableName = "CodFis_Helper.framework"
|
||||
BlueprintName = "Pods-CodFis-Helper_Example-CodFis-Helper"
|
||||
ReferencedContainer = "container:Pods.xcodeproj">
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "E8B2CB4980C2740F02C576A5"
|
||||
BlueprintIdentifier = "A985A3E0A157915C3311A610"
|
||||
BuildableName = "CodFis-Helper.bundle"
|
||||
BlueprintName = "Pods-CodFis-Helper_Tests-CodFis-Helper-CodFis-Helper"
|
||||
ReferencedContainer = "container:Pods.xcodeproj">
|
||||
|
||||
Generated
+1
-1
@@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "050961C76F8E2B642599D81B"
|
||||
BlueprintIdentifier = "9E17CB4EA20D4DB70300B8AF"
|
||||
BuildableName = "CodFis_Helper.framework"
|
||||
BlueprintName = "Pods-CodFis-Helper_Tests-CodFis-Helper"
|
||||
ReferencedContainer = "container:Pods.xcodeproj">
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
|
||||
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CodFis-Helper" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CodFis-Helper"
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CodFis-Helper" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/FBSnapshotTestCase"
|
||||
OTHER_LDFLAGS = -ObjC
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-CodFis-Helper_Example
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
|
||||
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CodFis-Helper" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CodFis-Helper"
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CodFis-Helper" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/FBSnapshotTestCase"
|
||||
OTHER_LDFLAGS = -ObjC
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-CodFis-Helper_Tests
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#include "Pods-CodFis-Helper_Tests-FBSnapshotTestCase.xcconfig"
|
||||
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
|
||||
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH" ${PODS_CODFIS_HELPER_TESTS_FBSNAPSHOTTESTCASE_FRAMEWORK_SEARCH_PATHS}
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FBSnapshotTestCase" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/FBSnapshotTestCase"
|
||||
OTHER_LDFLAGS = ${PODS_CODFIS_HELPER_TESTS_FBSNAPSHOTTESTCASE_OTHER_LDFLAGS} -ObjC
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-CodFis-Helper_Tests
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
SKIP_INSTALL = YES
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Pods_CodFis_Helper_Tests_FBSnapshotTestCase : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Pods_CodFis_Helper_Tests_FBSnapshotTestCase
|
||||
@end
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
#import "Pods-CodFis-Helper_Tests-environment.h"
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "FBSnapshotTestCase.h"
|
||||
#import "FBSnapshotTestCasePlatform.h"
|
||||
#import "FBSnapshotTestCase.h"
|
||||
#import "FBSnapshotTestCasePlatform.h"
|
||||
#import "FBSnapshotTestController.h"
|
||||
#import "UIImage+Compare.h"
|
||||
#import "UIImage+Diff.h"
|
||||
|
||||
FOUNDATION_EXPORT double FBSnapshotTestCaseVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char FBSnapshotTestCaseVersionString[];
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
framework module FBSnapshotTestCase {
|
||||
umbrella header "Pods-CodFis-Helper_Tests-FBSnapshotTestCase-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
|
||||
private header "FBSnapshotTestController.h"
|
||||
private header "UIImage+Compare.h"
|
||||
private header "UIImage+Diff.h"
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
PODS_CODFIS_HELPER_TESTS_FBSNAPSHOTTESTCASE_FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
PODS_CODFIS_HELPER_TESTS_FBSNAPSHOTTESTCASE_OTHER_LDFLAGS = -framework "XCTest"
|
||||
+33
@@ -23,4 +23,37 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## FBSnapshotTestCase
|
||||
|
||||
BSD License
|
||||
|
||||
For the FBSnapshotTestCase software
|
||||
|
||||
Copyright (c) 2013, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name Facebook nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Generated by CocoaPods - http://cocoapods.org
|
||||
+37
@@ -39,6 +39,43 @@ THE SOFTWARE.
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>BSD License
|
||||
|
||||
For the FBSnapshotTestCase software
|
||||
|
||||
Copyright (c) 2013, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name Facebook nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>FBSnapshotTestCase</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Generated by CocoaPods - http://cocoapods.org</string>
|
||||
|
||||
Generated
+18
@@ -12,3 +12,21 @@
|
||||
#define COCOAPODS_VERSION_MINOR_CodFis_Helper 1
|
||||
#define COCOAPODS_VERSION_PATCH_CodFis_Helper 0
|
||||
|
||||
// FBSnapshotTestCase
|
||||
#define COCOAPODS_POD_AVAILABLE_FBSnapshotTestCase
|
||||
#define COCOAPODS_VERSION_MAJOR_FBSnapshotTestCase 2
|
||||
#define COCOAPODS_VERSION_MINOR_FBSnapshotTestCase 0
|
||||
#define COCOAPODS_VERSION_PATCH_FBSnapshotTestCase 2
|
||||
|
||||
// FBSnapshotTestCase/Core
|
||||
#define COCOAPODS_POD_AVAILABLE_FBSnapshotTestCase_Core
|
||||
#define COCOAPODS_VERSION_MAJOR_FBSnapshotTestCase_Core 2
|
||||
#define COCOAPODS_VERSION_MINOR_FBSnapshotTestCase_Core 0
|
||||
#define COCOAPODS_VERSION_PATCH_FBSnapshotTestCase_Core 2
|
||||
|
||||
// FBSnapshotTestCase/SwiftSupport
|
||||
#define COCOAPODS_POD_AVAILABLE_FBSnapshotTestCase_SwiftSupport
|
||||
#define COCOAPODS_VERSION_MAJOR_FBSnapshotTestCase_SwiftSupport 2
|
||||
#define COCOAPODS_VERSION_MINOR_FBSnapshotTestCase_SwiftSupport 0
|
||||
#define COCOAPODS_VERSION_PATCH_FBSnapshotTestCase_SwiftSupport 2
|
||||
|
||||
Generated
+2
@@ -49,7 +49,9 @@ code_sign() {
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework 'CodFis_Helper.framework'
|
||||
install_framework 'FBSnapshotTestCase.framework'
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework 'CodFis_Helper.framework'
|
||||
install_framework 'FBSnapshotTestCase.framework'
|
||||
fi
|
||||
Generated
+3
-2
@@ -1,8 +1,9 @@
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_FRAMEWORK_BUILD_PATH"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/CodFis_Helper.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -framework "CodFis_Helper"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/CodFis_Helper.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/FBSnapshotTestCase.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -framework "CodFis_Helper" -framework "FBSnapshotTestCase"
|
||||
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-CodFis-Helper_Tests
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
Example/Pods/Target Support Files/Pods-CodFis-Helper_Tests/Pods-CodFis-Helper_Tests.release.xcconfig
Generated
+3
-2
@@ -1,8 +1,9 @@
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_FRAMEWORK_BUILD_PATH"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/CodFis_Helper.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -framework "CodFis_Helper"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/CodFis_Helper.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/FBSnapshotTestCase.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -framework "CodFis_Helper" -framework "FBSnapshotTestCase"
|
||||
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-CodFis-Helper_Tests
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
Reference in new issue
Block a user