aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/music-config.el15
-rw-r--r--tests/test-music-config--faces.el25
2 files changed, 40 insertions, 0 deletions
diff --git a/modules/music-config.el b/modules/music-config.el
index 86f6eb130..c627d799a 100644
--- a/modules/music-config.el
+++ b/modules/music-config.el
@@ -41,6 +41,21 @@
(defvar emms-playlist-mode-map)
(defvar dirvish-mode-map)
+;; Playlist-header faces. Defined here so the `cj/music--header-text'
+;; references are valid (an undefined face spams "Invalid face reference" on
+;; every render). Appearance inherits themed base faces so the active theme
+;; owns the colors -- the literal values were dropped in the route-colors pass.
+(defface cj/music-header-face '((t :inherit shadow))
+ "Playlist-header field labels (Playlist, Current, Mode, Keys).")
+(defface cj/music-header-value-face '((t :inherit default))
+ "Playlist-header field values.")
+(defface cj/music-mode-on-face '((t :inherit warning))
+ "Active mode indicator in the playlist header.")
+(defface cj/music-mode-off-face '((t :inherit shadow))
+ "Inactive mode indicator in the playlist header.")
+(defface cj/music-keyhint-face '((t :inherit shadow))
+ "Key hints in the playlist header.")
+
;; Foreign functions used lazily after their packages load.
(declare-function emms-playlist-mode "emms-playlist-mode")
(declare-function emms-playlist-track-at "emms-playlist-mode")
diff --git a/tests/test-music-config--faces.el b/tests/test-music-config--faces.el
new file mode 100644
index 000000000..c45049e1a
--- /dev/null
+++ b/tests/test-music-config--faces.el
@@ -0,0 +1,25 @@
+;;; test-music-config--faces.el --- music playlist face definitions -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; The playlist header propertizes text with cj/music-* faces. Each must be a
+;; defined face (defface) or the reference is invalid -- an undefined face spams
+;; "Invalid face reference" on every header render. The faces inherit from
+;; themed base faces so the theme still owns their colors.
+
+;;; Code:
+
+(require 'ert)
+(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
+(require 'music-config)
+
+(ert-deftest test-music-config-header-faces-are-defined ()
+ "Normal: every cj/music face the playlist header uses is a defined face."
+ (dolist (f '(cj/music-header-face
+ cj/music-header-value-face
+ cj/music-mode-on-face
+ cj/music-mode-off-face
+ cj/music-keyhint-face))
+ (should (facep f))))
+
+(provide 'test-music-config--faces)
+;;; test-music-config--faces.el ends here