react-native-navigation的迁移库

RNNNavigationControllerTest.m 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #import <XCTest/XCTest.h>
  2. #import "RNNNavigationController.h"
  3. #import "RNNRootViewController.h"
  4. @interface RNNNavigationControllerTest : XCTestCase
  5. @property (nonatomic, strong) RNNNavigationController *uut;
  6. @end
  7. @implementation RNNNavigationControllerTest {
  8. RNNRootViewController* _vc1;
  9. RNNRootViewController* _vc2;
  10. UIViewController* _vc3;
  11. RNNViewControllerPresenter* _presenter;
  12. }
  13. - (void)setUp {
  14. [super setUp];
  15. _presenter = [[RNNViewControllerPresenter alloc] initWithOptions:[[RNNNavigationOptions alloc] initWithDict:@{}]];
  16. self.uut = [[RNNNavigationController alloc] init];
  17. _vc1 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil isExternalComponent:NO presenter:_presenter];
  18. _vc2 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil isExternalComponent:NO presenter:_presenter];
  19. _vc3 = [UIViewController new];
  20. }
  21. - (void)testChildViewControllerForStatusBarStyle_shouldReturnTopViewController {
  22. XCTAssertTrue(self.uut.childViewControllerForStatusBarStyle == self.uut.topViewController);
  23. }
  24. - (void)testGetLeafViewController_shouldReturnTopViewController {
  25. XCTAssertTrue(self.uut.getLeafViewController == self.uut.topViewController);
  26. }
  27. - (void)testPreferredStatusBarStyle_shouldReturnLeafPreferredStatusBarStyle {
  28. [self.uut setViewControllers:@[_vc1]];
  29. self.uut.getLeafViewController.presenter.options.statusBar.style = @"light";
  30. XCTAssertTrue(self.uut.preferredStatusBarStyle == self.uut.getLeafViewController.preferredStatusBarStyle);
  31. }
  32. @end