aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-28 06:52:52 -0400
committerCraig Jennings <c@cjennings.net>2026-06-28 06:52:52 -0400
commit95a5e130deb4c73242c370ce239b3ba9a97e6ef5 (patch)
tree913b69c28420fdde6790218770afeebf5be48961 /tests
parentbcdb5889bc7f38ce1e87c495b6f186b62e45467a (diff)
downloademacs-wttrin-95a5e130deb4c73242c370ce239b3ba9a97e6ef5.tar.gz
emacs-wttrin-95a5e130deb4c73242c370ce239b3ba9a97e6ef5.zip
test: cover wttrin--reset-font-height
Restores the base height when a remap cookie exists, no-op without one.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-wttrin--reset-font-height.el35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-wttrin--reset-font-height.el b/tests/test-wttrin--reset-font-height.el
new file mode 100644
index 0000000..66ca754
--- /dev/null
+++ b/tests/test-wttrin--reset-font-height.el
@@ -0,0 +1,35 @@
+;;; test-wttrin--reset-font-height.el --- Tests for the base-font reset -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2024-2026 Craig Jennings
+
+;;; Commentary:
+;; wttrin--reset-font-height re-applies the base wttrin-font-height, used for the
+;; loading placeholder so it does not keep the previous weather's auto-fitted
+;; (possibly capped) size.
+
+;;; Code:
+
+(require 'ert)
+(require 'wttrin)
+(require 'testutil-wttrin)
+
+(ert-deftest test-wttrin--reset-font-height-normal-restores-base ()
+ "Normal: resetting restores the applied height to the base wttrin-font-height."
+ (with-temp-buffer
+ (setq-local wttrin--face-remap-cookie
+ (face-remap-add-relative 'default :height 200))
+ (setq-local wttrin--current-font-height 200)
+ (let ((wttrin-font-height 130))
+ (wttrin--reset-font-height)
+ (should (= 130 wttrin--current-font-height)))))
+
+(ert-deftest test-wttrin--reset-font-height-boundary-no-cookie-is-noop ()
+ "Boundary: with no remap cookie, reset is a no-op and does not signal."
+ (with-temp-buffer
+ (setq-local wttrin--face-remap-cookie nil)
+ (setq-local wttrin--current-font-height 200)
+ (wttrin--reset-font-height)
+ (should (= 200 wttrin--current-font-height))))
+
+(provide 'test-wttrin--reset-font-height)
+;;; test-wttrin--reset-font-height.el ends here