summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRoozbeh Pournader <roozbeh@google.com>2015-04-27 14:56:09 -0700
committerRoozbeh Pournader <roozbeh@google.com>2015-04-27 14:56:09 -0700
commitdbf05262b14e4eb956cb65dfa2566fbf5703f1f6 (patch)
tree3e9b141a0caf4d0461d2a21f6e7802633bb8f7be /scripts
parent8faeb294ae6ae7cc3f4a90915d3660830c76ecef (diff)
Add tests and requirements for the 'smcp' feature.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/common_tests.py27
-rwxr-xr-xscripts/run_general_tests.py4
2 files changed, 31 insertions, 0 deletions
diff --git a/scripts/common_tests.py b/scripts/common_tests.py
index 1b015b8..c0ba55a 100644
--- a/scripts/common_tests.py
+++ b/scripts/common_tests.py
@@ -255,6 +255,33 @@ class TestLigatures(FontTest):
self.assertTrue(len(normal) == 2 and len(ligated) == 1)
+class TestFeatures(FontTest):
+ """Tests typographic features."""
+
+ def setUp(self):
+ self.fontfiles, _ = self.loaded_fonts
+
+ def test_smcp_coverage(self):
+ """Tests that smcp is supported for our required set."""
+ with open('res/smcp_requirements.txt') as smcp_reqs_file:
+ smcp_reqs_lis = []
+ for line in smcp_reqs_file.readlines():
+ line = line[:line.index(' #')]
+ smcp_reqs_list.append(unichr(int(line, 16)))
+
+ for fontfile in self.fontfiles:
+ chars_with_no_smcp = []
+ for char in smcp_reqs_list:
+ normal = layout.get_glyphs(char, fontfile)
+ smcp = layout.get_glyphs(char, fontfile, '--features=smcp')
+ if normal == smcp:
+ chars_with_no_smcp.append(char)
+ self.assertEqual(
+ chars_with_no_smcp, [],
+ ("smcp feature is not applied to '%s'" %
+ u''.join(chars_with_no_smcp).encode('UTF-8')))
+
+
class TestVerticalMetrics(FontTest):
"""Test the vertical metrics of fonts."""
diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py
index 5dd4dc8..1a9e965 100755
--- a/scripts/run_general_tests.py
+++ b/scripts/run_general_tests.py
@@ -46,6 +46,10 @@ class TestLigatures(common_tests.TestLigatures):
loaded_fonts = FONTS
+class TestFeatures(common_tests.TestFeatures):
+ loaded_fonts = FONTS
+
+
if __name__ == '__main__':
unittest.main()