react-native-navigation的迁移库

RNNRootViewControllerTest.m 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. #import <XCTest/XCTest.h>
  2. #import "RNNRootViewController.h"
  3. #import "RNNReactRootViewCreator.h"
  4. #import "RNNTestRootViewCreator.h"
  5. #import <React/RCTConvert.h>
  6. #import "RNNNavigationOptions.h"
  7. #import "RNNNavigationController.h"
  8. #import "RNNTabBarController.h"
  9. #import "RNNUIBarButtonItem.h"
  10. @interface RNNRootViewControllerTest : XCTestCase
  11. @property (nonatomic, strong) id<RNNRootViewCreator> creator;
  12. @property (nonatomic, strong) NSString* pageName;
  13. @property (nonatomic, strong) NSString* containerId;
  14. @property (nonatomic, strong) id emitter;
  15. @property (nonatomic, strong) RNNNavigationOptions* options;
  16. @property (nonatomic, strong) RNNRootViewController* uut;
  17. @end
  18. @implementation RNNRootViewControllerTest
  19. - (void)setUp {
  20. [super setUp];
  21. self.creator = [[RNNTestRootViewCreator alloc] init];
  22. self.pageName = @"somename";
  23. self.containerId = @"cntId";
  24. self.emitter = nil;
  25. self.options = [RNNNavigationOptions new];
  26. self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withContainerId:self.containerId rootViewCreator:self.creator eventEmitter:self.emitter];
  27. }
  28. -(void)testTopBarBackgroundColor_validColor{
  29. NSNumber* inputColor = @(0xFFFF0000);
  30. self.options.topBar.backgroundColor = inputColor;
  31. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  32. [self.uut viewWillAppear:false];
  33. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  34. XCTAssertTrue([self.uut.navigationController.navigationBar.barTintColor isEqual:expectedColor]);
  35. }
  36. -(void)testTopBarBackgroundColorWithoutNavigationController{
  37. NSNumber* inputColor = @(0xFFFF0000);
  38. self.options.topBar.backgroundColor = inputColor;
  39. XCTAssertNoThrow([self.uut viewWillAppear:false]);
  40. }
  41. - (void)testStatusBarHidden_default {
  42. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  43. [self.uut viewWillAppear:false];
  44. XCTAssertFalse([self.uut prefersStatusBarHidden]);
  45. }
  46. - (void)testStatusBarHidden_true {
  47. self.options.statusBarHidden = @(1);
  48. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  49. [self.uut viewWillAppear:false];
  50. XCTAssertTrue([self.uut prefersStatusBarHidden]);
  51. }
  52. - (void)testStatusBarHideWithTopBar_false {
  53. self.options.statusBarHideWithTopBar = @(0);
  54. self.options.topBar.hidden = @(1);
  55. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  56. [self.uut viewWillAppear:false];
  57. XCTAssertFalse([self.uut prefersStatusBarHidden]);
  58. }
  59. - (void)testStatusBarHideWithTopBar_true {
  60. self.options.statusBarHideWithTopBar = @(1);
  61. self.options.topBar.hidden = @(1);
  62. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  63. [self.uut viewWillAppear:false];
  64. XCTAssertTrue([self.uut prefersStatusBarHidden]);
  65. }
  66. - (void)testStatusBarHidden_false {
  67. self.options.statusBarHidden = @(0);
  68. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  69. [self.uut viewWillAppear:false];
  70. XCTAssertFalse([self.uut prefersStatusBarHidden]);
  71. }
  72. -(void)testTitle_string{
  73. NSString* title =@"some title";
  74. self.options.topBar.title = title;
  75. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  76. [self.uut viewWillAppear:false];
  77. XCTAssertTrue([self.uut.navigationItem.title isEqual:title]);
  78. }
  79. -(void)testTitle_default{
  80. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  81. [self.uut viewWillAppear:false];
  82. XCTAssertNil(self.uut.navigationItem.title);
  83. }
  84. -(void)testTopBarTextColor_validColor{
  85. NSNumber* inputColor = @(0xFFFF0000);
  86. self.options.topBar.textColor = inputColor;
  87. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  88. [self.uut viewWillAppear:false];
  89. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  90. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
  91. }
  92. -(void)testScreenBackgroundColor_validColor{
  93. NSNumber* inputColor = @(0xFFFF0000);
  94. self.options.screenBackgroundColor = inputColor;
  95. [self.uut viewWillAppear:false];
  96. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  97. XCTAssertTrue([self.uut.view.backgroundColor isEqual:expectedColor]);
  98. }
  99. -(void)testTopBarTextFontFamily_validFont{
  100. NSString* inputFont = @"HelveticaNeue";
  101. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  102. self.options.topBar.textFontFamily = inputFont;
  103. [self.uut viewWillAppear:false];
  104. UIFont* expectedFont = [UIFont fontWithName:inputFont size:20];
  105. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  106. }
  107. -(void)testTopBarHideOnScroll_true {
  108. NSNumber* hideOnScrollInput = @(1);
  109. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  110. self.options.topBar.hideOnScroll = hideOnScrollInput;
  111. [self.uut viewWillAppear:false];
  112. XCTAssertTrue(self.uut.navigationController.hidesBarsOnSwipe);
  113. }
  114. -(void)testTopBarButtonColor {
  115. NSNumber* inputColor = @(0xFFFF0000);
  116. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  117. self.options.topBar.buttonColor = inputColor;
  118. [self.uut viewWillAppear:false];
  119. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  120. XCTAssertTrue([self.uut.navigationController.navigationBar.tintColor isEqual:expectedColor]);
  121. }
  122. -(void)testTopBarTranslucent {
  123. NSNumber* topBarTranslucentInput = @(0);
  124. self.options.topBar.translucent = topBarTranslucentInput;
  125. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  126. [self.uut viewWillAppear:false];
  127. XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
  128. }
  129. -(void)testTopBarTransparent {
  130. NSNumber* topBarTransparentInput = @(0);
  131. self.options.topBar.transparent = topBarTransparentInput;
  132. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  133. [self.uut viewWillAppear:false];
  134. XCTAssertNotNil(self.uut.navigationController.navigationBar.shadowImage);
  135. XCTAssertNotNil([self.uut.navigationController.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault]);
  136. XCTAssertTrue(CGRectEqualToRect(self.uut.navigationController.navigationBar.subviews.firstObject.frame, CGRectZero));
  137. }
  138. -(void)testTabBadge {
  139. NSString* tabBadgeInput = @"5";
  140. self.options.tabBar.tabBadge = tabBadgeInput;
  141. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  142. NSMutableArray* controllers = [NSMutableArray new];
  143. UITabBarItem* item = [[UITabBarItem alloc] initWithTitle:@"A Tab" image:nil tag:1];
  144. [self.uut setTabBarItem:item];
  145. [controllers addObject:self.uut];
  146. [vc setViewControllers:controllers];
  147. [self.uut viewWillAppear:false];
  148. XCTAssertTrue([self.uut.tabBarItem.badgeValue isEqualToString:tabBadgeInput]);
  149. }
  150. -(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
  151. NSNumber* topBarTextFontSizeInput = @(15);
  152. self.options.topBar.textFontSize = topBarTextFontSizeInput;
  153. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  154. [self.uut viewWillAppear:false];
  155. UIFont* expectedFont = [UIFont systemFontOfSize:15];
  156. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  157. }
  158. -(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
  159. NSNumber* topBarTextFontSizeInput = @(15);
  160. NSNumber* inputColor = @(0xFFFF0000);
  161. self.options.topBar.textFontSize = topBarTextFontSizeInput;
  162. self.options.topBar.textColor = inputColor;
  163. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  164. [self.uut viewWillAppear:false];
  165. UIFont* expectedFont = [UIFont systemFontOfSize:15];
  166. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  167. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  168. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
  169. }
  170. -(void)testTopBarTextFontSize_withTextFontFamily_withTextColor {
  171. NSNumber* topBarTextFontSizeInput = @(15);
  172. NSNumber* inputColor = @(0xFFFF0000);
  173. NSString* inputFont = @"HelveticaNeue";
  174. self.options.topBar.textFontSize = topBarTextFontSizeInput;
  175. self.options.topBar.textColor = inputColor;
  176. self.options.topBar.textFontFamily = inputFont;
  177. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  178. [self.uut viewWillAppear:false];
  179. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  180. UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
  181. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  182. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
  183. }
  184. -(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
  185. NSNumber* topBarTextFontSizeInput = @(15);
  186. NSString* inputFont = @"HelveticaNeue";
  187. self.options.topBar.textFontSize = topBarTextFontSizeInput;
  188. self.options.topBar.textFontFamily = inputFont;
  189. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  190. [self.uut viewWillAppear:false];
  191. UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
  192. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  193. }
  194. // TODO: Currently not passing
  195. -(void)testTopBarTextFontFamily_invalidFont{
  196. NSString* inputFont = @"HelveticaNeueeeee";
  197. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  198. self.options.topBar.textFontFamily = inputFont;
  199. // XCTAssertThrows([self.uut viewWillAppear:false]);
  200. }
  201. -(void)testOrientation_portrait {
  202. NSArray* supportedOrientations = @[@"portrait"];
  203. self.options.orientation = supportedOrientations;
  204. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  205. [self.uut viewWillAppear:false];
  206. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
  207. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  208. }
  209. -(void)testOrientation_portraitString {
  210. NSString* supportedOrientation = @"portrait";
  211. self.options.orientation = supportedOrientation;
  212. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  213. [self.uut viewWillAppear:false];
  214. UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait);
  215. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  216. }
  217. -(void)testOrientation_portraitAndLandscape {
  218. NSArray* supportedOrientations = @[@"portrait", @"landscape"];
  219. self.options.orientation = supportedOrientations;
  220. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  221. [self.uut viewWillAppear:false];
  222. UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
  223. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  224. }
  225. -(void)testOrientation_all {
  226. NSArray* supportedOrientations = @[@"all"];
  227. self.options.orientation = supportedOrientations;
  228. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  229. [self.uut viewWillAppear:false];
  230. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
  231. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  232. }
  233. -(void)testOrientation_default {
  234. NSString* supportedOrientations = @"default";
  235. self.options.orientation = supportedOrientations;
  236. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  237. [self.uut viewWillAppear:false];
  238. UIInterfaceOrientationMask expectedOrientation = [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
  239. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  240. }
  241. -(void)testOrientationTabsController_portrait {
  242. NSArray* supportedOrientations = @[@"portrait"];
  243. self.options.orientation = supportedOrientations;
  244. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  245. NSMutableArray* controllers = [NSMutableArray new];
  246. [controllers addObject:self.uut];
  247. [vc setViewControllers:controllers];
  248. [self.uut viewWillAppear:false];
  249. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
  250. XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
  251. }
  252. -(void)testOrientationTabsController_portraitAndLandscape {
  253. NSArray* supportedOrientations = @[@"portrait", @"landscape"];
  254. self.options.orientation = supportedOrientations;
  255. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  256. NSMutableArray* controllers = [NSMutableArray new];
  257. [controllers addObject:self.uut];
  258. [vc setViewControllers:controllers];
  259. [self.uut viewWillAppear:false];
  260. UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
  261. XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
  262. }
  263. -(void)testOrientationTabsController_all {
  264. NSArray* supportedOrientations = @[@"all"];
  265. self.options.orientation = supportedOrientations;
  266. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  267. NSMutableArray* controllers = [NSMutableArray new];
  268. [controllers addObject:self.uut];
  269. [vc setViewControllers:controllers];
  270. [self.uut viewWillAppear:false];
  271. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
  272. XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
  273. }
  274. -(void)testRightButtonsWithTitle_withoutStyle {
  275. self.options.rightButtons = @[@{@"id": @"testId", @"title": @"test"}];
  276. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  277. [self.uut viewWillAppear:false];
  278. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.rightBarButtonItems objectAtIndex:0];
  279. NSString* expectedButtonId = @"testId";
  280. NSString* expectedTitle = @"test";
  281. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  282. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  283. XCTAssertTrue(button.enabled);
  284. }
  285. -(void)testRightButtonsWithTitle_withStyle {
  286. NSNumber* inputColor = @(0xFFFF0000);
  287. self.options.rightButtons = @[@{@"id": @"testId", @"title": @"test", @"disabled": @true, @"buttonColor": inputColor, @"buttonFontSize": @22, @"buttonFontWeight": @"800"}];
  288. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  289. [self.uut viewWillAppear:false];
  290. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.rightBarButtonItems objectAtIndex:0];
  291. NSString* expectedButtonId = @"testId";
  292. NSString* expectedTitle = @"test";
  293. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  294. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  295. XCTAssertFalse(button.enabled);
  296. //TODO: Determine how to tests buttonColor,buttonFontSize and buttonFontWeight?
  297. }
  298. -(void)testLeftButtonsWithTitle_withoutStyle {
  299. self.options.leftButtons = @[@{@"id": @"testId", @"title": @"test"}];
  300. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  301. [self.uut viewWillAppear:false];
  302. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.leftBarButtonItems objectAtIndex:0];
  303. NSString* expectedButtonId = @"testId";
  304. NSString* expectedTitle = @"test";
  305. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  306. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  307. XCTAssertTrue(button.enabled);
  308. }
  309. -(void)testLeftButtonsWithTitle_withStyle {
  310. NSNumber* inputColor = @(0xFFFF0000);
  311. self.options.leftButtons = @[@{@"id": @"testId", @"title": @"test", @"disabled": @true, @"buttonColor": inputColor, @"buttonFontSize": @22, @"buttonFontWeight": @"800"}];
  312. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  313. [self.uut viewWillAppear:false];
  314. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.leftBarButtonItems objectAtIndex:0];
  315. NSString* expectedButtonId = @"testId";
  316. NSString* expectedTitle = @"test";
  317. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  318. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  319. XCTAssertFalse(button.enabled);
  320. //TODO: Determine how to tests buttonColor,buttonFontSize and buttonFontWeight?
  321. }
  322. -(void)testTopBarNoBorderOn {
  323. NSNumber* topBarNoBorderInput = @(1);
  324. self.options.topBar.noBorder = topBarNoBorderInput;
  325. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  326. [self.uut viewWillAppear:false];
  327. XCTAssertNotNil(self.uut.navigationController.navigationBar.shadowImage);
  328. }
  329. -(void)testTopBarNoBorderOff {
  330. NSNumber* topBarNoBorderInput = @(0);
  331. self.options.topBar.noBorder = topBarNoBorderInput;
  332. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  333. [self.uut viewWillAppear:false];
  334. XCTAssertNil(self.uut.navigationController.navigationBar.shadowImage);
  335. }
  336. -(void)testStatusBarBlurOn {
  337. NSNumber* statusBarBlurInput = @(1);
  338. self.options.statusBarBlur = statusBarBlurInput;
  339. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  340. [self.uut viewWillAppear:false];
  341. XCTAssertNotNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
  342. }
  343. -(void)testStatusBarBlurOff {
  344. NSNumber* statusBarBlurInput = @(0);
  345. self.options.statusBarBlur = statusBarBlurInput;
  346. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  347. [self.uut viewWillAppear:false];
  348. XCTAssertNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
  349. }
  350. - (void)testTabBarHidden_default {
  351. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  352. [self.uut viewWillAppear:false];
  353. XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
  354. }
  355. - (void)testTabBarHidden_true {
  356. self.options.tabBar.hidden = @(1);
  357. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  358. [self.uut viewWillAppear:false];
  359. XCTAssertTrue([self.uut hidesBottomBarWhenPushed]);
  360. }
  361. - (void)testTabBarHidden_false {
  362. self.options.tabBar.hidden = @(0);
  363. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  364. [self.uut viewWillAppear:false];
  365. XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
  366. }
  367. -(void)testTopBarBlur_default {
  368. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  369. [self.uut viewWillAppear:false];
  370. XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
  371. }
  372. -(void)testTopBarBlur_false {
  373. NSNumber* topBarBlurInput = @(0);
  374. self.options.topBar.blur = topBarBlurInput;
  375. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  376. [self.uut viewWillAppear:false];
  377. XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
  378. }
  379. -(void)testTopBarBlur_true {
  380. NSNumber* topBarBlurInput = @(1);
  381. self.options.topBar.blur = topBarBlurInput;
  382. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  383. [self.uut viewWillAppear:false];
  384. XCTAssertNotNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
  385. }
  386. @end