Browse Source

unit test fix

yogevbd 6 years ago
parent
commit
02200e422b

+ 4
- 4
lib/ios/RNNNavigationOptions.m View File

74
 			backgroundImageView = [[UIImageView alloc] initWithFrame:viewController.view.bounds];
74
 			backgroundImageView = [[UIImageView alloc] initWithFrame:viewController.view.bounds];
75
 			[viewController.view insertSubview:backgroundImageView atIndex:0];
75
 			[viewController.view insertSubview:backgroundImageView atIndex:0];
76
 		}
76
 		}
77
-		
77
+
78
 		backgroundImageView.layer.masksToBounds = YES;
78
 		backgroundImageView.layer.masksToBounds = YES;
79
-		backgroundImageView.image = [RCTConvert UIImage:self.backgroundImage];
79
+		backgroundImageView.image = [self.backgroundImage isKindOfClass:[UIImage class]] ? (UIImage*)self.backgroundImage : [RCTConvert UIImage:self.backgroundImage];
80
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
80
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
81
 	}
81
 	}
82
 	
82
 	
86
 			backgroundImageView = [[UIImageView alloc] initWithFrame:viewController.view.bounds];
86
 			backgroundImageView = [[UIImageView alloc] initWithFrame:viewController.view.bounds];
87
 			[viewController.navigationController.view insertSubview:backgroundImageView atIndex:0];
87
 			[viewController.navigationController.view insertSubview:backgroundImageView atIndex:0];
88
 		}
88
 		}
89
-		
89
+
90
 		backgroundImageView.layer.masksToBounds = YES;
90
 		backgroundImageView.layer.masksToBounds = YES;
91
-		backgroundImageView.image = [RCTConvert UIImage:self.rootBackgroundImage];
91
+		backgroundImageView.image = [self.rootBackgroundImage isKindOfClass:[UIImage class]] ? (UIImage*)self.rootBackgroundImage : [RCTConvert UIImage:self.rootBackgroundImage];
92
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
92
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
93
 	}
93
 	}
94
 	
94
 	

+ 2
- 1
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

41
 	self.pageName = @"somename";
41
 	self.pageName = @"somename";
42
 	self.componentId = @"cntId";
42
 	self.componentId = @"cntId";
43
 	self.emitter = nil;
43
 	self.emitter = nil;
44
-	self.options = [RNNNavigationOptions new];
44
+	self.options = [[RNNNavigationOptions alloc] initWithDict:@{}];
45
 	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withComponentId:self.componentId rootViewCreator:self.creator eventEmitter:self.emitter isExternalComponent:NO];
45
 	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withComponentId:self.componentId rootViewCreator:self.creator eventEmitter:self.emitter isExternalComponent:NO];
46
 }
46
 }
47
 
47
 
533
 	self.options.backgroundImage = backgroundImage;
533
 	self.options.backgroundImage = backgroundImage;
534
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
534
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
535
 	[self.uut viewWillAppear:false];
535
 	[self.uut viewWillAppear:false];
536
+	
536
 	XCTAssertTrue([[(UIImageView*)self.uut.view.subviews[0] image] isEqual:backgroundImage]);
537
 	XCTAssertTrue([[(UIImageView*)self.uut.view.subviews[0] image] isEqual:backgroundImage]);
537
 }
538
 }
538
 
539