mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-22 03:58:47 +00:00
Add tests for exotic AppIcon filename variations
This commit is contained in:
@@ -374,6 +374,12 @@
|
||||
80807B8E1C46BF2F00F4C44F /* OCMockitoIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 80807B8B1C46BF2F00F4C44F /* OCMockitoIOS.framework */; };
|
||||
80807B8F1C46BF2F00F4C44F /* OCMockitoIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 80807B8B1C46BF2F00F4C44F /* OCMockitoIOS.framework */; };
|
||||
80807B901C46C01E00F4C44F /* BITUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 8034E6681BA31D7C00D83A30 /* BITUser.m */; };
|
||||
8085BB851CBF1FA60023FD9B /* AppIcon.exotic.png in Resources */ = {isa = PBXBuildFile; fileRef = 8085BB831CBF1FA60023FD9B /* AppIcon.exotic.png */; };
|
||||
8085BB861CBF1FA60023FD9B /* AppIcon.exotic.png in Resources */ = {isa = PBXBuildFile; fileRef = 8085BB831CBF1FA60023FD9B /* AppIcon.exotic.png */; };
|
||||
8085BB871CBF1FA60023FD9B /* AppIcon.exotic@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8085BB841CBF1FA60023FD9B /* AppIcon.exotic@2x.png */; };
|
||||
8085BB881CBF1FA60023FD9B /* AppIcon.exotic@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8085BB841CBF1FA60023FD9B /* AppIcon.exotic@2x.png */; };
|
||||
8085BB8A1CBF216E0023FD9B /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8085BB891CBF216E0023FD9B /* Icon.png */; };
|
||||
8085BB8B1CBF216E0023FD9B /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8085BB891CBF216E0023FD9B /* Icon.png */; };
|
||||
80A4662F1C58F4DF00199909 /* BITCrashReportTextFormatterPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 80A4662D1C58F4DF00199909 /* BITCrashReportTextFormatterPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
80B1C4EE1C8A6F950057A5CB /* BITUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8034E6671BA31D7C00D83A30 /* BITUser.h */; };
|
||||
80B1C4EF1C8A72620057A5CB /* HockeySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EB6173F1B0A30480035A986 /* HockeySDK.framework */; };
|
||||
@@ -687,6 +693,9 @@
|
||||
808441721C20617C00644A40 /* OCMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObject.h; sourceTree = "<group>"; };
|
||||
808441731C20617C00644A40 /* OCMRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMRecorder.h; sourceTree = "<group>"; };
|
||||
808441741C20617C00644A40 /* OCMStubRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMStubRecorder.h; sourceTree = "<group>"; };
|
||||
8085BB831CBF1FA60023FD9B /* AppIcon.exotic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AppIcon.exotic.png; sourceTree = "<group>"; };
|
||||
8085BB841CBF1FA60023FD9B /* AppIcon.exotic@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AppIcon.exotic@2x.png"; sourceTree = "<group>"; };
|
||||
8085BB891CBF216E0023FD9B /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
|
||||
80A4662D1C58F4DF00199909 /* BITCrashReportTextFormatterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashReportTextFormatterPrivate.h; sourceTree = "<group>"; };
|
||||
80B1C4EB1C8A6F860057A5CB /* BITSender.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITSender.m; sourceTree = "<group>"; };
|
||||
80CA63881C67BD5400362DBF /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = "<group>"; };
|
||||
@@ -1009,6 +1018,9 @@
|
||||
children = (
|
||||
1E494AEA19491943001EFF74 /* AppIcon.png */,
|
||||
1E494AEB19491943001EFF74 /* AppIcon@2x.png */,
|
||||
8085BB831CBF1FA60023FD9B /* AppIcon.exotic.png */,
|
||||
8085BB841CBF1FA60023FD9B /* AppIcon.exotic@2x.png */,
|
||||
8085BB891CBF216E0023FD9B /* Icon.png */,
|
||||
1EA1170316F53B49001C015C /* StoreBundleIdentifierUnknown.json */,
|
||||
1EA1170816F53E3A001C015C /* StoreBundleIdentifierKnown.json */,
|
||||
1E70A22F17F2F982001BB32D /* live_report_empty.plcrash */,
|
||||
@@ -1663,6 +1675,8 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1E85C5621B3438EB00CE2C0D /* live_report_exception_marketing.plcrash in Resources */,
|
||||
8085BB871CBF1FA60023FD9B /* AppIcon.exotic@2x.png in Resources */,
|
||||
8085BB851CBF1FA60023FD9B /* AppIcon.exotic.png in Resources */,
|
||||
1E494AEC19491943001EFF74 /* AppIcon.png in Resources */,
|
||||
1E85C5631B3438EB00CE2C0D /* live_report_signal_marketing.plcrash in Resources */,
|
||||
1EA1170C16F54A64001C015C /* HockeySDKResources.bundle in Resources */,
|
||||
@@ -1672,6 +1686,7 @@
|
||||
1E70A23317F2F982001BB32D /* live_report_exception.plcrash in Resources */,
|
||||
1E70A23217F2F982001BB32D /* live_report_empty.plcrash in Resources */,
|
||||
1E494AED19491943001EFF74 /* AppIcon@2x.png in Resources */,
|
||||
8085BB8A1CBF216E0023FD9B /* Icon.png in Resources */,
|
||||
1EA1170916F53E3A001C015C /* StoreBundleIdentifierKnown.json in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1689,6 +1704,8 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1E85C5641B3438EC00CE2C0D /* live_report_exception_marketing.plcrash in Resources */,
|
||||
8085BB881CBF1FA60023FD9B /* AppIcon.exotic@2x.png in Resources */,
|
||||
8085BB861CBF1FA60023FD9B /* AppIcon.exotic.png in Resources */,
|
||||
1E1508871B0C946700D7B9D9 /* AppIcon.png in Resources */,
|
||||
1E85C5651B3438EC00CE2C0D /* live_report_signal_marketing.plcrash in Resources */,
|
||||
1E1508891B0C946700D7B9D9 /* StoreBundleIdentifierUnknown.json in Resources */,
|
||||
@@ -1698,6 +1715,7 @@
|
||||
1E15088D1B0C946700D7B9D9 /* live_report_signal.plcrash in Resources */,
|
||||
1E15088A1B0C946700D7B9D9 /* StoreBundleIdentifierKnown.json in Resources */,
|
||||
1E15088E1B0C946D00D7B9D9 /* InfoPlist.strings in Resources */,
|
||||
8085BB8B1CBF216E0023FD9B /* Icon.png in Resources */,
|
||||
1E15088C1B0C946700D7B9D9 /* live_report_exception.plcrash in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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>classNames</key>
|
||||
<dict>
|
||||
<key>BITHockeyHelperTests</key>
|
||||
<dict>
|
||||
<key>testValidAppIconFilenamePerformance</key>
|
||||
<dict>
|
||||
<key>com.apple.XCTPerformanceMetric_WallClockTime</key>
|
||||
<dict>
|
||||
<key>baselineAverage</key>
|
||||
<real>0.6</real>
|
||||
<key>baselineIntegrationDisplayName</key>
|
||||
<string>Local Baseline</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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>runDestinationsByUUID</key>
|
||||
<dict>
|
||||
<key>E1AF7159-3C8D-4A2A-8625-B72024F5DD3E</key>
|
||||
<dict>
|
||||
<key>localComputer</key>
|
||||
<dict>
|
||||
<key>busSpeedInMHz</key>
|
||||
<integer>100</integer>
|
||||
<key>cpuCount</key>
|
||||
<integer>1</integer>
|
||||
<key>cpuKind</key>
|
||||
<string>Intel Core i7</string>
|
||||
<key>cpuSpeedInMHz</key>
|
||||
<integer>2800</integer>
|
||||
<key>logicalCPUCoresPerPackage</key>
|
||||
<integer>8</integer>
|
||||
<key>modelCode</key>
|
||||
<string>MacBookPro11,3</string>
|
||||
<key>physicalCPUCoresPerPackage</key>
|
||||
<integer>4</integer>
|
||||
<key>platformIdentifier</key>
|
||||
<string>com.apple.platform.macosx</string>
|
||||
</dict>
|
||||
<key>targetArchitecture</key>
|
||||
<string>x86_64</string>
|
||||
<key>targetDevice</key>
|
||||
<dict>
|
||||
<key>modelCode</key>
|
||||
<string>iPhone8,1</string>
|
||||
<key>platformIdentifier</key>
|
||||
<string>com.apple.platform.iphonesimulator</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -100,6 +100,19 @@
|
||||
NSString *resultString = nil;
|
||||
NSBundle *mockBundle = mock([NSBundle class]);
|
||||
NSBundle *resourceBundle = [NSBundle bundleForClass:self.class];
|
||||
|
||||
// CFBundleIcons contains exotic dictionary filenames
|
||||
NSString *exoticValidIconPath = @"AppIcon.exotic";
|
||||
NSString *exoticValidIconPath2x = @"AppIcon.exotic@2x";
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFiles"]) willReturn:@[@"invalidFilename.png"]];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons"]) willReturn:@{@"CFBundlePrimaryIcon":@{@"CFBundleIconFiles":@[exoticValidIconPath, exoticValidIconPath2x]}}];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons~ipad"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:nil];
|
||||
|
||||
//resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
//assertThat(resultString, equalTo(exoticValidIconPath2x));
|
||||
|
||||
// Regular icon names
|
||||
NSString *validIconPath = @"AppIcon";
|
||||
NSString *validIconPath2x = @"AppIcon@2x";
|
||||
|
||||
@@ -110,7 +123,7 @@
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:@"invalidFilename.png"];
|
||||
|
||||
resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
assertThat(resultString, nilValue());
|
||||
assertThat(resultString, equalTo(@"Icon"));
|
||||
|
||||
// CFBundleIconFiles contains valid filenames
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFiles"]) willReturn:@[validIconPath, validIconPath2x]];
|
||||
@@ -155,6 +168,26 @@
|
||||
assertThat(resultString, equalTo(validIconPath2x));
|
||||
}
|
||||
|
||||
#ifndef CI
|
||||
- (void)testValidAppIconFilenamePerformance {
|
||||
NSBundle *mockBundle = mock([NSBundle class]);
|
||||
NSBundle *resourceBundle = [NSBundle bundleForClass:self.class];
|
||||
|
||||
NSString *validIconPath2x = @"AppIcon@2x";
|
||||
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFiles"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIcons~ipad"]) willReturn:nil];
|
||||
[given([mockBundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) willReturn:validIconPath2x];
|
||||
|
||||
[self measureBlock:^{
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
__unused NSString *resultString = bit_validAppIconFilename(mockBundle, resourceBundle);
|
||||
}
|
||||
}];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)testDevicePlattform {
|
||||
NSString *resultString = bit_devicePlatform();
|
||||
assertThat(resultString, notNilValue());
|
||||
|
||||
BIN
Support/HockeySDKTests/Fixtures/AppIcon.exotic.png
Normal file
BIN
Support/HockeySDKTests/Fixtures/AppIcon.exotic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
Support/HockeySDKTests/Fixtures/AppIcon.exotic@2x.png
Normal file
BIN
Support/HockeySDKTests/Fixtures/AppIcon.exotic@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Support/HockeySDKTests/Fixtures/Icon.png
Normal file
BIN
Support/HockeySDKTests/Fixtures/Icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Reference in New Issue
Block a user