This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 252
Add ability to exclude OS version from snapshot file name #158
Open
nathanshox
wants to merge
1
commit into
facebookarchive:master
Choose a base branch
from
nathanshox:add-includeOSVersionInFilename-to-FBSnapshotTestCase
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,10 +105,25 @@ - (void)testFailedImageWithDeviceAgnosticShouldHaveModelOnName | |
SEL selector = @selector(isDeviceAgnostic); | ||
[controller referenceImageForSelector:selector identifier:@"" error:&error]; | ||
XCTAssertNotNil(error); | ||
NSString *deviceAgnosticReferencePath = FBDeviceAgnosticNormalizedFileName(NSStringFromSelector(selector)); | ||
NSString *deviceAgnosticReferencePath = FBDeviceAgnosticNormalizedFileName(NSStringFromSelector(selector), true); | ||
XCTAssertTrue([(NSString *)[error.userInfo objectForKey:FBReferenceImageFilePathKey] containsString:deviceAgnosticReferencePath]); | ||
} | ||
|
||
- (void)testFilenameDoesNotContainOSVersionWhenIncludeOSInFilenameIsFalse | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and then we right a robust set of tests |
||
{ | ||
FBSnapshotTestController *controller = [[FBSnapshotTestController alloc] initWithTestClass:nil]; | ||
[controller setDeviceAgnostic:YES]; | ||
[controller setIncludeOSVersionInFilename:NO]; | ||
|
||
[controller setReferenceImagesDirectory:@"/dev/null/"]; | ||
NSError *error = nil; | ||
SEL selector = @selector(includeOSVersionInFilename); | ||
[controller referenceImageForSelector:selector identifier:@"" error:&error]; | ||
XCTAssertNotNil(error); | ||
NSString *includeOSVersionInFilenameReferencePath = FBDeviceAgnosticNormalizedFileName(NSStringFromSelector(selector), false); | ||
XCTAssertTrue([(NSString *)[error.userInfo objectForKey:FBReferenceImageFilePathKey] containsString:includeOSVersionInFilenameReferencePath]); | ||
} | ||
|
||
#pragma mark - Private helper methods | ||
|
||
- (UIImage *)_bundledImageNamed:(NSString *)name type:(NSString *)type | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this from a
BOOL
to an enum where we could select what information to append? The default value will accommodate all of them. I want to avoid a specific property just for the name OS version.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is a nicer solution. I was planning on a follow up PR to this one that used more descriptive device names in the snapshot filenames, rather than just using model names, so maybe you can give me some feedback on that idea now, and I might be able to incorporate it into this?
Basically my rationale is that it isn't easy to determine if a snapshot is for an iPhone 6, or a 6 Plus from the filename. While the use of the device model (iPhone or iPad) and size dimensions give you some idea of what it is, having
iPhone6
oriPhone6Plus
in the file name is more readable.Would it be preferable to replace device model with more descriptive device names, or make descriptive device names a further option? I'd prefer to replace, but it would be a breaking change for everybody using
deviceAgnostic = true
.