aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Kangas2022-09-26 14:38:25 +0200
committerStefan Kangas2022-09-26 17:41:37 +0200
commitb0289e7f6ddebdd2bdefa63e2b4afcb29733b3b7 (patch)
treedea172d18b22c9a5cb6124a4e9b024311bb5d329 /test
parent35d5ad713ee05f5cd922f66462df41deed95f7e8 (diff)
downloademacs-b0289e7f6ddebdd2bdefa63e2b4afcb29733b3b7.tar.gz
emacs-b0289e7f6ddebdd2bdefa63e2b4afcb29733b3b7.zip
Fix setting the wallpaper in XFCE
* lisp/image/wallpaper.el (wallpaper-command-args) (wallpaper-default-set-function): Support new format specifiers %S for screen, %W for workspace, and %M for monitor. (wallpaper--default-setters): Use above new specifiers for XFCE. (wallpaper--format-arg): New defun broken out from... (wallpaper-default-set-function): ...here. (wallpaper--get-height-or-width): Support noninteractive use. * test/lisp/image/wallpaper-tests.el (wallpaper--format-arg/filename) (wallpaper--format-arg/filename-hex) (wallpaper--format-arg/width, wallpaper--format-arg/screen) (wallpaper--format-arg/monitor, wallpaper--format-arg/workspace): New tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/image/wallpaper-tests.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lisp/image/wallpaper-tests.el b/test/lisp/image/wallpaper-tests.el
index 80d512c9858..c3feab0e206 100644
--- a/test/lisp/image/wallpaper-tests.el
+++ b/test/lisp/image/wallpaper-tests.el
@@ -54,4 +54,33 @@
54 (insert fil) 54 (insert fil)
55 (should (stringp (wallpaper--get-default-file)))))) 55 (should (stringp (wallpaper--get-default-file))))))
56 56
57(ert-deftest wallpaper--format-arg/filename ()
58 (should (file-name-absolute-p (wallpaper--format-arg "%f" "foo.jpg"))))
59
60(ert-deftest wallpaper--format-arg/filename-hex ()
61 (should (equal (wallpaper--format-arg "%F" "foo bar åäö.jpg")
62 "foo%20bar%20%C3%A5%C3%A4%C3%B6.jpg")))
63
64(ert-deftest wallpaper--format-arg/width ()
65 (skip-unless noninteractive)
66 (should (equal (wallpaper--format-arg "%w" "foo.jpg")
67 (number-to-string wallpaper-default-width))))
68
69(ert-deftest wallpaper--format-arg/height ()
70 (skip-unless noninteractive)
71 (should (equal (wallpaper--format-arg "%h" "foo.jpg")
72 (number-to-string wallpaper-default-height))))
73
74(ert-deftest wallpaper--format-arg/screen ()
75 (skip-unless noninteractive)
76 (should (equal (wallpaper--format-arg "%S" "foo.jpg") "0")))
77
78(ert-deftest wallpaper--format-arg/monitor ()
79 (skip-unless noninteractive)
80 (should (equal (wallpaper--format-arg "%M" "foo.jpg") "0")))
81
82(ert-deftest wallpaper--format-arg/workspace ()
83 (skip-unless noninteractive)
84 (should (equal (wallpaper--format-arg "%W" "foo.jpg") "0")))
85
57;;; wallpaper-tests.el ends here 86;;; wallpaper-tests.el ends here