From 7b8a38e05383166a088d59cb45d6569d0c4c022d Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sun, 22 Mar 2026 21:56:23 -0700 Subject: [PATCH] Add tests for erc-track-faces-normal-list regression * test/lisp/erc/erc-track-tests.el (erc-track-tests--modified-channels/baseline): Update assertion to expect an unchanged mode line segment if `erc-track-faces-normal-list' lacks a ranked face in the latest inserted message. (erc-track-modified-channels/baseline/nonotice) (erc-track-modified-channels/priority-only-all/baseline/nonotice): New tests. (Bug#80659) --- test/lisp/erc/erc-track-tests.el | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el index da4a4d0fad7..cce28360eff 100644 --- a/test/lisp/erc/erc-track-tests.el +++ b/test/lisp/erc/erc-track-tests.el @@ -478,12 +478,28 @@ (funcall set-faces '(erc-notice-face)) (erc-track-modified-channels) (should (equal (alist-get (current-buffer) erc-modified-channels-alist) - '(5 . erc-notice-face)))) + (if (gethash 'erc-notice-face erc-track--normal-faces) + '(5 . erc-notice-face) + '(5 erc-button-nick-default-face erc-nick-default-face))))) (ert-deftest erc-track-modified-channels/baseline () (erc-tests-common-track-modified-channels #'erc-track-tests--modified-channels/baseline)) +;; This "baseline" variant simulates `erc-notice-face' being absent from +;; `erc-track-faces-normal-list' by removing it from the cached local +;; copy in `erc-track--normal-faces'. When absent and a message +;; highlighted in `erc-notice-face' is inserted, the mode line should +;; not change if it's currently showing a face ranked higher in +;; `erc-track-faces-priority-list'. ERC 5.6 and 5.6.1 featured a +;; regression that caused the mode line to keep alternating regardless. +;; See Bug#80659: erc: Faces not being updated correctly. +(ert-deftest erc-track-modified-channels/baseline/nonotice () + (erc-tests-common-track-modified-channels + (lambda (set-faces) + (remhash 'erc-notice-face erc-track--normal-faces) + (funcall #'erc-track-tests--modified-channels/baseline set-faces)))) + (ert-deftest erc-track-modified-channels/baseline/mention () (erc-tests-common-track-modified-channels (lambda (set-faces) @@ -613,6 +629,15 @@ (erc-tests-common-track-modified-channels #'erc-track-tests--modified-channels/baseline))) +;; Option `erc-track-priority-faces-only' does not affect Bug#80659 (see +;; baseline test without the option above). +(ert-deftest erc-track-modified-channels/priority-only-all/baseline/nonotice () + (let ((erc-track-priority-faces-only 'all)) + (erc-tests-common-track-modified-channels + (lambda (set-faces) + (remhash 'erc-notice-face erc-track--normal-faces) + (funcall #'erc-track-tests--modified-channels/baseline set-faces))))) + ;; This test simulates a common configuration that combines an ;; `erc-track-faces-priority-list' removed of `erc-notice-face' with ;; `erc-track-priority-faces-only' being `all'. It also features in the