@@ -2447,19 +2447,27 @@ def test_aaline__args(self):
2447
2447
2448
2448
def test_aaline__blend_warning (self ):
2449
2449
"""Using the blend argument should raise a DeprecationWarning"""
2450
- faulty_blend_values = [0 , 1 , True , False , None , "" , [], type ]
2450
+ faulty_blend_values = [0 , 1 , True , False ]
2451
2451
with warnings .catch_warnings (record = True ) as w :
2452
2452
for count , blend in enumerate (faulty_blend_values ):
2453
2453
# Cause all warnings to always be triggered.
2454
2454
warnings .simplefilter ("always" )
2455
2455
# Trigger DeprecationWarning.
2456
- self .draw_aaline (
2457
- pygame .Surface ((2 , 2 )), (0 , 0 , 0 , 50 ), (0 , 0 ), (2 , 2 ), 1 , blend
2456
+ bounding1 = self .draw_aaline (
2457
+ pygame .Surface ((2 , 2 )), (0 , 0 , 0 , 50 ), (0 , 0 ), (2 , 2 ), blend = blend
2458
+ )
2459
+ # Doesn't trigger DeprecationWarning, interepreted as width
2460
+ bounding2 = self .draw_aaline (
2461
+ pygame .Surface ((2 , 2 )), (0 , 0 , 0 , 50 ), (0 , 0 ), (2 , 2 ), blend
2458
2462
)
2459
2463
# Check if there is only one warning and is a DeprecationWarning.
2460
2464
self .assertEqual (len (w ), count + 1 )
2461
2465
self .assertTrue (issubclass (w [- 1 ].category , DeprecationWarning ))
2462
2466
2467
+ # check that the line gets drawn
2468
+ self .assertEqual (bounding1 , bounding2 )
2469
+ self .assertEqual (bounding1 , (0 , 0 , 2 , 2 ))
2470
+
2463
2471
def test_aaline__kwargs (self ):
2464
2472
"""Ensures draw aaline accepts the correct kwargs"""
2465
2473
surface = pygame .Surface ((4 , 4 ))
@@ -2681,11 +2689,10 @@ def test_aaline__valid_width_values(self):
2681
2689
for width in (- 100 , - 10 , - 1 , 0 , 1 , 10 , 100 ):
2682
2690
surface .fill (surface_color ) # Clear for each test.
2683
2691
kwargs ["width" ] = width
2684
- expected_color = line_color if width > 0 else surface_color
2685
2692
2686
2693
bounds_rect = self .draw_aaline (** kwargs )
2687
2694
2688
- self .assertEqual (surface .get_at (pos ), expected_color )
2695
+ self .assertEqual (surface .get_at (pos ), line_color )
2689
2696
self .assertIsInstance (bounds_rect , pygame .Rect )
2690
2697
2691
2698
def test_aaline__valid_start_pos_formats (self ):
@@ -2928,15 +2935,9 @@ def test_aaline__bounding_rect(self):
2928
2935
surface , line_color , start , end , thickness
2929
2936
)
2930
2937
2931
- if 0 < thickness :
2932
- # Calculating the expected_rect after the line is
2933
- # drawn (it uses what is actually drawn).
2934
- expected_rect = create_bounding_rect (
2935
- surface , surf_color , start
2936
- )
2937
- else :
2938
- # Nothing drawn.
2939
- expected_rect = pygame .Rect (start , (0 , 0 ))
2938
+ # Calculating the expected_rect after the line is
2939
+ # drawn (it uses what is actually drawn).
2940
+ expected_rect = create_bounding_rect (surface , surf_color , start )
2940
2941
2941
2942
self .assertEqual (
2942
2943
bounding_rect ,
0 commit comments