mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Test limits of arc/ellipse's start and end
This commit is contained in:
		
							parent
							
								
									f1631e0d05
								
							
						
					
					
						commit
						206e316c0e
					
				
							
								
								
									
										
											BIN
										
									
								
								Tests/images/imagedraw_arc_end_le_start.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/imagedraw_arc_end_le_start.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 218 B  | 
							
								
								
									
										
											BIN
										
									
								
								Tests/images/imagedraw_arc_no_loops.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/imagedraw_arc_no_loops.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 384 B  | 
| 
						 | 
					@ -80,6 +80,37 @@ class TestImageDraw(PillowTestCase):
 | 
				
			||||||
        self.helper_arc(BBOX2, 0, 180)
 | 
					        self.helper_arc(BBOX2, 0, 180)
 | 
				
			||||||
        self.helper_arc(BBOX2, 0.5, 180.4)
 | 
					        self.helper_arc(BBOX2, 0.5, 180.4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_arc_end_le_start(self):
 | 
				
			||||||
 | 
					        # Arrange
 | 
				
			||||||
 | 
					        im = Image.new("RGB", (W, H))
 | 
				
			||||||
 | 
					        draw = ImageDraw.Draw(im)
 | 
				
			||||||
 | 
					        start = 270.5
 | 
				
			||||||
 | 
					        end = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Act
 | 
				
			||||||
 | 
					        draw.arc(BBOX1, start=start, end=end)
 | 
				
			||||||
 | 
					        del draw
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Assert
 | 
				
			||||||
 | 
					        self.assert_image_equal(
 | 
				
			||||||
 | 
					            im, Image.open("Tests/images/imagedraw_arc_end_le_start.png"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_arc_no_loops(self):
 | 
				
			||||||
 | 
					        # No need to go in loops
 | 
				
			||||||
 | 
					        # Arrange
 | 
				
			||||||
 | 
					        im = Image.new("RGB", (W, H))
 | 
				
			||||||
 | 
					        draw = ImageDraw.Draw(im)
 | 
				
			||||||
 | 
					        start = 5
 | 
				
			||||||
 | 
					        end = 370
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Act
 | 
				
			||||||
 | 
					        draw.arc(BBOX1, start=start, end=end)
 | 
				
			||||||
 | 
					        del draw
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Assert
 | 
				
			||||||
 | 
					        self.assert_image_similar(
 | 
				
			||||||
 | 
					            im, Image.open("Tests/images/imagedraw_arc_no_loops.png"), 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_bitmap(self):
 | 
					    def test_bitmap(self):
 | 
				
			||||||
        # Arrange
 | 
					        # Arrange
 | 
				
			||||||
        small = Image.open("Tests/images/pil123rgba.png").resize((50, 50))
 | 
					        small = Image.open("Tests/images/pil123rgba.png").resize((50, 50))
 | 
				
			||||||
| 
						 | 
					@ -322,8 +353,6 @@ class TestImageDraw(PillowTestCase):
 | 
				
			||||||
        # Act
 | 
					        # Act
 | 
				
			||||||
        draw.rectangle(bbox, fill="orange")
 | 
					        draw.rectangle(bbox, fill="orange")
 | 
				
			||||||
        del draw
 | 
					        del draw
 | 
				
			||||||
        im.show()
 | 
					 | 
				
			||||||
        im.save(expected)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Assert
 | 
					        # Assert
 | 
				
			||||||
        self.assert_image_similar(im, Image.open(expected), 1)
 | 
					        self.assert_image_similar(im, Image.open(expected), 1)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user