diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index eec4fafe29..99cf371126 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -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 = ""; }; 808441731C20617C00644A40 /* OCMRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMRecorder.h; sourceTree = ""; }; 808441741C20617C00644A40 /* OCMStubRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMStubRecorder.h; sourceTree = ""; }; + 8085BB831CBF1FA60023FD9B /* AppIcon.exotic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AppIcon.exotic.png; sourceTree = ""; }; + 8085BB841CBF1FA60023FD9B /* AppIcon.exotic@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AppIcon.exotic@2x.png"; sourceTree = ""; }; + 8085BB891CBF216E0023FD9B /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; 80A4662D1C58F4DF00199909 /* BITCrashReportTextFormatterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashReportTextFormatterPrivate.h; sourceTree = ""; }; 80B1C4EB1C8A6F860057A5CB /* BITSender.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITSender.m; sourceTree = ""; }; 80CA63881C67BD5400362DBF /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = ""; }; @@ -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; diff --git a/Support/HockeySDK.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/E1AF7159-3C8D-4A2A-8625-B72024F5DD3E.plist b/Support/HockeySDK.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/E1AF7159-3C8D-4A2A-8625-B72024F5DD3E.plist new file mode 100644 index 0000000000..ba52325307 --- /dev/null +++ b/Support/HockeySDK.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/E1AF7159-3C8D-4A2A-8625-B72024F5DD3E.plist @@ -0,0 +1,22 @@ + + + + + classNames + + BITHockeyHelperTests + + testValidAppIconFilenamePerformance + + com.apple.XCTPerformanceMetric_WallClockTime + + baselineAverage + 0.6 + baselineIntegrationDisplayName + Local Baseline + + + + + + diff --git a/Support/HockeySDK.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/Info.plist b/Support/HockeySDK.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/Info.plist new file mode 100644 index 0000000000..6a71929f22 --- /dev/null +++ b/Support/HockeySDK.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/Info.plist @@ -0,0 +1,40 @@ + + + + + runDestinationsByUUID + + E1AF7159-3C8D-4A2A-8625-B72024F5DD3E + + localComputer + + busSpeedInMHz + 100 + cpuCount + 1 + cpuKind + Intel Core i7 + cpuSpeedInMHz + 2800 + logicalCPUCoresPerPackage + 8 + modelCode + MacBookPro11,3 + physicalCPUCoresPerPackage + 4 + platformIdentifier + com.apple.platform.macosx + + targetArchitecture + x86_64 + targetDevice + + modelCode + iPhone8,1 + platformIdentifier + com.apple.platform.iphonesimulator + + + + + diff --git a/Support/HockeySDKTests/BITHockeyHelperTests.m b/Support/HockeySDKTests/BITHockeyHelperTests.m index 990f26faca..38b7c30af2 100644 --- a/Support/HockeySDKTests/BITHockeyHelperTests.m +++ b/Support/HockeySDKTests/BITHockeyHelperTests.m @@ -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()); diff --git a/Support/HockeySDKTests/Fixtures/AppIcon.exotic.png b/Support/HockeySDKTests/Fixtures/AppIcon.exotic.png new file mode 100644 index 0000000000..5473e5e8de Binary files /dev/null and b/Support/HockeySDKTests/Fixtures/AppIcon.exotic.png differ diff --git a/Support/HockeySDKTests/Fixtures/AppIcon.exotic@2x.png b/Support/HockeySDKTests/Fixtures/AppIcon.exotic@2x.png new file mode 100644 index 0000000000..d79b85f577 Binary files /dev/null and b/Support/HockeySDKTests/Fixtures/AppIcon.exotic@2x.png differ diff --git a/Support/HockeySDKTests/Fixtures/Icon.png b/Support/HockeySDKTests/Fixtures/Icon.png new file mode 100644 index 0000000000..5473e5e8de Binary files /dev/null and b/Support/HockeySDKTests/Fixtures/Icon.png differ