
* doc/emacs/custom.texi (Specific Customization): Mention it. * doc/emacs/display.texi (Icons): New node. * doc/lispref/display.texi (Icons): New node. * lisp/button.el (buttonize): (button--properties, buttonize-region): Allow not overriding faces. * lisp/cus-edit.el (custom-save-all): Save icons. (custom-icon): New widget. (custom-icon-value-create, custom-toggle-hide-icon) (custom--icons-widget-value, custom-icon-set): Helper functions for the widget. (customize-icon): Main command. (custom-icon-state-set, custom-icon-state): Helper functions. (custom-theme-set-icons): Function to be used by theme writers. (custom-set-icons): Function to be used in .emacs. (custom-save-icons): New function. * lisp/custom.el (custom-push-theme): Add icons. * lisp/emacs-lisp/icons.el: New file. * test/lisp/emacs-lisp/icons-tests.el: Add some tests.
63 lines
1.9 KiB
EmacsLisp
63 lines
1.9 KiB
EmacsLisp
;;; icons-tests.el --- Tests for icons.el -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (C) 2022 Free Software Foundation, Inc.
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
|
|
|
;;; Code:
|
|
|
|
(require 'icons)
|
|
(require 'ert)
|
|
(require 'ert-x)
|
|
(require 'cus-edit)
|
|
|
|
(define-icon icon-test1 nil
|
|
'((symbol ">")
|
|
(text "great"))
|
|
"Test icon"
|
|
:version "29.1")
|
|
|
|
(define-icon icon-test2 icon-test1
|
|
'((text "child"))
|
|
"Test icon"
|
|
:version "29.1")
|
|
|
|
(deftheme test-icons-theme "")
|
|
|
|
(ert-deftest test-icon-theme ()
|
|
(let ((icon-preference '(image emoji symbol text)))
|
|
(should (equal (icon-string 'icon-test1) ">")))
|
|
(let ((icon-preference '(text)))
|
|
(should (equal (icon-string 'icon-test1) "great")))
|
|
(custom-theme-set-icons
|
|
'test-icons-theme
|
|
'(icon-test1 ((symbol "<") (text "less"))))
|
|
(let ((icon-preference '(image emoji symbol text)))
|
|
(should (equal (icon-string 'icon-test1) ">"))
|
|
(enable-theme 'test-icons-theme)
|
|
(should (equal (icon-string 'icon-test1) "<"))))
|
|
|
|
(ert-deftest test-icon-inheretance ()
|
|
(let ((icon-preference '(image emoji symbol text)))
|
|
(should (equal (icon-string 'icon-test2) ">")))
|
|
(let ((icon-preference '(text)))
|
|
(should (equal (icon-string 'icon-test2) "child"))))
|
|
|
|
;;; icons-tests.el ends here
|