aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-07-02 10:17:57 +0800
committerPo Lu2022-07-02 10:18:05 +0800
commite3a3d6bf2324cf300d0d07bf655cf8f99ca030af (patch)
tree3d2a429dbbb9741e48683bd520146f194cb64115
parenta2d0a9ee5c78b12b10bb8666c87c4697c386757c (diff)
downloademacs-e3a3d6bf2324cf300d0d07bf655cf8f99ca030af.tar.gz
emacs-e3a3d6bf2324cf300d0d07bf655cf8f99ca030af.zip
Add interactive XDS test
* test/lisp/dnd-tests.el (dnd-tests-direct-save): New test.
-rw-r--r--test/lisp/dnd-tests.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/lisp/dnd-tests.el b/test/lisp/dnd-tests.el
index b6edbc3a2e7..88f6e694577 100644
--- a/test/lisp/dnd-tests.el
+++ b/test/lisp/dnd-tests.el
@@ -411,5 +411,31 @@ This function only tries to handle strings."
411 (inhibit-message t)) 411 (inhibit-message t))
412 (should (prog1 t (dnd-open-remote-url url 'private))))) 412 (should (prog1 t (dnd-open-remote-url url 'private)))))
413 413
414(ert-deftest dnd-tests-direct-save ()
415 ;; This test just verifies that a direct save works; the window
416 ;; system specific test is in x-dnd-tests.el. When running this
417 ;; interactively, keep in mind that there are only two file managers
418 ;; which are known to implement XDS correctly: System G (see
419 ;; http://nps-systemg.sourceforge.net), and Emacs itself. GTK file
420 ;; managers such as Nautilus will not work, since they prefer the
421 ;; `text/uri-list' selection target to `XdndDirectSave0', contrary
422 ;; to the XDS specification.
423 (let ((window-system window-system)
424 (normal-temp-file (expand-file-name (make-temp-name "dnd-test")
425 temporary-file-directory)))
426 (unwind-protect
427 (progn
428 (unless (file-exists-p normal-temp-file)
429 (write-region "" 0 normal-temp-file))
430 (unless (eq window-system 'x)
431 ;; Use a window system that isn't X, since we only want to test
432 ;; the fallback code when run non-interactively.
433 (setq window-system 'haiku))
434 (should (eq (dnd-direct-save normal-temp-file
435 (make-temp-name "target-file-name"))
436 'copy)))
437 (ignore-errors
438 (delete-file normal-temp-file)))))
439
414(provide 'dnd-tests) 440(provide 'dnd-tests)
415;;; dnd-tests.el ends here 441;;; dnd-tests.el ends here