mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-08 05:55:13 +00:00
Fix some best app icon finding issues
In some cases the algorithm didn't find any icon, even if they are there
This commit is contained in:
@@ -93,8 +93,9 @@
|
||||
- (void)testValidAppIconFilename {
|
||||
NSString *resultString = nil;
|
||||
NSBundle *mockBundle = mock([NSBundle class]);
|
||||
NSString *validIconPath = [[NSBundle bundleForClass:self.class] pathForResource:@"AppIcon" ofType:@"png"];
|
||||
NSString *validIconPath2x = [[NSBundle bundleForClass:self.class] pathForResource:@"AppIcon@2x" ofType:@"png"];
|
||||
NSBundle *resourceBundle = [NSBundle bundleForClass:self.class];
|
||||
NSString *validIconPath = @"AppIcon";
|
||||
NSString *validIconPath2x = @"AppIcon@2x";
|
||||
|
||||
// No valid icons defined at all
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFiles"]) willReturn:nil];
|
||||
@@ -102,7 +103,7 @@
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons~ipad"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:@"invalidFilename.png"];
|
||||
|
||||
resultString = bit_validAppIconFilename(mockBundle);
|
||||
resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
assertThat(resultString, nilValue());
|
||||
|
||||
// CFBundleIconFiles contains valid filenames
|
||||
@@ -111,7 +112,7 @@
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons~ipad"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:nil];
|
||||
|
||||
resultString = bit_validAppIconFilename(mockBundle);
|
||||
resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
assertThat(resultString, notNilValue());
|
||||
|
||||
// CFBundleIcons contains valid dictionary filenames
|
||||
@@ -126,7 +127,7 @@
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons~ipad"]) willReturn:@{@"CFBundlePrimaryIcon":@{@"CFBundleIconFiles":@[validIconPath, validIconPath2x]}}];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:nil];
|
||||
|
||||
resultString = bit_validAppIconFilename(mockBundle);
|
||||
resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
assertThat(resultString, notNilValue());
|
||||
|
||||
// CFBundleIcons contains valid filenames
|
||||
@@ -135,7 +136,7 @@
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons~ipad"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:nil];
|
||||
|
||||
resultString = bit_validAppIconFilename(mockBundle);
|
||||
resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
assertThat(resultString, notNilValue());
|
||||
|
||||
// CFBundleIcon contains valid filename
|
||||
@@ -144,7 +145,7 @@
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons~ipad"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:validIconPath];
|
||||
|
||||
resultString = bit_validAppIconFilename(mockBundle);
|
||||
resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
assertThat(resultString, notNilValue());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user