]> git.eshelyaron.com Git - emacs.git/commitdiff
Add XLFD font parsing tests
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 12 Aug 2021 12:18:08 +0000 (14:18 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 12 Aug 2021 12:18:08 +0000 (14:18 +0200)
* test/src/font-tests.el (font-parse-xlfd-test): Add some tests
for XLFD testing (bug#35816).

test/src/font-tests.el

index de153b8de9bce8ec134899c754450a32be83e406..ea57b122f4f0078fff99d89ae31239090881a318 100644 (file)
@@ -159,6 +159,31 @@ expected font properties from parsing NAME.")
        (insert "\n"))))
   (goto-char (point-min)))
 
+(ert-deftest font-parse-xlfd-test ()
+  ;; Normal number of segments.
+  (should (equal (font-get
+                  (font-spec :name "-GNU -FreeSans-semibold-italic-normal-*-*-*-*-*-*-0-iso10646-1")
+                  :family)
+                 'FreeSans))
+  (should (equal (font-get
+                  (font-spec :name "-GNU -FreeSans-semibold-italic-normal-*-*-*-*-*-*-0-iso10646-1")
+                  :foundry)
+                 'GNU\ ))
+  ;; Dash in the family name.
+  (should (equal (font-get
+                  (font-spec :name "-Take-mikachan-PS-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1")
+                  :family)
+                 'mikachan-PS))
+  (should (equal (font-get
+                  (font-spec :name "-Take-mikachan-PS-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1")
+                  :weight)
+                 'normal))
+  ;; Synthetic test.
+  (should (equal (font-get
+                  (font-spec :name "-foundry-name-with-lots-of-dashes-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1")
+                  :family)
+                 'name-with-lots-of-dashes)))
+
 ;; Local Variables:
 ;; no-byte-compile: t
 ;; End: