diff options
| author | Po Lu | 2022-06-29 20:14:15 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-29 20:14:41 +0800 |
| commit | b7d3231e80e5ac26dd824d9d3c7d7337ebc2f021 (patch) | |
| tree | 5a5a5da7fcb87aebbd06b14e79c9db7f6833f73b /test | |
| parent | d07063f69fab25da49c69e7790223511d61e9098 (diff) | |
| download | emacs-b7d3231e80e5ac26dd824d9d3c7d7337ebc2f021.tar.gz emacs-b7d3231e80e5ac26dd824d9d3c7d7337ebc2f021.zip | |
Update dnd-tests.el to make sure remote files are removed when Emacs quits
* test/lisp/dnd-tests.el (dnd-tests-begin-drag-files)
(dnd-tests-begin-file-drag): Test value of `kill-emacs-hook'.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/dnd-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/dnd-tests.el b/test/lisp/dnd-tests.el index 18dd55c206c..b6edbc3a2e7 100644 --- a/test/lisp/dnd-tests.el +++ b/test/lisp/dnd-tests.el | |||
| @@ -242,10 +242,17 @@ This function only tries to handle strings." | |||
| 242 | ;; Test that the remote file was added to the list of files | 242 | ;; Test that the remote file was added to the list of files |
| 243 | ;; to remove later. | 243 | ;; to remove later. |
| 244 | (should dnd-last-dragged-remote-file) | 244 | (should dnd-last-dragged-remote-file) |
| 245 | ;; Make sure the appropriate hook is added so the remote | ||
| 246 | ;; files are removed when Emacs exits. | ||
| 247 | (should (memq #'dnd-remove-last-dragged-remote-file | ||
| 248 | kill-emacs-hook)) | ||
| 245 | ;; Test that the remote file was removed. | 249 | ;; Test that the remote file was removed. |
| 246 | (should (progn | 250 | (should (progn |
| 247 | (dnd-begin-file-drag normal-temp-file) | 251 | (dnd-begin-file-drag normal-temp-file) |
| 248 | (not dnd-last-dragged-remote-file))) | 252 | (not dnd-last-dragged-remote-file))) |
| 253 | ;; Make sure the remote file removal hook was deleted. | ||
| 254 | (should-not (memq #'dnd-remove-last-dragged-remote-file | ||
| 255 | kill-emacs-hook)) | ||
| 249 | ;; Test that links to remote files can't be created. | 256 | ;; Test that links to remote files can't be created. |
| 250 | (should-error (dnd-begin-file-drag remote-temp-file nil 'link)) | 257 | (should-error (dnd-begin-file-drag remote-temp-file nil 'link)) |
| 251 | ;; Test dragging a file with a multibyte filename. | 258 | ;; Test dragging a file with a multibyte filename. |
| @@ -298,12 +305,19 @@ This function only tries to handle strings." | |||
| 298 | ;; Test that the remote file produced was added to the list | 305 | ;; Test that the remote file produced was added to the list |
| 299 | ;; of files to remove upon the next call. | 306 | ;; of files to remove upon the next call. |
| 300 | (should dnd-last-dragged-remote-file) | 307 | (should dnd-last-dragged-remote-file) |
| 308 | ;; Make sure the appropriate hook is added so the remote | ||
| 309 | ;; files are removed when Emacs exits. | ||
| 310 | (should (memq #'dnd-remove-last-dragged-remote-file | ||
| 311 | kill-emacs-hook)) | ||
| 301 | ;; Two local files at the same time. | 312 | ;; Two local files at the same time. |
| 302 | (should (eq (dnd-begin-drag-files (list normal-temp-file | 313 | (should (eq (dnd-begin-drag-files (list normal-temp-file |
| 303 | normal-temp-file-1)) | 314 | normal-temp-file-1)) |
| 304 | 'copy)) | 315 | 'copy)) |
| 305 | ;; Test that the remote files were removed. | 316 | ;; Test that the remote files were removed. |
| 306 | (should-not dnd-last-dragged-remote-file) | 317 | (should-not dnd-last-dragged-remote-file) |
| 318 | ;; And so was the hook. | ||
| 319 | (should-not (memq #'dnd-remove-last-dragged-remote-file | ||
| 320 | kill-emacs-hook)) | ||
| 307 | ;; Test the selection data is correct. | 321 | ;; Test the selection data is correct. |
| 308 | (let ((uri-list-data (cdr (dnd-tests-verify-selection-data 'text/uri-list))) | 322 | (let ((uri-list-data (cdr (dnd-tests-verify-selection-data 'text/uri-list))) |
| 309 | (username-data (dnd-tests-verify-selection-data 'text/x-xdnd-username)) | 323 | (username-data (dnd-tests-verify-selection-data 'text/x-xdnd-username)) |
| @@ -347,6 +361,10 @@ This function only tries to handle strings." | |||
| 347 | ;; Make sure exactly two valid remote files | 361 | ;; Make sure exactly two valid remote files |
| 348 | ;; were downloaded. | 362 | ;; were downloaded. |
| 349 | (eq (length dnd-last-dragged-remote-file) 2))) | 363 | (eq (length dnd-last-dragged-remote-file) 2))) |
| 364 | ;; Make sure the appropriate hook is added so the remote | ||
| 365 | ;; files are removed when Emacs exits. | ||
| 366 | (should (memq #'dnd-remove-last-dragged-remote-file | ||
| 367 | kill-emacs-hook)) | ||
| 350 | ;; Make sure links can't be created to remote files. | 368 | ;; Make sure links can't be created to remote files. |
| 351 | (should-error (dnd-begin-drag-files (list normal-temp-file | 369 | (should-error (dnd-begin-drag-files (list normal-temp-file |
| 352 | remote-temp-file | 370 | remote-temp-file |
| @@ -357,6 +375,9 @@ This function only tries to handle strings." | |||
| 357 | normal-temp-file-1) | 375 | normal-temp-file-1) |
| 358 | nil 'link) | 376 | nil 'link) |
| 359 | 'link)) | 377 | 'link)) |
| 378 | ;; Make sure the remote file removal hook was deleted. | ||
| 379 | (should-not (memq #'dnd-remove-last-dragged-remote-file | ||
| 380 | kill-emacs-hook)) | ||
| 360 | ;; Make sure you can't drag an empty list of files. | 381 | ;; Make sure you can't drag an empty list of files. |
| 361 | (should-error (dnd-begin-drag-files nil)) | 382 | (should-error (dnd-begin-drag-files nil)) |
| 362 | ;; And when all remote files are inaccessible. | 383 | ;; And when all remote files are inaccessible. |