implement code test for com.google.fonts/check/105
@@ -1403,14 +1403,51 @@ def test_check_104():
assert status == FAIL
-def NOT_IMPLEMENTED_test_check_105():
- """ Filename is set canonically in METADATA.pb? """
- # from fontbakery.specifications.googlefonts import com_google_fonts_check_105 as check
- # TODO: Implement-me!
- #
- # code-paths:
- # - FAIL
- # - PASS
+def test_check_105():
+ """ METADATA.pb: Filename is set canonically? """
+ from fontbakery.specifications.googlefonts import (com_google_fonts_check_105 as check,
+ family_metadata,
+ font_metadata,
+ canonical_filename)
+ fontfile = "data/test/cabin/Cabin-Regular.ttf"
+ family_directory = os.path.dirname(fontfile)
+ family_meta = family_metadata(family_directory)
+ font_meta = font_metadata(family_meta, fontfile)
+
+ test_cases = [
+ #expected, weight, style, filename
+ [PASS, 100, "normal", "Cabin-Thin.ttf"],
+ [PASS, 100, "italic", "Cabin-ThinItalic.ttf"],
+ [PASS, 200, "normal", "Cabin-ExtraLight.ttf"],
+ [PASS, 200, "italic", "Cabin-ExtraLightItalic.ttf"],
+ [PASS, 300, "normal", "Cabin-Light.ttf"],
+ [PASS, 300, "italic", "Cabin-LightItalic.ttf"],
+ [PASS, 400, "normal", "Cabin-Regular.ttf"],
+ [PASS, 400, "italic", "Cabin-Italic.ttf"],
+ [FAIL, 400, "italic", "Cabin-RegularItalic.ttf"],
+ [PASS, 500, "normal", "Cabin-Medium.ttf"],
+ [PASS, 500, "italic", "Cabin-MediumItalic.ttf"],
+ [PASS, 600, "normal", "Cabin-SemiBold.ttf"],
+ [PASS, 600, "italic", "Cabin-SemiBoldItalic.ttf"],
+ [PASS, 700, "normal", "Cabin-Bold.ttf"],
+ [PASS, 700, "italic", "Cabin-BoldItalic.ttf"],
+ [PASS, 800, "normal", "Cabin-ExtraBold.ttf"],
+ [PASS, 800, "italic", "Cabin-ExtraBoldItalic.ttf"],
+ [PASS, 900, "normal", "Cabin-Black.ttf"],
+ [PASS, 900, "italic", "Cabin-BlackItalic.ttf"]
+ ]
+
+ for expected, weight, style, filename in test_cases:
+ print (("Test {} with style:'{}',"
+ " weight:{} and filename:'{}'...").format(expected,
+ style,
+ weight,
+ filename))
+ font_meta.style = style
+ font_meta.weight = weight
+ font_meta.filename = filename
+ status, message = list(check(font_meta, canonical_filename(font_meta)))[-1]
+ assert status == expected
def test_check_106():
