summaryrefslogtreecommitdiff
path: root/scripts/run_general_tests.py
diff options
context:
space:
mode:
authorRoozbeh Pournader <roozbeh@google.com>2014-10-23 10:38:52 -0700
committerJames Godfrey-Kittle <jamesgk@google.com>2015-04-16 12:16:22 -0700
commit890560275ea274b567f9755887c6441f94a9cf08 (patch)
tree81766c15caaf1891481a9da217cee29af697c2be /scripts/run_general_tests.py
parent99922cd0d0e773f263a1b78643460efbcc704aa7 (diff)
Add test for italic angle.
Diffstat (limited to 'scripts/run_general_tests.py')
-rwxr-xr-xscripts/run_general_tests.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py
new file mode 100755
index 0000000..0785b4e
--- /dev/null
+++ b/scripts/run_general_tests.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+"""Test general health of the fonts."""
+
+import glob
+import unittest
+
+from fontTools import ttLib
+from nototools import font_data
+
+
+def load_fonts():
+ """Load all major fonts."""
+ all_font_files = (glob.glob('out/RobotoTTF/*.ttf')
+ + glob.glob('out/RobotoCondensedTTF/*.ttf'))
+ all_fonts = [ttLib.TTFont(font) for font in all_font_files]
+ assert len(all_font_files) == 18
+ return all_font_files, all_fonts
+
+
+class TestItalicAngle(unittest.TestCase):
+ """Test the italic angle of fonts."""
+
+ def setUp(self):
+ _, self.fonts = load_fonts()
+
+ def test_italic_angle(self):
+ """Tests the italic angle of fonts to be correct."""
+ for font in self.fonts:
+ post_table = font['post']
+ if 'Italic' in font_data.font_name(font):
+ expected_angle = -12.0
+ else:
+ expected_angle = 0.0
+ self.assertEqual(post_table.italicAngle, expected_angle)
+
+
+if __name__ == '__main__':
+ unittest.main()