Mercurial > hg > xemacs-beta
comparison tests/automated/face-tests.el @ 5763:23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Add fc-name-parse-harder, which retries without unparseable attributes.
Add tests for fc-name-parse and fc-name-parse-harder.
A few fixups in comments and docstrings.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Sun, 15 Sep 2013 23:50:20 +0900 |
parents | |
children | f22989bb7632 |
comparison
equal
deleted
inserted
replaced
5762:427a72c6ee17 | 5763:23dc211f4d2f |
---|---|
1 ;;; face-tests.el --- test text display (faces, fonts) -*- coding: utf-8 -*- | |
2 | |
3 ;; Copyright (C) 2013 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Stephen J. Turnbull <stephen@xemacs.org> | |
6 ;; Created: 2013 | |
7 ;; Keywords: tests | |
8 | |
9 ;; This file is part of XEmacs. | |
10 | |
11 ;; XEmacs is free software: you can redistribute it and/or modify it | |
12 ;; under the terms of the GNU General Public License as published by the | |
13 ;; Free Software Foundation, either version 3 of the License, or (at your | |
14 ;; option) any later version. | |
15 | |
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
19 ;; for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. | |
23 | |
24 ;;; Synched up with: Not in FSF. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; Test text display (faces, fonts) | |
29 | |
30 ;; Test fontconfig | |
31 | |
32 (let* ((test-name-parts | |
33 '("Bitstream Vera Sans Mono-16" | |
34 "familylang=en" | |
35 "style=Roman" | |
36 "stylelang=en" | |
37 "fullname=Bitstream Vera Sans Mono" | |
38 "fullnamelang=en" | |
39 "slant=0" | |
40 "weight=80" | |
41 "width=100" | |
42 "pixelsize=21.3174" | |
43 "spacing=100" | |
44 "foundry=bitstream" | |
45 "antialias=True" | |
46 "hintstyle=3" | |
47 "hinting=True" | |
48 "verticallayout=False" | |
49 "autohint=False" | |
50 "globaladvance=True" | |
51 "file=/usr/X11/lib/X11/fonts/TTF/VeraMono.ttf" | |
52 "index=0" | |
53 "outline=True" | |
54 "scalable=True" | |
55 "dpi=95.9282" | |
56 "rgba=0" | |
57 "scale=1" | |
58 "minspace=False" | |
59 "charset= |>^1!|>^1!P0oWQ |>^1!|>^1!|>^1!!!!%#gfN8.!!B7%ggR6OF3y?4!!K?& !!!)$ 9;*f! !!!.% !!!)$!!!!# !!#0GM>RAd#y#fx !!!W5 !!#3H !!!!& !!#6I<UKaX!!!?+!!!%#!!!!X !!#AL !!!1& !!+u{!!!!) " | |
60 "lang=aa|ay|bi|br|ch|co|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|nso|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|tn|tr|ts|uz|vo|vot|wa|xh|yap|zu|an|crh|fil|ht|jv|kj|ku-tr|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za" | |
61 "fontversion=131072" | |
62 "fontformat=TrueType" | |
63 "embolden=False" | |
64 "embeddedbitmap=True" | |
65 "decorative=False" | |
66 "lcdfilter=1" | |
67 "namelang=en" | |
68 "prgname=xemacs" | |
69 "hash=sha256\\:da4281dc7db17a3dfce64a62ced92875c5895340055ec8ba24a3914eb97b349d" | |
70 "postscriptname=BitstreamVeraSansMono-Roman")) | |
71 (test-name-degenerate "") | |
72 (test-name-trivial (nth 0 test-name-parts)) | |
73 (test-name-short | |
74 (concat (nth 0 test-name-parts) ":" (nth 26 test-name-parts))) | |
75 (test-name-long (mapconcat #'identity | |
76 (append (subseq test-name-parts 0 26) | |
77 (subseq test-name-parts 27)) | |
78 ":")) | |
79 (test-name-full (mapconcat #'identity test-name-parts ":")) | |
80 ) | |
81 (labels ((try (fontname) | |
82 (fc-name-unparse (fc-name-parse fontname))) | |
83 (try-harder (fontname) | |
84 (fc-name-unparse (fc-name-parse-harder fontname)))) | |
85 (Assert (string= test-name-degenerate (try test-name-degenerate))) | |
86 (Assert (string= test-name-degenerate (try-harder test-name-degenerate))) | |
87 (Assert (string= test-name-trivial (try test-name-trivial))) | |
88 (Assert (string= test-name-trivial (try-harder test-name-trivial))) | |
89 ;; Note when the `try' form fails, the `try-harder' form returns a | |
90 ;; shorter name. | |
91 (Check-Error 'invalid-argument | |
92 (string= test-name-short (try test-name-short))) | |
93 (Assert (string= test-name-trivial (try-harder test-name-short))) | |
94 (Assert (string= test-name-long (try test-name-long))) | |
95 (Assert (string= test-name-long (try-harder test-name-long))) | |
96 ;; Note when the `try' form fails, the `try-harder' form returns a | |
97 ;; shorter name. | |
98 (Check-Error 'invalid-argument | |
99 (string= test-name-full (try test-name-full))) | |
100 (Assert (string= test-name-long (try-harder test-name-full))) | |
101 ) ; labels | |
102 ) ; let | |
103 | |
104 ;;; end face-tests.el |