Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change minimum requirements to Xcode9 / iOS 9 #851

Merged
merged 20 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Stripe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@
F1A2F92D1EEB6A70006B0456 /* NSCharacterSet+Stripe.h in Headers */ = {isa = PBXBuildFile; fileRef = F1A2F92A1EEB6A70006B0456 /* NSCharacterSet+Stripe.h */; };
F1A2F92E1EEB6A70006B0456 /* NSCharacterSet+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = F1A2F92B1EEB6A70006B0456 /* NSCharacterSet+Stripe.m */; };
F1A2F92F1EEB6A70006B0456 /* NSCharacterSet+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = F1A2F92B1EEB6A70006B0456 /* NSCharacterSet+Stripe.m */; };
F1B8534F1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h in Headers */ = {isa = PBXBuildFile; fileRef = F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */; };
F1B853501FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m in Sources */ = {isa = PBXBuildFile; fileRef = F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */; };
F1B980941DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F1B980931DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m */; };
F1BA241E1E57BE5E00E4A1CF /* CardSource.json in Resources */ = {isa = PBXBuildFile; fileRef = F1BA241C1E57BE5700E4A1CF /* CardSource.json */; };
F1BA24211E57BECA00E4A1CF /* 3DSSource.json in Resources */ = {isa = PBXBuildFile; fileRef = F1BA241F1E57BEC600E4A1CF /* 3DSSource.json */; };
Expand Down Expand Up @@ -1159,6 +1161,8 @@
F1A0197A1EA5733200354301 /* STPSourceParams+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPSourceParams+Private.h"; sourceTree = "<group>"; };
F1A2F92A1EEB6A70006B0456 /* NSCharacterSet+Stripe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSCharacterSet+Stripe.h"; sourceTree = "<group>"; };
F1A2F92B1EEB6A70006B0456 /* NSCharacterSet+Stripe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSCharacterSet+Stripe.m"; sourceTree = "<group>"; };
F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBSnapshotTestCase+STPViewControllerLoading.h"; sourceTree = "<group>"; };
F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FBSnapshotTestCase+STPViewControllerLoading.m"; sourceTree = "<group>"; };
F1B980931DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodsViewControllerLocalizationTests.m; sourceTree = "<group>"; };
F1BA241C1E57BE5700E4A1CF /* CardSource.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = CardSource.json; sourceTree = "<group>"; };
F1BA241F1E57BEC600E4A1CF /* 3DSSource.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = 3DSSource.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1377,6 +1381,8 @@
C18867D71E8B07F600A77634 /* Functional */,
C18867D81E8B093300A77634 /* Unit */,
C1D23FB71D37FE0F002FD83C /* JSON */,
F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */,
F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */,
C18867D91E8B0C4100A77634 /* STPFixtures.h */,
C18867DA1E8B0C4100A77634 /* STPFixtures.m */,
F1D96F981DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.h */,
Expand Down Expand Up @@ -1969,6 +1975,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
F1B8534F1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h in Headers */,
F1D96F9A1DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.h in Headers */,
F148ABFA1D5E88C40014FD92 /* STPTestUtils.h in Headers */,
C1CFCB6D1ED5E0F800BE45DF /* STPMocks.h in Headers */,
Expand Down Expand Up @@ -2655,6 +2662,7 @@
8BD87B901EFB17AA00269C2B /* STPSourceRedirectTest.m in Sources */,
04415C6A1A6605B5001225ED /* STPApplePayFunctionalTest.m in Sources */,
8BE5AE8B1EF8905B0081A33C /* STPCardParamsTest.m in Sources */,
F1B853501FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m in Sources */,
F1D3A25F1EB015B30095BFA9 /* UIImage+StripeTests.m in Sources */,
04415C6B1A6605B5001225ED /* STPBankAccountFunctionalTest.m in Sources */,
8B6DC9751F0171D20025E811 /* STPSourceReceiverTest.m in Sources */,
Expand Down
13 changes: 13 additions & 0 deletions Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// FBSnapshotTestCase+STPViewControllerLoading.h
// StripeiOS Tests
//
// Created by Brian Dorfman on 12/11/17.
// Copyright © 2017 Stripe, Inc. All rights reserved.
//

#import <FBSnapshotTestCase/FBSnapshotTestCase.h>

@interface FBSnapshotTestCase (STPViewControllerLoading)
- (UIView *)stp_preparedAndSizedViewForSnapshotTestFromViewController:(UIViewController *)viewController;
@end
33 changes: 33 additions & 0 deletions Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// FBSnapshotTestCase+STPViewControllerLoading.m
// StripeiOS Tests
//
// Created by Brian Dorfman on 12/11/17.
// Copyright © 2017 Stripe, Inc. All rights reserved.
//

#import "FBSnapshotTestCase+STPViewControllerLoading.h"
#import "STPCoreScrollViewController+Private.h"

@implementation FBSnapshotTestCase (STPViewControllerLoading)
- (UIView *)stp_preparedAndSizedViewForSnapshotTestFromViewController:(UIViewController *)viewController {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
UIWindow *testWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
testWindow.rootViewController = navController;
testWindow.hidden = NO;

// Test that loaded properly + loads them on first call
XCTAssertNotNil(navController.view);
XCTAssertNotNil(viewController.view);

if ([viewController isKindOfClass:[STPCoreScrollViewController class]]) {
UIScrollView *scrollView = ((STPCoreScrollViewController *)viewController).scrollView;
[navController.view layoutIfNeeded];

CGFloat topOffset = [scrollView convertPoint:scrollView.frame.origin toCoordinateSpace:navController.view].y;
navController.view.frame = CGRectMake(0, 0, 320, topOffset + scrollView.contentSize.height + scrollView.contentInset.top + scrollView.contentInset.bottom);
}

return navController.view;
}
@end