diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2014-09-13 20:01:09 -0700 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk@google.com> | 2015-04-16 12:16:22 -0700 |
commit | 00d4b9c3fcc0317792803aebbeaa0207292a38d8 (patch) | |
tree | 077a645d050c09d5d3a4a1efd7acf20506808c46 | |
parent | 578f2cffab733cbbe232c702c9053037256bb6fd (diff) |
Check for PUA characters in Android tests.
Fixes issue 5.
-rwxr-xr-x[-rw-r--r--] | scripts/run_android_tests.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/run_android_tests.py b/scripts/run_android_tests.py index 3eab071..819f065 100644..100755 --- a/scripts/run_android_tests.py +++ b/scripts/run_android_tests.py @@ -16,6 +16,7 @@ def load_fonts(): """Load all fonts built for Android.""" all_font_files = glob.glob('out/android/*.ttf') all_fonts = [ttLib.TTFont(font) for font in all_font_files] + assert len(all_font_files) == 18 return all_font_files, all_fonts @@ -55,6 +56,7 @@ class TestCharacterCoverage(unittest.TestCase): def setUp(self): _, self.fonts = load_fonts() + self.LEGACY_PUA = frozenset({0xEE01, 0xEE02, 0xF6C3}) def test_lack_of_arrows_and_combining_keycap(self): """Tests that arrows and combining keycap are not in the fonts.""" @@ -72,7 +74,6 @@ class TestCharacterCoverage(unittest.TestCase): self.assertNotIn(0x2073, charset) self.assertNotIn(0x208F, charset) - def test_inclusion_of_sound_recording_copyright(self): """Tests that sound recording copyright symbol is in the fonts.""" for font in self.fonts: @@ -81,6 +82,22 @@ class TestCharacterCoverage(unittest.TestCase): 0x2117, charset, # SOUND RECORDING COPYRIGHT 'U+2117 not found in %s.' % font_data.font_name(font)) + def test_inclusion_of_legacy_pua(self): + """Tests that legacy PUA characters remain in the fonts.""" + for font in self.fonts: + charset = coverage.character_set(font) + for char in self.LEGACY_PUA: + self.assertIn(char, charset) + + def test_non_inclusion_of_other_pua(self): + """Tests that there are not other PUA characters except legacy ones.""" + for font in self.fonts: + charset = coverage.character_set(font) + pua_chars = { + char for char in charset + if 0xE000 <= char <= 0xF8FF or 0xF0000 <= char <= 0x10FFFF} + self.assertTrue(pua_chars <= self.LEGACY_PUA) + class TestSpacingMarks(unittest.TestCase): """Tests that spacing marks are indeed spacing.""" |