react-native-navigation的迁移库

UITabBarController+RNNOptionsTest.m 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #import <XCTest/XCTest.h>
  2. #import <OCMock/OCMock.h>
  3. #import "UITabBarController+RNNOptions.h"
  4. #import "UITabBar+utils.h"
  5. @interface UITabBarController_RNNOptionsTest : XCTestCase
  6. @property (nonatomic, retain) UITabBarController* uut;
  7. @end
  8. @implementation UITabBarController_RNNOptionsTest
  9. - (void)setUp {
  10. [super setUp];
  11. self.uut = [OCMockObject partialMockForObject:[UITabBarController new]];
  12. OCMStub([self.uut tabBar]).andReturn([OCMockObject partialMockForObject:[UITabBar new]]);
  13. }
  14. - (void)test_tabBarTranslucent_true {
  15. [self.uut setTabBarTranslucent:YES];
  16. XCTAssertTrue(self.uut.tabBar.translucent);
  17. }
  18. - (void)test_tabBarTranslucent_false {
  19. [self.uut setTabBarTranslucent:NO];
  20. XCTAssertFalse(self.uut.tabBar.translucent);
  21. }
  22. - (void)test_tabBarHideShadow_default {
  23. XCTAssertFalse(self.uut.tabBar.clipsToBounds);
  24. }
  25. - (void)test_tabBarHideShadow_true {
  26. [self.uut setTabBarHideShadow:YES];
  27. XCTAssertTrue(self.uut.tabBar.clipsToBounds);
  28. }
  29. - (void)test_tabBarHideShadow_false {
  30. [self.uut setTabBarHideShadow:NO];
  31. XCTAssertFalse(self.uut.tabBar.clipsToBounds);
  32. }
  33. - (void)test_centerTabItems {
  34. [[(id)self.uut.tabBar expect] centerTabItems];
  35. [self.uut centerTabItems];
  36. [(id)self.uut.tabBar verify];
  37. }
  38. - (void)test_tabBarBackgroundColor {
  39. UIColor* tabBarBackgroundColor = [UIColor redColor];
  40. [self.uut setTabBarBackgroundColor:tabBarBackgroundColor];
  41. XCTAssertTrue([self.uut.tabBar.barTintColor isEqual:tabBarBackgroundColor]);
  42. }
  43. @end