Skip to content

Commit

Permalink
Merge pull request #91 from matej/matej/test-shape
Browse files Browse the repository at this point in the history
Add HUD shape test
  • Loading branch information
matej authored Nov 4, 2018
2 parents 2347f40 + b74d8e8 commit 202d889
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions Demo/HudTests/HudTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ - (void)testCompletionBlock {
[self waitForExpectationsWithTimeout:5. handler:nil];
}

///////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - Modes

- (void)testRoundDeterminate {
Expand Down Expand Up @@ -463,6 +462,31 @@ - (void)testHideBeforeGraceTimeElapsed {
MBTestHUDIsHidenAndRemoved(hud, rootView);
}

#pragma mark - Customization

- (void)testShape {
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
UIView *rootView = rootViewController.view;

MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
hud.removeFromSuperViewOnHide = YES;
hud.offset = CGPointMake(50, 50);
hud.square = YES;
hud.label.text = @"Some long text...";
[rootView addSubview:hud];
[hud showAnimated:NO];

[hud setNeedsLayout];
[hud layoutIfNeeded];

CGRect frame = hud.bezelView.frame;
XCTAssertEqual(frame.size.width, frame.size.height);

[hud hideAnimated:NO];

MBTestHUDIsHidenAndRemoved(hud, rootView);
}

#pragma mark - MBProgressHUDDelegate

- (void)hudWasHidden:(MBProgressHUD *)hud {
Expand All @@ -473,7 +497,6 @@ - (void)hudWasHidden:(MBProgressHUD *)hud {
self.hideExpectation = nil;
}

///////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - Helpers

- (nullable UIView *)view:(UIView *)view firstSubviewOfClass:(Class)clazz {
Expand Down

0 comments on commit 202d889

Please sign in to comment.