From b634bae039f9ea75d380c8498e468cdc28c21f84 Mon Sep 17 00:00:00 2001
From: woxtu <woxtup@gmail.com>
Date: Wed, 29 May 2024 00:31:03 +0900
Subject: [PATCH] Improve test image creation

---
 .../TOCropViewControllerTests.m                        | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Objective-C/TOCropViewControllerTests/TOCropViewControllerTests.m b/Objective-C/TOCropViewControllerTests/TOCropViewControllerTests.m
index 57f98510..1b0c7f4c 100644
--- a/Objective-C/TOCropViewControllerTests/TOCropViewControllerTests.m
+++ b/Objective-C/TOCropViewControllerTests/TOCropViewControllerTests.m
@@ -19,11 +19,11 @@ @implementation TOCropViewControllerTests
 
 - (void)testViewControllerInstance {
     //Create a basic image
-    UIGraphicsBeginImageContextWithOptions((CGSize){10, 10}, NO, 1.0f);
-    CGContextFillRect(UIGraphicsGetCurrentContext(), (CGRect){0,0,10,10});
-    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
-    UIGraphicsEndImageContext();
-    
+    UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:CGSizeMake(10, 10)];
+    UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull context) {
+        [context fillRect:CGRectMake(0, 0, 10, 10)];
+    }];
+
     //Perform test
     TOCropViewController *controller = [[TOCropViewController alloc] initWithImage:image];
     UIView *view = controller.view;