emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e3a3d6bf23: Add interactive XDS test


From: Po Lu
Subject: master e3a3d6bf23: Add interactive XDS test
Date: Fri, 1 Jul 2022 22:18:15 -0400 (EDT)

branch: master
commit e3a3d6bf2324cf300d0d07bf655cf8f99ca030af
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Add interactive XDS test
    
    * test/lisp/dnd-tests.el (dnd-tests-direct-save): New test.
---
 test/lisp/dnd-tests.el | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/test/lisp/dnd-tests.el b/test/lisp/dnd-tests.el
index b6edbc3a2e..88f6e69457 100644
--- a/test/lisp/dnd-tests.el
+++ b/test/lisp/dnd-tests.el
@@ -411,5 +411,31 @@ This function only tries to handle strings."
         (inhibit-message t))
     (should (prog1 t (dnd-open-remote-url url 'private)))))
 
+(ert-deftest dnd-tests-direct-save ()
+  ;; This test just verifies that a direct save works; the window
+  ;; system specific test is in x-dnd-tests.el.  When running this
+  ;; interactively, keep in mind that there are only two file managers
+  ;; which are known to implement XDS correctly: System G (see
+  ;; http://nps-systemg.sourceforge.net), and Emacs itself.  GTK file
+  ;; managers such as Nautilus will not work, since they prefer the
+  ;; `text/uri-list' selection target to `XdndDirectSave0', contrary
+  ;; to the XDS specification.
+  (let ((window-system window-system)
+        (normal-temp-file (expand-file-name (make-temp-name "dnd-test")
+                                            temporary-file-directory)))
+    (unwind-protect
+        (progn
+          (unless (file-exists-p normal-temp-file)
+            (write-region "" 0 normal-temp-file))
+          (unless (eq window-system 'x)
+            ;; Use a window system that isn't X, since we only want to test
+            ;; the fallback code when run non-interactively.
+            (setq window-system 'haiku))
+          (should (eq (dnd-direct-save normal-temp-file
+                                       (make-temp-name "target-file-name"))
+                      'copy)))
+      (ignore-errors
+        (delete-file normal-temp-file)))))
+
 (provide 'dnd-tests)
 ;;; dnd-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]