Skip to content

Commit

Permalink
Merge pull request #129 from widescape/fix-includeStatusBarInSize
Browse files Browse the repository at this point in the history
Fixed handling of BFIncludeStatusBarInSizeAlways
  • Loading branch information
nlutsenko committed Aug 26, 2015
2 parents 9d19580 + eda11b9 commit cf7a1c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Bolts/iOS/BFAppLinkReturnToRefererView.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ - (CGFloat)statusBarHeight {
BOOL include;
switch (_includeStatusBarInSize) {
case BFIncludeStatusBarInSizeAlways:
include = NO;
include = YES;
break;
case BFIncludeStatusBarInSizeIOS7AndLater: {
float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
Expand Down
17 changes: 15 additions & 2 deletions BoltsTests/AppLinkReturnToRefererViewTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,30 @@ - (void)testValidRefererDataResultsInNonZeroSizeThatFits {
XCTAssert(sizeThatFits.width > 0.0);
}

- (void)testNotIncludingStatusBarResultsInSmallerHeight {
- (void)testIncludesStatusBarResultsInLargerHeight {
NSURL *url = [NSURL URLWithString:BFURLWithRefererData];
BFAppLink *appLink = [[BFURL URLWithURL:url] appLinkReferer];

BFAppLinkReturnToRefererView *view = [[BFAppLinkReturnToRefererView alloc] init];
view.refererAppLink = appLink;
view.includeStatusBarInSize = BFIncludeStatusBarInSizeNever;
CGSize sizeThatFitsNotIncludingStatusBar = [view sizeThatFits:CGSizeMake(100.0, 100.0)];

view.includeStatusBarInSize = BFIncludeStatusBarInSizeAlways;
CGSize sizeThatFitsIncludingStatusBar = [view sizeThatFits:CGSizeMake(100.0, 100.0)];

view.includeStatusBarInSize = BFIncludeStatusBarInSizeNever;
XCTAssert(sizeThatFitsIncludingStatusBar.height > sizeThatFitsNotIncludingStatusBar.height);
}

- (void)testNotIncludingStatusBarResultsInSmallerHeight {
NSURL *url = [NSURL URLWithString:BFURLWithRefererData];
BFAppLink *appLink = [[BFURL URLWithURL:url] appLinkReferer];

BFAppLinkReturnToRefererView *view = [[BFAppLinkReturnToRefererView alloc] init];
view.refererAppLink = appLink;
CGSize sizeThatFitsIncludingStatusBar = [view sizeThatFits:CGSizeMake(100.0, 100.0)];

view.includeStatusBarInSize = BFIncludeStatusBarInSizeNever;
CGSize sizeThatFitsNotIncludingStatusBar = [view sizeThatFits:CGSizeMake(100.0, 100.0)];

XCTAssert(sizeThatFitsIncludingStatusBar.height > sizeThatFitsNotIncludingStatusBar.height);
Expand Down

0 comments on commit cf7a1c4

Please sign in to comment.