]> git.eshelyaron.com Git - emacs.git/commitdiff
; Delete file after wallpaper test
authorStefan Kangas <stefankangas@gmail.com>
Wed, 19 Oct 2022 14:15:02 +0000 (16:15 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Wed, 19 Oct 2022 14:20:02 +0000 (16:20 +0200)
* test/lisp/image/wallpaper-tests.el
(wallpaper-set/calls-init-action): Don't leave temp file behind.

test/lisp/image/wallpaper-tests.el

index cb6818f8c1b21eb40abe5af47d85d03c4b93f939..ab980a11bb6aa702f214be4fa0b205ce0853f4a2 100644 (file)
                 ("touch" "touch" fil
                  :init-action (lambda () (setq called t)))))
               (wallpaper-command (wallpaper--find-command))
-              (wallpaper-command-args (wallpaper--find-command-args)))
+              (wallpaper-command-args (wallpaper--find-command-args))
+              (start (time-convert nil 'integer))
+              (timeout 3) process)
         (should (functionp (wallpaper-setter-init-action wallpaper--current-setter)))
-        (wallpaper-set fil-jpg)
+        (setq process (wallpaper-set fil-jpg))
+        ;; Wait for "touch" process to exit so temp file is removed.
+        (while (and (< (- (time-convert nil 'integer) start)
+                       timeout)
+                    (process-live-p process))
+          (sit-for 0.01))
         (should called)))))
 
 (ert-deftest wallpaper-set/calls-wallpaper-set-function ()