react-native-navigation的迁移库

RNNViewControllerPresenterTest.m 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #import <XCTest/XCTest.h>
  2. #import "RNNViewControllerPresenter.h"
  3. @interface RNNViewControllerPresenterTest : XCTestCase
  4. @property (nonatomic, strong) RNNViewControllerPresenter *uut;
  5. @property (nonatomic, strong) RNNNavigationOptions *options;
  6. @property (nonatomic, strong) UIViewController *bindedViewController;
  7. @end
  8. @implementation RNNViewControllerPresenterTest
  9. - (void)setUp {
  10. [super setUp];
  11. self.uut = [[RNNViewControllerPresenter alloc] init];
  12. self.bindedViewController = [UIViewController new];
  13. [self.uut bindViewController:self.bindedViewController];
  14. self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  15. }
  16. - (void)testApplyOptions_backgroundImageDefaultNil {
  17. [self.uut applyOptions:self.options];
  18. XCTAssertNil(((UIImageView *)self.bindedViewController.view.subviews[0]).image);
  19. }
  20. - (void)testApplyOptions_topBarPrefersLargeTitleDefaultFalse {
  21. [self.uut applyOptions:self.options];
  22. XCTAssertTrue(self.bindedViewController.navigationItem.largeTitleDisplayMode == UINavigationItemLargeTitleDisplayModeNever);
  23. }
  24. - (void)testApplyOptions_layoutBackgroundColorDefaultWhiteColor {
  25. [self.uut applyOptions:self.options];
  26. XCTAssertNil(self.bindedViewController.view.backgroundColor);
  27. }
  28. - (void)testApplyOptions_statusBarBlurDefaultFalse {
  29. [self.uut applyOptions:self.options];
  30. XCTAssertNil([self.bindedViewController.view viewWithTag:BLUR_STATUS_TAG]);
  31. }
  32. - (void)testApplyOptions_statusBarStyleDefaultStyle {
  33. [self.uut applyOptions:self.options];
  34. XCTAssertTrue([self.bindedViewController preferredStatusBarStyle] == UIStatusBarStyleDefault);
  35. }
  36. - (void)testApplyOptions_backButtonVisibleDefaultTrue {
  37. [self.uut applyOptions:self.options];
  38. XCTAssertFalse(self.bindedViewController.navigationItem.hidesBackButton);
  39. }
  40. @end