aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Malabarba2015-10-30 18:15:21 +0000
committerArtur Malabarba2015-10-30 18:15:52 +0000
commit76033d22a298f58bd8feed90dce035de3be86503 (patch)
treedd5479cd7de55287c68619f9bbdc779e9e06eac0
parent7ccedcb486ee4e37da54dd82a8557c80616d9467 (diff)
downloademacs-76033d22a298f58bd8feed90dce035de3be86503.tar.gz
emacs-76033d22a298f58bd8feed90dce035de3be86503.zip
* test/automated/faces-tests.el: New file
-rw-r--r--test/automated/faces-tests.el51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/automated/faces-tests.el b/test/automated/faces-tests.el
new file mode 100644
index 00000000000..4029003e38a
--- /dev/null
+++ b/test/automated/faces-tests.el
@@ -0,0 +1,51 @@
1;;; faces-tests.el --- Tests for faces.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
4
5;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
6;; Keywords:
7
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.
12
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.
17
18;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21;;; Code:
22
23(require 'ert)
24(require 'faces)
25
26(defface faces--test1
27 '((t :background "black" :foreground "black"))
28 "")
29
30(defface faces--test2
31 '((t :box 1))
32 "")
33
34(ert-deftest faces--test-color-at-point ()
35 (with-temp-buffer
36 (insert (propertize "STRING" 'face '(faces--test2 faces--test1)))
37 (goto-char (point-min))
38 (should (equal (background-color-at-point) "black"))
39 (should (equal (foreground-color-at-point) "black")))
40 (with-temp-buffer
41 (emacs-lisp-mode)
42 (setq-local font-lock-comment-face 'faces--test1)
43 (setq-local font-lock-constant-face 'faces--test2)
44 (insert ";; `symbol'")
45 (font-lock-fontify-region (point-min) (point-max))
46 (goto-char 6)
47 (should (equal (background-color-at-point) "black"))
48 (should (equal (foreground-color-at-point) "black"))))
49
50(provide 'faces-tests)
51;;; faces-tests.el ends here