mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	
						commit
						8156798cec
					
				|  | @ -119,3 +119,15 @@ $ms = new-object System.IO.MemoryStream(, $bytes) | |||
|             subprocess.call(["wl-copy"], stdin=fp) | ||||
|         im = ImageGrab.grabclipboard() | ||||
|         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,14 +162,18 @@ def grabclipboard(): | |||
|             for silent_error in [ | ||||
|                 # wl-paste, when the clipboard is empty | ||||
|                 b"Nothing is copied", | ||||
|                 # wl-paste/debian xclip, when an image isn't available | ||||
|                 b"not 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", | ||||
|                 # xclip, when an image isn't available | ||||
|                 b"cannot convert", | ||||
|                 b"cannot convert ", | ||||
|                 # xclip, when the clipboard isn't initialized | ||||
|                 b"There is no owner", | ||||
|                 b"xclip: Error: There is no owner for the ", | ||||
|             ]: | ||||
|                 if err in silent_error: | ||||
|                 if silent_error in err: | ||||
|                     return None | ||||
|             msg = f"{args[0]} error" | ||||
|             if err: | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user