mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Test ImageDraw.Outline curve
This commit is contained in:
		
							parent
							
								
									008431fe0e
								
							
						
					
					
						commit
						96dfd722c3
					
				| 
		 Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B  | 
							
								
								
									
										
											BIN
										
									
								
								Tests/images/imagedraw_shape2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/imagedraw_shape2.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 459 B  | 
| 
						 | 
					@ -172,7 +172,7 @@ class TestImageDraw(PillowTestCase):
 | 
				
			||||||
    def test_line2(self):
 | 
					    def test_line2(self):
 | 
				
			||||||
        self.helper_line(POINTS2)
 | 
					        self.helper_line(POINTS2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_outline_curve(self):
 | 
					    def test_shape1(self):
 | 
				
			||||||
        # Arrange
 | 
					        # Arrange
 | 
				
			||||||
        im = Image.new("RGB", (100, 100), "white")
 | 
					        im = Image.new("RGB", (100, 100), "white")
 | 
				
			||||||
        draw = ImageDraw.Draw(im)
 | 
					        draw = ImageDraw.Draw(im)
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,29 @@ class TestImageDraw(PillowTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Assert
 | 
					        # Assert
 | 
				
			||||||
        self.assert_image_equal(
 | 
					        self.assert_image_equal(
 | 
				
			||||||
            im, Image.open("Tests/images/imagedraw_outline_curve.png"))
 | 
					            im, Image.open("Tests/images/imagedraw_shape1.png"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_shape2(self):
 | 
				
			||||||
 | 
					        # Arrange
 | 
				
			||||||
 | 
					        im = Image.new("RGB", (100, 100), "white")
 | 
				
			||||||
 | 
					        draw = ImageDraw.Draw(im)
 | 
				
			||||||
 | 
					        x0, y0 = 95, 95
 | 
				
			||||||
 | 
					        x1, y1 = 95, 50
 | 
				
			||||||
 | 
					        x2, y2 = 5, 50
 | 
				
			||||||
 | 
					        x3, y3 = 5, 95
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Act
 | 
				
			||||||
 | 
					        s = ImageDraw.Outline()
 | 
				
			||||||
 | 
					        s.move(x0, y0)
 | 
				
			||||||
 | 
					        s.curve(x1, y1, x2, y2, x3, y3)
 | 
				
			||||||
 | 
					        s.line(x0, y0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        draw.shape(s, outline="blue")
 | 
				
			||||||
 | 
					        del draw
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Assert
 | 
				
			||||||
 | 
					        self.assert_image_equal(
 | 
				
			||||||
 | 
					            im, Image.open("Tests/images/imagedraw_shape2.png"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def helper_pieslice(self, bbox, start, end):
 | 
					    def helper_pieslice(self, bbox, start, end):
 | 
				
			||||||
        # Arrange
 | 
					        # Arrange
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user