diff options
| author | Dmitry Gutov | 2019-12-10 02:11:15 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2019-12-10 02:16:44 +0200 |
| commit | 58fb4c3e68a4a42ad491d0fa2c084e5c39942e2b (patch) | |
| tree | efe7a9e6a1b8f76cee65ecd59eb00d9d1e0d1838 /test | |
| parent | d8d537e17349c02d981eabd92c78f60f73354798 (diff) | |
| download | emacs-58fb4c3e68a4a42ad491d0fa2c084e5c39942e2b.tar.gz emacs-58fb4c3e68a4a42ad491d0fa2c084e5c39942e2b.zip | |
Make ':extend' inherited from default spec unless overridden
* lisp/faces.el (face-spec-recalc): Handle the :extend attribute
specially and always inherit it from the default spec unless
overwritten in a theme (bug#37774).
* test/lisp/faces-tests.el (faces--test-data-dir): New variable.
(faces--test-extend-with-themes): Use test themes instead of ones
from etc/themes. Update expected values.
* test/data/themes/faces-test-dark-theme.el: New file.
* test/data/themes/faces-test-light-theme.el: New file.
* doc/lispref/display.texi (Face Attributes):
Update the description of ':extend'.
* etc/NEWS: Update the entry for ':extend'.
* etc/themes/adwaita-theme.el:
* etc/themes/deeper-blue-theme.el:
* etc/themes/dichromacy-theme.el:
* etc/themes/leuven-theme.el:
* etc/themes/light-blue-theme.el:
* etc/themes/manoj-dark-theme.el:
* etc/themes/misterioso-theme.el:
* etc/themes/tango-dark-theme.el:
* etc/themes/tango-theme.el:
* etc/themes/tsdh-dark-theme.el:
* etc/themes/tsdh-light-theme.el:
* etc/themes/wheatgrass-theme.el:
* etc/themes/wombat-theme.el: Remove the now-redundant ':extend'
attribute in all the themes.
Diffstat (limited to 'test')
| -rw-r--r-- | test/data/themes/faces-test-dark-theme.el | 33 | ||||
| -rw-r--r-- | test/data/themes/faces-test-light-theme.el | 32 | ||||
| -rw-r--r-- | test/lisp/faces-tests.el | 29 |
3 files changed, 82 insertions, 12 deletions
diff --git a/test/data/themes/faces-test-dark-theme.el b/test/data/themes/faces-test-dark-theme.el new file mode 100644 index 00000000000..2c114069f9c --- /dev/null +++ b/test/data/themes/faces-test-dark-theme.el | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | ;;; faces-test-dark-theme.el --- A dark theme from tests ;;; -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2019 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This program is free software; you can redistribute it and/or modify | ||
| 6 | ;; it under the terms of the GNU General Public License as published by | ||
| 7 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 8 | ;; (at your option) any later version. | ||
| 9 | |||
| 10 | ;; This program is distributed in the hope that it will be useful, | ||
| 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | ;; GNU General Public License for more details. | ||
| 14 | |||
| 15 | ;; You should have received a copy of the GNU General Public License | ||
| 16 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 17 | |||
| 18 | ;;; Commentary: | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (deftheme faces-test-dark | ||
| 23 | "") | ||
| 24 | |||
| 25 | (custom-theme-set-faces | ||
| 26 | 'faces-test-dark | ||
| 27 | '(diff-added ((t (:foreground "Green" :extend t)))) | ||
| 28 | '(diff-changed-face ((t (:foreground "Khaki")))) | ||
| 29 | '(diff-file-header-face ((t (:background "grey20" :foreground "ivory1"))))) | ||
| 30 | |||
| 31 | (provide-theme 'faces-test-dark) | ||
| 32 | |||
| 33 | ;;; faces-test-dark-theme.el ends here | ||
diff --git a/test/data/themes/faces-test-light-theme.el b/test/data/themes/faces-test-light-theme.el new file mode 100644 index 00000000000..fc22d47cf8d --- /dev/null +++ b/test/data/themes/faces-test-light-theme.el | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | ;;; faces-test-light-theme.el --- A dark theme from tests ;;; -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2019 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This program is free software; you can redistribute it and/or modify | ||
| 6 | ;; it under the terms of the GNU General Public License as published by | ||
| 7 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 8 | ;; (at your option) any later version. | ||
| 9 | |||
| 10 | ;; This program is distributed in the hope that it will be useful, | ||
| 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | ;; GNU General Public License for more details. | ||
| 14 | |||
| 15 | ;; You should have received a copy of the GNU General Public License | ||
| 16 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 17 | |||
| 18 | ;;; Commentary: | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (deftheme faces-test-light | ||
| 23 | "") | ||
| 24 | |||
| 25 | (custom-theme-set-faces | ||
| 26 | 'faces-test-light | ||
| 27 | '(diff-added ((t (:inherit diff-changed :background "light green" :extend t)))) | ||
| 28 | '(diff-changed ((t (:background "light steel blue"))))) | ||
| 29 | |||
| 30 | (provide-theme 'faces-test-light) | ||
| 31 | |||
| 32 | ;;; faces-test-light-theme.el ends here | ||
diff --git a/test/lisp/faces-tests.el b/test/lisp/faces-tests.el index 7cba4b26ebe..eb8c533b8e6 100644 --- a/test/lisp/faces-tests.el +++ b/test/lisp/faces-tests.el | |||
| @@ -23,6 +23,11 @@ | |||
| 23 | (require 'ert) | 23 | (require 'ert) |
| 24 | (require 'faces) | 24 | (require 'faces) |
| 25 | 25 | ||
| 26 | (defvar faces--test-data-dir | ||
| 27 | (expand-file-name "../data/" | ||
| 28 | (file-name-directory (or load-file-name | ||
| 29 | buffer-file-name)))) | ||
| 30 | |||
| 26 | (defgroup faces--test nil "" | 31 | (defgroup faces--test nil "" |
| 27 | :group 'faces--test) | 32 | :group 'faces--test) |
| 28 | 33 | ||
| @@ -117,8 +122,9 @@ | |||
| 117 | (should (equal (face-attribute 'diff-changed-face :extend) t)) | 122 | (should (equal (face-attribute 'diff-changed-face :extend) t)) |
| 118 | (should (equal (face-attribute 'diff-added :extend) 'unspecified)) | 123 | (should (equal (face-attribute 'diff-added :extend) 'unspecified)) |
| 119 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) | 124 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) |
| 120 | (load-theme 'manoj-dark t t) | 125 | (add-to-list 'custom-theme-load-path (concat faces--test-data-dir "themes")) |
| 121 | (load-theme 'tsdh-light t t) | 126 | (load-theme 'faces-test-dark t t) |
| 127 | (load-theme 'faces-test-light t t) | ||
| 122 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) | 128 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) |
| 123 | 'unspecified)) | 129 | 'unspecified)) |
| 124 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) | 130 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) |
| @@ -129,7 +135,7 @@ | |||
| 129 | (should (equal (face-attribute 'diff-changed-face :extend) t)) | 135 | (should (equal (face-attribute 'diff-changed-face :extend) t)) |
| 130 | (should (equal (face-attribute 'diff-added :extend) 'unspecified)) | 136 | (should (equal (face-attribute 'diff-added :extend) 'unspecified)) |
| 131 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) | 137 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) |
| 132 | (enable-theme 'manoj-dark) | 138 | (enable-theme 'faces-test-dark) |
| 133 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) | 139 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) |
| 134 | 'unspecified)) | 140 | 'unspecified)) |
| 135 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) | 141 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) |
| @@ -137,14 +143,14 @@ | |||
| 137 | 'unspecified)) | 143 | 'unspecified)) |
| 138 | (should (equal (face-attribute 'faces--test-inherit-no-extend :extend nil t) | 144 | (should (equal (face-attribute 'faces--test-inherit-no-extend :extend nil t) |
| 139 | nil)) | 145 | nil)) |
| 140 | (should (equal (face-attribute 'diff-changed-face :extend) 'unspecified)) ; should be t | 146 | (should (equal (face-attribute 'diff-changed-face :extend) t)) |
| 141 | (should (equal (face-attribute 'diff-added :extend) t)) | 147 | (should (equal (face-attribute 'diff-added :extend) t)) |
| 142 | (should (equal (face-attribute 'diff-file-header-face :extend) 'unspecified)) ; should be nil | 148 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) |
| 143 | (defface faces--test-face3 | 149 | (defface faces--test-face3 |
| 144 | '((t :inherit diff-added :weight bold)) | 150 | '((t :inherit diff-added :weight bold)) |
| 145 | "") | 151 | "") |
| 146 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) | 152 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) |
| 147 | (disable-theme 'manoj-dark) | 153 | (disable-theme 'faces-test-dark) |
| 148 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) | 154 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) |
| 149 | 'unspecified)) | 155 | 'unspecified)) |
| 150 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) | 156 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) |
| @@ -159,7 +165,7 @@ | |||
| 159 | (defface diff-indicator-changed | 165 | (defface diff-indicator-changed |
| 160 | '((t (:weight bold :extend t))) | 166 | '((t (:weight bold :extend t))) |
| 161 | "") | 167 | "") |
| 162 | (enable-theme 'tsdh-light) | 168 | (enable-theme 'faces-test-light) |
| 163 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) | 169 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) |
| 164 | 'unspecified)) | 170 | 'unspecified)) |
| 165 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) | 171 | (should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t)) |
| @@ -170,7 +176,7 @@ | |||
| 170 | (should (equal (face-attribute 'diff-changed-face :extend) t)) | 176 | (should (equal (face-attribute 'diff-changed-face :extend) t)) |
| 171 | (should (equal (face-attribute 'diff-added :extend) t)) | 177 | (should (equal (face-attribute 'diff-added :extend) t)) |
| 172 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) | 178 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) |
| 173 | (should (equal (face-attribute 'diff-indicator-changed :extend) 'unspecified)) ; should be t | 179 | (should (equal (face-attribute 'diff-indicator-changed :extend) t)) |
| 174 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) | 180 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) |
| 175 | (frame-set-background-mode (selected-frame) 'dark) | 181 | (frame-set-background-mode (selected-frame) 'dark) |
| 176 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) | 182 | (should (equal (face-attribute 'faces--test-inherit-extend :extend) |
| @@ -183,7 +189,7 @@ | |||
| 183 | (should (equal (face-attribute 'diff-changed-face :extend) t)) | 189 | (should (equal (face-attribute 'diff-changed-face :extend) t)) |
| 184 | (should (equal (face-attribute 'diff-added :extend) t)) | 190 | (should (equal (face-attribute 'diff-added :extend) t)) |
| 185 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) | 191 | (should (equal (face-attribute 'diff-file-header-face :extend) nil)) |
| 186 | (should (equal (face-attribute 'diff-indicator-changed :extend) 'unspecified)) ; should be t | 192 | (should (equal (face-attribute 'diff-indicator-changed :extend) t)) |
| 187 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) | 193 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) |
| 188 | (or noninteractive | 194 | (or noninteractive |
| 189 | (let ((fr (make-frame))) | 195 | (let ((fr (make-frame))) |
| @@ -200,11 +206,10 @@ | |||
| 200 | (should (equal (face-attribute 'diff-changed-face :extend fr) t)) | 206 | (should (equal (face-attribute 'diff-changed-face :extend fr) t)) |
| 201 | (should (equal (face-attribute 'diff-added :extend fr) t)) | 207 | (should (equal (face-attribute 'diff-added :extend fr) t)) |
| 202 | (should (equal (face-attribute 'diff-file-header-face :extend fr) nil)) | 208 | (should (equal (face-attribute 'diff-file-header-face :extend fr) nil)) |
| 203 | (should (equal (face-attribute 'diff-indicator-changed :extend fr) | 209 | (should (equal (face-attribute 'diff-indicator-changed :extend fr) t)) |
| 204 | 'unspecified)) ; should be t | ||
| 205 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) | 210 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) t)) |
| 206 | )) | 211 | )) |
| 207 | (disable-theme 'tsdh-light) | 212 | (disable-theme 'faces-test-light) |
| 208 | (should (equal (face-attribute 'diff-indicator-changed :extend) t)) | 213 | (should (equal (face-attribute 'diff-indicator-changed :extend) t)) |
| 209 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) 'unspecified)) | 214 | (should (equal (face-attribute 'faces--test-face3 :extend nil t) 'unspecified)) |
| 210 | (or noninteractive | 215 | (or noninteractive |