@@ -2447,19 +2447,27 @@ def test_aaline__args(self):
24472447
24482448 def test_aaline__blend_warning (self ):
24492449 """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 ]
24512451 with warnings .catch_warnings (record = True ) as w :
24522452 for count , blend in enumerate (faulty_blend_values ):
24532453 # Cause all warnings to always be triggered.
24542454 warnings .simplefilter ("always" )
24552455 # 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
24582462 )
24592463 # Check if there is only one warning and is a DeprecationWarning.
24602464 self .assertEqual (len (w ), count + 1 )
24612465 self .assertTrue (issubclass (w [- 1 ].category , DeprecationWarning ))
24622466
2467+ # check that the line gets drawn
2468+ self .assertEqual (bounding1 , bounding2 )
2469+ self .assertEqual (bounding1 , (0 , 0 , 2 , 2 ))
2470+
24632471 def test_aaline__kwargs (self ):
24642472 """Ensures draw aaline accepts the correct kwargs"""
24652473 surface = pygame .Surface ((4 , 4 ))
@@ -2681,11 +2689,10 @@ def test_aaline__valid_width_values(self):
26812689 for width in (- 100 , - 10 , - 1 , 0 , 1 , 10 , 100 ):
26822690 surface .fill (surface_color ) # Clear for each test.
26832691 kwargs ["width" ] = width
2684- expected_color = line_color if width > 0 else surface_color
26852692
26862693 bounds_rect = self .draw_aaline (** kwargs )
26872694
2688- self .assertEqual (surface .get_at (pos ), expected_color )
2695+ self .assertEqual (surface .get_at (pos ), line_color )
26892696 self .assertIsInstance (bounds_rect , pygame .Rect )
26902697
26912698 def test_aaline__valid_start_pos_formats (self ):
@@ -2928,15 +2935,9 @@ def test_aaline__bounding_rect(self):
29282935 surface , line_color , start , end , thickness
29292936 )
29302937
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 )
29402941
29412942 self .assertEqual (
29422943 bounding_rect ,
0 commit comments