diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-11 12:13:43 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-11 12:13:43 -0500 |
| commit | a21ba82e6a5375b6cf1afca640f64b9841fca246 (patch) | |
| tree | 7b81c05f59761b51cd3bbbf3fd5767d6807f7526 /tests/test-font-config.el | |
| parent | 188aeae770af966c7a64d8185434373592123ede (diff) | |
| download | dotemacs-a21ba82e6a5375b6cf1afca640f64b9841fca246.tar.gz dotemacs-a21ba82e6a5375b6cf1afca640f64b9841fca246.zip | |
fix(font-config): daemon emoji images and a re-runnable font list
emojify-display-style was computed once from env-gui-p inside the :defer'd :config block. In a daemon that block runs before any GUI frame exists, so the style latched to unicode and GUI frames never got image emoji. Recompute it per-frame from server-after-make-frame-hook, mirroring the emoji-fontset setup above.
cj/display-available-fonts called special-mode at the end, leaving the buffer read-only, so the second invocation errored on erase-buffer. Rewrite it under inhibit-read-only.
Diffstat (limited to 'tests/test-font-config.el')
| -rw-r--r-- | tests/test-font-config.el | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test-font-config.el b/tests/test-font-config.el index 393a7758..4df2b41a 100644 --- a/tests/test-font-config.el +++ b/tests/test-font-config.el @@ -93,5 +93,47 @@ ((symbol-function 'set-fontset-font) (lambda (&rest _) t))) (should (progn (cj/setup-emoji-fontset) t)))) +;;; cj/set-emojify-display-style + +(defvar emojify-display-style) + +(ert-deftest test-font-config-emojify-display-style-image-on-gui () + "Normal: on a GUI frame the emoji display style is `image'." + (skip-unless test-font-config--available) + (require 'font-config) + (let ((emojify-display-style nil)) + (cl-letf (((symbol-function 'env-gui-p) (lambda (&rest _) t))) + (cj/set-emojify-display-style) + (should (eq emojify-display-style 'image))))) + +(ert-deftest test-font-config-emojify-display-style-unicode-without-gui () + "Boundary: without a GUI the emoji display style is `unicode'." + (skip-unless test-font-config--available) + (require 'font-config) + (let ((emojify-display-style nil)) + (cl-letf (((symbol-function 'env-gui-p) (lambda (&rest _) nil))) + (cj/set-emojify-display-style) + (should (eq emojify-display-style 'unicode))))) + +;;; cj/display-available-fonts + +(ert-deftest test-font-config-display-available-fonts-second-call-no-error () + "Error: a second invocation does not signal on the read-only buffer." + (skip-unless test-font-config--available) + (require 'font-config) + (cl-letf (((symbol-function 'font-family-list) + (lambda (&rest _) '("Fixture Font A" "Fixture Font B")))) + (unwind-protect + (progn + (cj/display-available-fonts) + ;; The first call ends in `special-mode' (read-only); the second must + ;; not signal when it erases and rewrites the buffer. + (cj/display-available-fonts) + (with-current-buffer "*Available Fonts*" + (should (> (buffer-size) 0)) + (should buffer-read-only))) + (when (get-buffer "*Available Fonts*") + (kill-buffer "*Available Fonts*"))))) + (provide 'test-font-config) ;;; test-font-config.el ends here |
