Failing test, dunno why
This commit is contained in:
parent
5e6810adb6
commit
1c32cdbf54
|
@ -247,8 +247,8 @@ to choose where to display it:
|
|||
(let ((b (get-buffer plantuml-preview-buffer)))
|
||||
(when b
|
||||
(with-current-buffer b
|
||||
(setq buffer-read-only nil)
|
||||
(erase-buffer))))
|
||||
(setq buffer-read-only nil)
|
||||
(erase-buffer))))
|
||||
|
||||
(let* ((imagep (and (display-images-p)
|
||||
(plantuml-is-image-output-p)))
|
||||
|
@ -264,13 +264,13 @@ to choose where to display it:
|
|||
(lambda (_ps event)
|
||||
(unless (equal event "finished\n")
|
||||
(error "PLANTUML Preview failed: %s" event))
|
||||
|
||||
(cond
|
||||
((= prefix 16)
|
||||
(switch-to-buffer-other-frame plantuml-preview-buffer))
|
||||
((= prefix 4)
|
||||
(switch-to-buffer plantuml-preview-buffer))
|
||||
(t (switch-to-buffer-other-window plantuml-preview-buffer)))
|
||||
(if (numberp prefix)
|
||||
(cond
|
||||
((= prefix 16)
|
||||
(switch-to-buffer-other-frame plantuml-preview-buffer))
|
||||
((= prefix 4)
|
||||
(switch-to-buffer plantuml-preview-buffer)))
|
||||
(switch-to-buffer-other-window plantuml-preview-buffer))
|
||||
(when imagep
|
||||
(image-mode)
|
||||
(set-buffer-multibyte t)))))))
|
||||
|
|
|
@ -8,16 +8,20 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(defun assert-preview-content (expected)
|
||||
"Assert the contents of the preview buffer to be equal to EXPECTED."
|
||||
(should (equal (replace-regexp-in-string " " "~" expected)
|
||||
(replace-regexp-in-string " " "~" (read-preview-buffer)))))
|
||||
|
||||
(defun assert-preview (puml output &optional format)
|
||||
"Run PlantUML on the source PUML and asserts the result to be
|
||||
equal to OUTPUT. Can choose the output FORMAT (default: utxt)."
|
||||
(if format
|
||||
(setq plantuml-output-type format)
|
||||
(setq plantuml-output-type "utxt"))
|
||||
(plantuml-preview-string 42 (read-test-file puml))
|
||||
(plantuml-preview-string nil (read-test-file puml))
|
||||
(sleep-for 3)
|
||||
(should (equal (replace-regexp-in-string " " "~" (read-test-file output))
|
||||
(replace-regexp-in-string " " "~" (read-preview-buffer)))))
|
||||
(assert-preview-content (read-test-file output)))
|
||||
|
||||
(defmacro test-and-cleanup-preview (&rest forms)
|
||||
"Run the test described in FORMS and eventually cleanup the preview buffer."
|
||||
|
@ -37,6 +41,13 @@ equal to OUTPUT. Can choose the output FORMAT (default: utxt)."
|
|||
(setq-local plantuml-output-type "utxt")
|
||||
(assert-preview "unicode.puml" "unicode.txt")))
|
||||
|
||||
(ert-deftest preview-new-window()
|
||||
(test-and-cleanup-preview
|
||||
(save-window-excursion
|
||||
(open-test-file-in-buf "a-b.puml")
|
||||
(plantuml-preview nil)
|
||||
(sleep-for 3))))
|
||||
|
||||
(provide 'plantuml-mode-preview-test)
|
||||
|
||||
;;; plantuml-mode-preview-test.el ends here
|
||||
|
|
Loading…
Reference in New Issue