Skip to content

Commit e1915a2

Browse files
authored
Merge pull request #584 from woxtu/image-creation
Improve test image creation
2 parents aaf9682 + b634bae commit e1915a2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Objective-C/TOCropViewControllerTests/TOCropViewControllerTests.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ @implementation TOCropViewControllerTests
1919

2020
- (void)testViewControllerInstance {
2121
//Create a basic image
22-
UIGraphicsBeginImageContextWithOptions((CGSize){10, 10}, NO, 1.0f);
23-
CGContextFillRect(UIGraphicsGetCurrentContext(), (CGRect){0,0,10,10});
24-
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
25-
UIGraphicsEndImageContext();
26-
22+
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:CGSizeMake(10, 10)];
23+
UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull context) {
24+
[context fillRect:CGRectMake(0, 0, 10, 10)];
25+
}];
26+
2727
//Perform test
2828
TOCropViewController *controller = [[TOCropViewController alloc] initWithImage:image];
2929
UIView *view = controller.view;

0 commit comments

Comments
 (0)