From 4c4b3da2b3ad817bc1fbccbe67ad181e974fae0a Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 28 Jan 2024 07:37:57 +1100 Subject: [PATCH] Added test --- Tests/test_imagegrab.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/test_imagegrab.py b/Tests/test_imagegrab.py index 9d3d40398f6..efef4d90807 100644 --- a/Tests/test_imagegrab.py +++ b/Tests/test_imagegrab.py @@ -119,3 +119,15 @@ def test_grabclipboard_wl_clipboard(self, ext): 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