lisp/obsolete/*tls.el: Note when obsolescence was decided
[emacs.git] / test / lisp / faces-tests.el
blob3fad8bdcaaea004bc47d85b28f9cfa8dc41915d5
1 ;;; faces-tests.el --- Tests for faces.el -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
5 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
6 ;; Keywords:
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
21 ;;; Code:
23 (require 'ert)
24 (require 'faces)
26 (defgroup faces--test nil ""
27 :group 'faces--test)
29 (defface faces--test1
30 '((t :background "black" :foreground "black"))
32 :group 'faces--test)
34 (defface faces--test2
35 '((t :box 1))
37 :group 'faces--test)
39 (ert-deftest faces--test-color-at-point ()
40 (with-temp-buffer
41 (insert (propertize "STRING" 'face '(faces--test2 faces--test1)))
42 (goto-char (point-min))
43 (should (equal (background-color-at-point) "black"))
44 (should (equal (foreground-color-at-point) "black")))
45 (with-temp-buffer
46 (insert (propertize "STRING" 'face '(:foreground "black" :background "black")))
47 (goto-char (point-min))
48 (should (equal (background-color-at-point) "black"))
49 (should (equal (foreground-color-at-point) "black")))
50 (with-temp-buffer
51 (emacs-lisp-mode)
52 (setq-local font-lock-comment-face 'faces--test1)
53 (setq-local font-lock-constant-face 'faces--test2)
54 (insert ";; `symbol'")
55 (font-lock-fontify-region (point-min) (point-max))
56 (goto-char (point-min))
57 (should (equal (background-color-at-point) "black"))
58 (should (equal (foreground-color-at-point) "black"))
59 (goto-char 6)
60 (should (equal (background-color-at-point) "black"))
61 (should (equal (foreground-color-at-point) "black"))))
63 (provide 'faces-tests)
64 ;;; faces-tests.el ends here