react-native-navigation的迁移库

RNNRootViewControllerTest.m 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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.topBarBackgroundColor = 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.topBarBackgroundColor = 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.topBarHidden = @(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.topBarHidden = @(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.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.topBarTextColor = 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.topBarTextFontFamily = 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.topBarHideOnScroll = 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.topBarButtonColor = 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.topBarTranslucent = 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)testTabBadge {
  130. NSString* tabBadgeInput = @"5";
  131. self.options.tabBadge = tabBadgeInput;
  132. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  133. NSMutableArray* controllers = [NSMutableArray new];
  134. UITabBarItem* item = [[UITabBarItem alloc] initWithTitle:@"A Tab" image:nil tag:1];
  135. [self.uut setTabBarItem:item];
  136. [controllers addObject:self.uut];
  137. [vc setViewControllers:controllers];
  138. [self.uut viewWillAppear:false];
  139. XCTAssertTrue([self.uut.tabBarItem.badgeValue isEqualToString:tabBadgeInput]);
  140. }
  141. -(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
  142. NSNumber* topBarTextFontSizeInput = @(15);
  143. self.options.topBarTextFontSize = topBarTextFontSizeInput;
  144. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  145. [self.uut viewWillAppear:false];
  146. UIFont* expectedFont = [UIFont systemFontOfSize:15];
  147. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  148. }
  149. -(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
  150. NSNumber* topBarTextFontSizeInput = @(15);
  151. NSNumber* inputColor = @(0xFFFF0000);
  152. self.options.topBarTextFontSize = topBarTextFontSizeInput;
  153. self.options.topBarTextColor = inputColor;
  154. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  155. [self.uut viewWillAppear:false];
  156. UIFont* expectedFont = [UIFont systemFontOfSize:15];
  157. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  158. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  159. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
  160. }
  161. -(void)testTopBarTextFontSize_withTextFontFamily_withTextColor {
  162. NSNumber* topBarTextFontSizeInput = @(15);
  163. NSNumber* inputColor = @(0xFFFF0000);
  164. NSString* inputFont = @"HelveticaNeue";
  165. self.options.topBarTextFontSize = topBarTextFontSizeInput;
  166. self.options.topBarTextColor = inputColor;
  167. self.options.topBarTextFontFamily = inputFont;
  168. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  169. [self.uut viewWillAppear:false];
  170. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  171. UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
  172. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  173. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
  174. }
  175. -(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
  176. NSNumber* topBarTextFontSizeInput = @(15);
  177. NSString* inputFont = @"HelveticaNeue";
  178. self.options.topBarTextFontSize = topBarTextFontSizeInput;
  179. self.options.topBarTextFontFamily = inputFont;
  180. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  181. [self.uut viewWillAppear:false];
  182. UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
  183. XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
  184. }
  185. // TODO: Currently not passing
  186. -(void)testTopBarTextFontFamily_invalidFont{
  187. NSString* inputFont = @"HelveticaNeueeeee";
  188. __unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  189. self.options.topBarTextFontFamily = inputFont;
  190. // XCTAssertThrows([self.uut viewWillAppear:false]);
  191. }
  192. -(void)testOrientation_portrait {
  193. NSArray* supportedOrientations = @[@"portrait"];
  194. self.options.orientation = supportedOrientations;
  195. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  196. [self.uut viewWillAppear:false];
  197. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
  198. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  199. }
  200. -(void)testOrientation_portraitString {
  201. NSString* supportedOrientation = @"portrait";
  202. self.options.orientation = supportedOrientation;
  203. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  204. [self.uut viewWillAppear:false];
  205. UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait);
  206. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  207. }
  208. -(void)testOrientation_portraitAndLandscape {
  209. NSArray* supportedOrientations = @[@"portrait", @"landscape"];
  210. self.options.orientation = supportedOrientations;
  211. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  212. [self.uut viewWillAppear:false];
  213. UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
  214. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  215. }
  216. -(void)testOrientation_all {
  217. NSArray* supportedOrientations = @[@"all"];
  218. self.options.orientation = supportedOrientations;
  219. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  220. [self.uut viewWillAppear:false];
  221. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
  222. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  223. }
  224. -(void)testOrientation_default {
  225. NSString* supportedOrientations = @"default";
  226. self.options.orientation = supportedOrientations;
  227. __unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
  228. [self.uut viewWillAppear:false];
  229. UIInterfaceOrientationMask expectedOrientation = [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
  230. XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
  231. }
  232. -(void)testOrientationTabsController_portrait {
  233. NSArray* supportedOrientations = @[@"portrait"];
  234. self.options.orientation = supportedOrientations;
  235. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  236. NSMutableArray* controllers = [NSMutableArray new];
  237. [controllers addObject:self.uut];
  238. [vc setViewControllers:controllers];
  239. [self.uut viewWillAppear:false];
  240. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
  241. XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
  242. }
  243. -(void)testOrientationTabsController_portraitAndLandscape {
  244. NSArray* supportedOrientations = @[@"portrait", @"landscape"];
  245. self.options.orientation = supportedOrientations;
  246. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  247. NSMutableArray* controllers = [NSMutableArray new];
  248. [controllers addObject:self.uut];
  249. [vc setViewControllers:controllers];
  250. [self.uut viewWillAppear:false];
  251. UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
  252. XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
  253. }
  254. -(void)testOrientationTabsController_all {
  255. NSArray* supportedOrientations = @[@"all"];
  256. self.options.orientation = supportedOrientations;
  257. __unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
  258. NSMutableArray* controllers = [NSMutableArray new];
  259. [controllers addObject:self.uut];
  260. [vc setViewControllers:controllers];
  261. [self.uut viewWillAppear:false];
  262. UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
  263. XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
  264. }
  265. -(void)testRightButtonsWithTitle_withoutStyle {
  266. self.options.rightButtons = @[@{@"id": @"testId", @"title": @"test"}];
  267. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  268. [self.uut viewWillAppear:false];
  269. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.rightBarButtonItems objectAtIndex:0];
  270. NSString* expectedButtonId = @"testId";
  271. NSString* expectedTitle = @"test";
  272. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  273. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  274. XCTAssertTrue(button.enabled);
  275. }
  276. -(void)testRightButtonsWithTitle_withStyle {
  277. NSNumber* inputColor = @(0xFFFF0000);
  278. self.options.rightButtons = @[@{@"id": @"testId", @"title": @"test", @"disabled": @true, @"buttonColor": inputColor, @"buttonFontSize": @22, @"buttonFontWeight": @"800"}];
  279. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  280. [self.uut viewWillAppear:false];
  281. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.rightBarButtonItems objectAtIndex:0];
  282. NSString* expectedButtonId = @"testId";
  283. NSString* expectedTitle = @"test";
  284. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  285. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  286. XCTAssertFalse(button.enabled);
  287. //TODO: Determine how to tests buttonColor,buttonFontSize and buttonFontWeight?
  288. }
  289. -(void)testLeftButtonsWithTitle_withoutStyle {
  290. self.options.leftButtons = @[@{@"id": @"testId", @"title": @"test"}];
  291. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  292. [self.uut viewWillAppear:false];
  293. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.leftBarButtonItems objectAtIndex:0];
  294. NSString* expectedButtonId = @"testId";
  295. NSString* expectedTitle = @"test";
  296. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  297. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  298. XCTAssertTrue(button.enabled);
  299. }
  300. -(void)testLeftButtonsWithTitle_withStyle {
  301. NSNumber* inputColor = @(0xFFFF0000);
  302. self.options.leftButtons = @[@{@"id": @"testId", @"title": @"test", @"disabled": @true, @"buttonColor": inputColor, @"buttonFontSize": @22, @"buttonFontWeight": @"800"}];
  303. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  304. [self.uut viewWillAppear:false];
  305. RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.leftBarButtonItems objectAtIndex:0];
  306. NSString* expectedButtonId = @"testId";
  307. NSString* expectedTitle = @"test";
  308. XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
  309. XCTAssertTrue([button.title isEqualToString:expectedTitle]);
  310. XCTAssertFalse(button.enabled);
  311. //TODO: Determine how to tests buttonColor,buttonFontSize and buttonFontWeight?
  312. }
  313. -(void)testTopBarNoBorderOn {
  314. NSNumber* topBarNoBorderInput = @(1);
  315. self.options.topBarNoBorder = topBarNoBorderInput;
  316. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  317. [self.uut viewWillAppear:false];
  318. XCTAssertNotNil(self.uut.navigationController.navigationBar.shadowImage);
  319. }
  320. -(void)testTopBarNoBorderOff {
  321. NSNumber* topBarNoBorderInput = @(0);
  322. self.options.topBarNoBorder = topBarNoBorderInput;
  323. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  324. [self.uut viewWillAppear:false];
  325. XCTAssertNil(self.uut.navigationController.navigationBar.shadowImage);
  326. }
  327. -(void)testStatusBarBlurOn {
  328. NSNumber* statusBarBlurInput = @(1);
  329. self.options.statusBarBlur = statusBarBlurInput;
  330. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  331. [self.uut viewWillAppear:false];
  332. XCTAssertNotNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
  333. }
  334. -(void)testStatusBarBlurOff {
  335. NSNumber* statusBarBlurInput = @(0);
  336. self.options.statusBarBlur = statusBarBlurInput;
  337. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  338. [self.uut viewWillAppear:false];
  339. XCTAssertNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
  340. }
  341. - (void)testTabBarHidden_default {
  342. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  343. [self.uut viewWillAppear:false];
  344. XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
  345. }
  346. - (void)testTabBarHidden_true {
  347. self.options.tabBarHidden = @(1);
  348. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  349. [self.uut viewWillAppear:false];
  350. XCTAssertTrue([self.uut hidesBottomBarWhenPushed]);
  351. }
  352. - (void)testTabBarHidden_false {
  353. self.options.tabBarHidden = @(0);
  354. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  355. [self.uut viewWillAppear:false];
  356. XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
  357. }
  358. -(void)testTopBarBlur_default {
  359. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  360. [self.uut viewWillAppear:false];
  361. XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
  362. }
  363. -(void)testTopBarBlur_false {
  364. NSNumber* topBarBlurInput = @(0);
  365. self.options.topBarBlur = topBarBlurInput;
  366. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  367. [self.uut viewWillAppear:false];
  368. XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
  369. }
  370. -(void)testTopBarBlur_true {
  371. NSNumber* topBarBlurInput = @(1);
  372. self.options.topBarBlur = topBarBlurInput;
  373. __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
  374. [self.uut viewWillAppear:false];
  375. XCTAssertNotNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
  376. }
  377. @end