Browse Source

unit test fix

yogevbd 6 years ago
parent
commit
02200e422b

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

@@ -74,9 +74,9 @@ RCT_ENUM_CONVERTER(UIModalPresentationStyle,
74 74
 			backgroundImageView = [[UIImageView alloc] initWithFrame:viewController.view.bounds];
75 75
 			[viewController.view insertSubview:backgroundImageView atIndex:0];
76 76
 		}
77
-		
77
+
78 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 80
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
81 81
 	}
82 82
 	
@@ -86,9 +86,9 @@ RCT_ENUM_CONVERTER(UIModalPresentationStyle,
86 86
 			backgroundImageView = [[UIImageView alloc] initWithFrame:viewController.view.bounds];
87 87
 			[viewController.navigationController.view insertSubview:backgroundImageView atIndex:0];
88 88
 		}
89
-		
89
+
90 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 92
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
93 93
 	}
94 94
 	

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

@@ -41,7 +41,7 @@
41 41
 	self.pageName = @"somename";
42 42
 	self.componentId = @"cntId";
43 43
 	self.emitter = nil;
44
-	self.options = [RNNNavigationOptions new];
44
+	self.options = [[RNNNavigationOptions alloc] initWithDict:@{}];
45 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,6 +533,7 @@
533 533
 	self.options.backgroundImage = backgroundImage;
534 534
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
535 535
 	[self.uut viewWillAppear:false];
536
+	
536 537
 	XCTAssertTrue([[(UIImageView*)self.uut.view.subviews[0] image] isEqual:backgroundImage]);
537 538
 }
538 539