mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Added some oblique 45º lines tests
Only the oblique 3 pixels wide lines are defined: * The oblique 2 pixels wide lines are somewhat hard to define. * To define the oblique lines wider than 3 pixels we neet to define first how the oblique lines should expand their width (realistic or exact).
This commit is contained in:
		
							parent
							
								
									92dd58c014
								
							
						
					
					
						commit
						8228caf14d
					
				
							
								
								
									
										
											BIN
										
									
								
								Tests/images/imagedraw/line_oblique_45_w3px_a.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/imagedraw/line_oblique_45_w3px_a.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 182 B  | 
							
								
								
									
										
											BIN
										
									
								
								Tests/images/imagedraw/line_oblique_45_w3px_b.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/imagedraw/line_oblique_45_w3px_b.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 179 B  | 
| 
						 | 
				
			
			@ -108,3 +108,22 @@ def test_line_vertical():
 | 
			
		|||
    img, draw = create_base_image_draw((20, 20))
 | 
			
		||||
    draw.line((5, 14, 5, 5), BLACK, 3)
 | 
			
		||||
    assert_image_equal(img, expected, 'line straigth vertical inverted 3px wide failed')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_line_oblique_45():
 | 
			
		||||
    expected = Image.open(os.path.join(IMAGES_PATH, 'line_oblique_45_w3px_a.png'))
 | 
			
		||||
    expected.load()
 | 
			
		||||
    img, draw = create_base_image_draw((20, 20))
 | 
			
		||||
    draw.line((5, 5, 14, 14), BLACK, 3)
 | 
			
		||||
    assert_image_equal(img, expected, 'line oblique 45º normal 3px wide A failed')
 | 
			
		||||
    img, draw = create_base_image_draw((20, 20))
 | 
			
		||||
    draw.line((14, 14, 5, 5), BLACK, 3)
 | 
			
		||||
    assert_image_equal(img, expected, 'line oblique 45º inverted 3px wide A failed')
 | 
			
		||||
    expected = Image.open(os.path.join(IMAGES_PATH, 'line_oblique_45_w3px_b.png'))
 | 
			
		||||
    expected.load()
 | 
			
		||||
    img, draw = create_base_image_draw((20, 20))
 | 
			
		||||
    draw.line((14, 5, 5, 14), BLACK, 3)
 | 
			
		||||
    assert_image_equal(img, expected, 'line oblique 45º normal 3px wide B failed')
 | 
			
		||||
    img, draw = create_base_image_draw((20, 20))
 | 
			
		||||
    draw.line((5, 14, 14, 5), BLACK, 3)
 | 
			
		||||
    assert_image_equal(img, expected, 'line oblique 45º inverted 3px wide B failed')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user