From 95a5e130deb4c73242c370ce239b3ba9a97e6ef5 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 28 Jun 2026 06:52:52 -0400 Subject: test: cover wttrin--reset-font-height Restores the base height when a remap cookie exists, no-op without one. --- tests/test-wttrin--reset-font-height.el | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/test-wttrin--reset-font-height.el (limited to 'tests') 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 -- cgit v1.2.3