diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-04-27 17:08:55 -0700 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@google.com> | 2015-04-27 17:12:58 -0700 |
commit | 3153a554bf3686d51043b5c2631b1d1a8bcdc540 (patch) | |
tree | 87ae983259457e11d8c9b11037f8d65c4065f5da /scripts | |
parent | c0fd8ad77c8203d0e3baaf71b77ae1da6ed3f80e (diff) | |
parent | 635a03a9cf5e7f61012732b1d93d01e0caa9f719 (diff) |
Manually merge pull request #28 from google/smcp.
Add tests and requirements for the 'smcp' feature.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/common_tests.py | 27 | ||||
-rwxr-xr-x | scripts/run_general_tests.py | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/scripts/common_tests.py b/scripts/common_tests.py index 1b015b8..531737c 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_list = [] + 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() |