run_android_tests.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/usr/bin/python
  2. #
  3. # Copyright 2015 Google Inc. All Rights Reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. """Test assumptions that Android relies on."""
  17. import unittest
  18. from nototools.unittests import font_tests
  19. import run_general_tests
  20. FONTS = font_tests.load_fonts(
  21. ['out/android/*.ttf'],
  22. expected_count=20)
  23. class TestItalicAngle(run_general_tests.TestItalicAngle):
  24. loaded_fonts = FONTS
  25. class TestMetaInfo(run_general_tests.TestMetaInfo):
  26. """Bugs:
  27. https://github.com/google/roboto/issues/142
  28. """
  29. loaded_fonts = FONTS
  30. mark_heavier_as_bold = True
  31. def test_glyphs_dont_round_to_grid(self):
  32. """Bug: https://github.com/google/roboto/issues/153"""
  33. for font in self.fonts:
  34. glyph_set = font.getGlyphSet()
  35. # only concerned with this glyph for now, but maybe more later
  36. for name in ['ellipsis']:
  37. glyph = glyph_set[name]._glyph
  38. for component in glyph.components:
  39. self.assertFalse(component.flags & (1 << 2))
  40. class TestNames(run_general_tests.TestNames):
  41. """Bugs:
  42. https://github.com/google/roboto/issues/37
  43. """
  44. loaded_fonts = FONTS
  45. class TestVerticalMetrics(font_tests.TestVerticalMetrics):
  46. loaded_fonts = FONTS
  47. test_os2_metrics = None
  48. # tests yMin and yMax to be equal to Roboto v1 values
  49. # android requires this, and web fonts expect this
  50. expected_head_yMin = -555
  51. expected_head_yMax = 2163
  52. # test ascent, descent, and lineGap to be equal to Roboto v1 values
  53. expected_hhea_descent = -500
  54. expected_hhea_ascent = 1900
  55. expected_hhea_lineGap = 0
  56. class TestDigitWidths(font_tests.TestDigitWidths):
  57. loaded_fonts = FONTS
  58. class TestCharacterCoverage(font_tests.TestCharacterCoverage):
  59. loaded_fonts = FONTS
  60. include = frozenset([
  61. 0x2117, # SOUND RECORDING COPYRIGHT
  62. 0xEE01, 0xEE02, 0xF6C3]) # legacy PUA
  63. exclude = frozenset([
  64. 0x20E3, # COMBINING ENCLOSING KEYCAP
  65. 0x2191, # UPWARDS ARROW
  66. 0x2193, # DOWNWARDS ARROW
  67. 0x2072, 0x2073, 0x208F] + # unassigned characters
  68. range(0xE000, 0xF8FF + 1) + range(0xF0000, 0x10FFFF + 1) # other PUA
  69. ) - include # don't exclude legacy PUA
  70. class TestLigatures(run_general_tests.TestLigatures):
  71. loaded_fonts = FONTS
  72. if __name__ == '__main__':
  73. unittest.main()