88from pygame .tests import test_utils
99from pygame .tests .test_utils import example_path
1010
11+
1112def surfaces_have_same_pixels (surf1 , surf2 ):
1213 if surf1 .get_size () != surf2 .get_size ():
1314 return False
14-
15+
1516 for row in range (surf1 .get_height ()):
1617 for col in range (surf1 .get_width ()):
1718 if surf1 .get_at ((col , row )) != surf2 .get_at ((col , row )):
1819 return False
19-
20+
2021 return True
2122
23+
2224def show_image (s , images = []):
2325 # pygame.display.init()
2426 size = s .get_rect ()[2 :]
@@ -1769,7 +1771,7 @@ def smoothscale_invalid_scale():
17691771 smaller_surface .get_at (((k // 2 ), 0 )), pygame .Color (127 , 127 , 127 )
17701772 )
17711773 self .assertEqual (smaller_surface .get_size (), (k , 1 ))
1772-
1774+
17731775 def test_pixelate (self ):
17741776 """Test pygame.transform.pixelate"""
17751777 # test that pixelating the original with a pixel_size of 1 yields the original back
@@ -1780,18 +1782,18 @@ def test_pixelate(self):
17801782 no_change = pygame .transform .pixelate (image , 1 )
17811783
17821784 self .assertTrue (surfaces_have_same_pixels (image , no_change ))
1783-
1785+
17841786 # test that pixelating a square image with a pixel_size equal to the side length
17851787 # yields a surface of a single color, which is the average of the surf
17861788 square = pygame .transform .scale (image , (50 , 50 ))
17871789 square_pixelated = pygame .transform .pixelate (square , 50 )
17881790 square_resized = pygame .transform .scale (
1789- pygame .transform .scale (square , (1 , 1 )),
1790- square .get_size ()
1791+ pygame .transform .scale (square , (1 , 1 )), square .get_size ()
17911792 )
17921793
17931794 self .assertTrue (surfaces_have_same_pixels (square_pixelated , square_resized ))
17941795
1796+
17951797class TransformDisplayModuleTest (unittest .TestCase ):
17961798 def setUp (self ):
17971799 pygame .display .init ()
0 commit comments