mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	find * -type f "-(" -name "*.bdf" -o -name "*.c" -o -name "*.h" -o -name "*.py" -o -name "*.rst" -o -name "*.txt" "-)" -exec sed -e "s/[[:space:]]*$//" -i {} \;
		
	
			
		
			
				
	
	
		
			44 lines
		
	
	
		
			851 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			851 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from tester import *
 | |
| 
 | |
| from PIL import Image
 | |
| 
 | |
| def test_sanity():
 | |
| 
 | |
|     im1 = lena()
 | |
|     im2 = Image.new(im1.mode, im1.size, 0)
 | |
| 
 | |
|     for y in range(im1.size[1]):
 | |
|         for x in range(im1.size[0]):
 | |
|             pos = x, y
 | |
|             im2.putpixel(pos, im1.getpixel(pos))
 | |
| 
 | |
|     assert_image_equal(im1, im2)
 | |
| 
 | |
|     im2 = Image.new(im1.mode, im1.size, 0)
 | |
|     im2.readonly = 1
 | |
| 
 | |
|     for y in range(im1.size[1]):
 | |
|         for x in range(im1.size[0]):
 | |
|             pos = x, y
 | |
|             im2.putpixel(pos, im1.getpixel(pos))
 | |
| 
 | |
|     assert_false(im2.readonly)
 | |
|     assert_image_equal(im1, im2)
 | |
| 
 | |
|     im2 = Image.new(im1.mode, im1.size, 0)
 | |
| 
 | |
|     pix1 = im1.load()
 | |
|     pix2 = im2.load()
 | |
| 
 | |
|     for y in range(im1.size[1]):
 | |
|         for x in range(im1.size[0]):
 | |
|             pix2[x, y] = pix1[x, y]
 | |
| 
 | |
|     assert_image_equal(im1, im2)
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| # see test_image_getpixel for more tests
 | |
| 
 |