@@ -2818,6 +2818,45 @@ private static void VerifyGraphics(Graphics graphics, RectangleF expectedVisible
2818
2818
Assert . Equal ( expectedVisibleClipBounds , graphics . VisibleClipBounds ) ;
2819
2819
}
2820
2820
2821
+ [ Fact ]
2822
+ public void IsVisible_AllOverloads_ReturnSameResult ( )
2823
+ {
2824
+ using Bitmap bitmap = new ( 100 , 100 ) ;
2825
+ using Graphics graphics = Graphics . FromImage ( bitmap ) ;
2826
+
2827
+ // Test points
2828
+ Point point = new ( 10 , 10 ) ;
2829
+ PointF pointF = new ( 10.5f , 10.5f ) ;
2830
+ int x = 10 , y = 10 ;
2831
+ float fx = 10.5f , fy = 10.5f ;
2832
+
2833
+ // Test rectangles
2834
+ Rectangle rect = new ( 10 , 10 , 50 , 50 ) ;
2835
+ RectangleF rectF = new ( 10.5f , 10.5f , 50.5f , 50.5f ) ;
2836
+ int width = 50 , height = 50 ;
2837
+ float fwidth = 50.5f , fheight = 50.5f ;
2838
+
2839
+ // Verify that all overloads return the same result for points
2840
+ bool result1 = graphics . IsVisible ( x , y ) ;
2841
+ bool result2 = graphics . IsVisible ( point ) ;
2842
+ bool result3 = graphics . IsVisible ( fx , fy ) ;
2843
+ bool result4 = graphics . IsVisible ( pointF ) ;
2844
+
2845
+ result1 . Should ( ) . Be ( result2 ) ;
2846
+ result1 . Should ( ) . Be ( result3 ) ;
2847
+ result1 . Should ( ) . Be ( result4 ) ;
2848
+
2849
+ // Verify that all overloads return the same result for rectangles
2850
+ bool result5 = graphics . IsVisible ( x , y , width , height ) ;
2851
+ bool result6 = graphics . IsVisible ( rect ) ;
2852
+ bool result7 = graphics . IsVisible ( fx , fy , fwidth , fheight ) ;
2853
+ bool result8 = graphics . IsVisible ( rectF ) ;
2854
+
2855
+ result5 . Should ( ) . Be ( result6 ) ;
2856
+ result5 . Should ( ) . Be ( result7 ) ;
2857
+ result5 . Should ( ) . Be ( result8 ) ;
2858
+ }
2859
+
2821
2860
#if NET8_0_OR_GREATER
2822
2861
[ Fact ]
2823
2862
public void DrawCachedBitmap_ThrowsArgumentNullException ( )
0 commit comments