diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/common_tests.py | 12 | ||||
-rwxr-xr-x | scripts/run_general_tests.py | 1 | ||||
-rwxr-xr-x | scripts/run_web_tests.py | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/scripts/common_tests.py b/scripts/common_tests.py index ca37557..952e794 100644 --- a/scripts/common_tests.py +++ b/scripts/common_tests.py @@ -88,6 +88,8 @@ class TestItalicAngle(FontTest): class TestMetaInfo(FontTest): """Test various meta information.""" + mark_heavier_as_bold = False + def setUp(self): _, self.fonts = self.loaded_fonts @@ -98,7 +100,8 @@ class TestMetaInfo(FontTest): """ for font in self.fonts: font_name = font_data.font_name(font) - bold = ('Bold' in font_name) or ('Black' in font_name) + bold = ('Bold' in font_name) or ( + self.mark_heavier_as_bold and 'Black' in font_name) italic = 'Italic' in font_name expected_mac_style = (italic << 1) | bold self.assertEqual(font['head'].macStyle, expected_mac_style) @@ -144,6 +147,8 @@ class TestMetaInfo(FontTest): class TestNames(FontTest): """Tests various strings in the name table.""" + mark_heavier_as_bold = False + def setUp(self): font_files, self.fonts = self.loaded_fonts self.font_files = [path.basename(f) for f in font_files] @@ -222,7 +227,10 @@ class TestNames(FontTest): self.assertIn(subfam, ['Regular', 'Bold', 'Italic', 'Bold Italic']) # check that subfamily weight/slope are consistent with filename - self.assertEqual(weight == 'Bold', subfam.startswith('Bold')) + bold = (weight == 'Bold') or ( + self.mark_heavier_as_bold and + noto_fonts.WEIGHTS[weight] > noto_fonts.WEIGHTS['Bold']) + self.assertEqual(bold, subfam.startswith('Bold')) self.assertEqual(slope == 'Italic', subfam.endswith('Italic')) # check typographic name, if present diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py index 297c37c..7ec8fcc 100755 --- a/scripts/run_general_tests.py +++ b/scripts/run_general_tests.py @@ -42,6 +42,7 @@ class TestItalicAngle(common_tests.TestItalicAngle): class TestMetaInfo(common_tests.TestMetaInfo): loaded_fonts = FONTS + mark_heavier_as_bold = True test_us_weight = None test_version_numbers = None diff --git a/scripts/run_web_tests.py b/scripts/run_web_tests.py index 21e5577..f201114 100755 --- a/scripts/run_web_tests.py +++ b/scripts/run_web_tests.py @@ -32,6 +32,7 @@ class TestItalicAngle(common_tests.TestItalicAngle): class TestMetaInfo(common_tests.TestMetaInfo): loaded_fonts = FONTS + mark_heavier_as_bold = True # Since different font files are hinted at different times, the actual # outlines differ slightly. So we are keeping the version numbers as a hint. test_version_numbers = None @@ -40,6 +41,7 @@ class TestMetaInfo(common_tests.TestMetaInfo): class TestNames(common_tests.TestNames): loaded_fonts = FONTS family_name = 'Roboto' + mark_heavier_as_bold = True def test_unique_identifier_and_full_name(self): """Tests the unique identifier and full name.""" |