mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 18:07:51 +03:00 
			
		
		
		
	Added test
This commit is contained in:
		
							parent
							
								
									39cbd4f0f1
								
							
						
					
					
						commit
						5efa2ade22
					
				| 
						 | 
					@ -119,3 +119,15 @@ $ms = new-object System.IO.MemoryStream(, $bytes)
 | 
				
			||||||
            subprocess.call(["wl-copy"], stdin=fp)
 | 
					            subprocess.call(["wl-copy"], stdin=fp)
 | 
				
			||||||
        im = ImageGrab.grabclipboard()
 | 
					        im = ImageGrab.grabclipboard()
 | 
				
			||||||
        assert_image_equal_tofile(im, image_path)
 | 
					        assert_image_equal_tofile(im, image_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @pytest.mark.skipif(
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            sys.platform != "linux"
 | 
				
			||||||
 | 
					            or not all(shutil.which(cmd) for cmd in ("wl-paste", "wl-copy"))
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
 | 
					        reason="Linux with wl-clipboard only",
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    @pytest.mark.parametrize("arg", ("text", "--clear"))
 | 
				
			||||||
 | 
					    def test_grabclipboard_wl_clipboard_errors(self, arg):
 | 
				
			||||||
 | 
					        subprocess.call(["wl-copy", arg])
 | 
				
			||||||
 | 
					        assert ImageGrab.grabclipboard() is None
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,11 @@ def grabclipboard():
 | 
				
			||||||
            for silent_error in [
 | 
					            for silent_error in [
 | 
				
			||||||
                # wl-paste, when the clipboard is empty
 | 
					                # wl-paste, when the clipboard is empty
 | 
				
			||||||
                b"Nothing is copied",
 | 
					                b"Nothing is copied",
 | 
				
			||||||
                # wl-paste/debian xclip, when an image isn't available
 | 
					                # Ubuntu/Debian wl-paste, when the clipboard is empty
 | 
				
			||||||
 | 
					                b"No selection",
 | 
				
			||||||
 | 
					                # Ubuntu/Debian wl-paste, when an image isn't available
 | 
				
			||||||
 | 
					                b"No suitable type of content copied",
 | 
				
			||||||
 | 
					                # wl-paste or Ubuntu/Debian xclip, when an image isn't available
 | 
				
			||||||
                b" not available",
 | 
					                b" not available",
 | 
				
			||||||
                # xclip, when an image isn't available
 | 
					                # xclip, when an image isn't available
 | 
				
			||||||
                b"cannot convert ",
 | 
					                b"cannot convert ",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user