implement code test for com.google.fonts/check/087
@@ -776,14 +776,41 @@ def test_check_086():
assert status == FAIL
-def NOT_IMPLEMENTED_test_check_087():
+def test_check_087():
""" METADATA.pb subsets should be alphabetically ordered. """
- # from fontbakery.specifications.googlefonts import com_google_fonts_check_087 as check
- # TODO: Implement-me!
- #
- # code-paths:
- # - FAIL
- # - PASS
+ from fontbakery.specifications.googlefonts import (com_google_fonts_check_087 as check,
+ family_directory,
+ metadata)
+
+ # Let's start with the METADATA.pb file from our reference FamilySans family:
+ fonts = ["data/test/familysans/FamilySans-Regular.ttf"]
+ md = metadata(family_directory(fonts))
+
+ good_cases = [
+ ["latin", "menu"],
+ ["cyrillic", "latin", "menu"],
+ ["cyrillic", "khmer", "latin", "menu"],
+ ]
+
+ bad_cases = [
+ ["menu", "latin"],
+ ["latin", "cyrillic", "menu"],
+ ["cyrillic", "menu", "khmer", "latin"],
+ ]
+
+ for good in good_cases:
+ print ("Test PASS: ".format(good))
+ del md.subsets[:]
+ md.subsets.extend(good)
+ status, message = list(check(md))[-1]
+ assert status == PASS
+
+ for bad in bad_cases:
+ print ("Test FAIL: ".format(bad))
+ del md.subsets[:]
+ md.subsets.extend(bad)
+ status, message = list(check(md))[-1]
+ assert status == FAIL
def NOT_IMPLEMENTED_test_check_088():
