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)))
|
(let ((b (get-buffer plantuml-preview-buffer)))
|
||||||
(when b
|
(when b
|
||||||
(with-current-buffer b
|
(with-current-buffer b
|
||||||
(setq buffer-read-only nil)
|
(setq buffer-read-only nil)
|
||||||
(erase-buffer))))
|
(erase-buffer))))
|
||||||
|
|
||||||
(let* ((imagep (and (display-images-p)
|
(let* ((imagep (and (display-images-p)
|
||||||
(plantuml-is-image-output-p)))
|
(plantuml-is-image-output-p)))
|
||||||
|
@ -264,13 +264,13 @@ to choose where to display it:
|
||||||
(lambda (_ps event)
|
(lambda (_ps event)
|
||||||
(unless (equal event "finished\n")
|
(unless (equal event "finished\n")
|
||||||
(error "PLANTUML Preview failed: %s" event))
|
(error "PLANTUML Preview failed: %s" event))
|
||||||
|
(if (numberp prefix)
|
||||||
(cond
|
(cond
|
||||||
((= prefix 16)
|
((= prefix 16)
|
||||||
(switch-to-buffer-other-frame plantuml-preview-buffer))
|
(switch-to-buffer-other-frame plantuml-preview-buffer))
|
||||||
((= prefix 4)
|
((= prefix 4)
|
||||||
(switch-to-buffer plantuml-preview-buffer))
|
(switch-to-buffer plantuml-preview-buffer)))
|
||||||
(t (switch-to-buffer-other-window plantuml-preview-buffer)))
|
(switch-to-buffer-other-window plantuml-preview-buffer))
|
||||||
(when imagep
|
(when imagep
|
||||||
(image-mode)
|
(image-mode)
|
||||||
(set-buffer-multibyte t)))))))
|
(set-buffer-multibyte t)))))))
|
||||||
|
|
|
@ -8,16 +8,20 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; 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)
|
(defun assert-preview (puml output &optional format)
|
||||||
"Run PlantUML on the source PUML and asserts the result to be
|
"Run PlantUML on the source PUML and asserts the result to be
|
||||||
equal to OUTPUT. Can choose the output FORMAT (default: utxt)."
|
equal to OUTPUT. Can choose the output FORMAT (default: utxt)."
|
||||||
(if format
|
(if format
|
||||||
(setq plantuml-output-type format)
|
(setq plantuml-output-type format)
|
||||||
(setq plantuml-output-type "utxt"))
|
(setq plantuml-output-type "utxt"))
|
||||||
(plantuml-preview-string 42 (read-test-file puml))
|
(plantuml-preview-string nil (read-test-file puml))
|
||||||
(sleep-for 3)
|
(sleep-for 3)
|
||||||
(should (equal (replace-regexp-in-string " " "~" (read-test-file output))
|
(assert-preview-content (read-test-file output)))
|
||||||
(replace-regexp-in-string " " "~" (read-preview-buffer)))))
|
|
||||||
|
|
||||||
(defmacro test-and-cleanup-preview (&rest forms)
|
(defmacro test-and-cleanup-preview (&rest forms)
|
||||||
"Run the test described in FORMS and eventually cleanup the preview buffer."
|
"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")
|
(setq-local plantuml-output-type "utxt")
|
||||||
(assert-preview "unicode.puml" "unicode.txt")))
|
(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)
|
(provide 'plantuml-mode-preview-test)
|
||||||
|
|
||||||
;;; plantuml-mode-preview-test.el ends here
|
;;; plantuml-mode-preview-test.el ends here
|
||||||
|
|
Loading…
Reference in New Issue