Example #1
0
def test_check_gdef_non_mark_chars():
    """ Are some non-mark characters in GDEF mark glyph class spacing? """
    from fontbakery.profiles.gdef import com_google_fonts_check_gdef_non_mark_chars as check

    print("Test: SKIP if a font lacks a GDEF table...")
    test_font = get_test_font()
    status, message = list(check(test_font))[-1]
    assert status == SKIP

    print("Test: PASS with an empty GDEF table")
    add_gdef_table(test_font, {})
    status, message = list(check(test_font))[-1]
    assert status == PASS

    print("Test: PASS with an GDEF with only properly declared mark chars")
    add_gdef_table(test_font, {'acutecomb': 3})
    status, message = list(check(test_font))[-1]
    assert status == PASS

    print(
        "Test: PASS with an GDEF with a non-mark char (U+00B4, 'acute') misdeclared"
    )
    add_gdef_table(test_font, {'acute': 3, 'acutecomb': 3})
    status, msg = list(check(test_font))[-1]
    assert status == WARN and msg.code == "non-mark-chars"
    assert 'U+00B4' in msg.message
Example #2
0
def test_check_gdef_spacing_marks():
    """ Are some spacing glyphs in GDEF mark glyph class? """
    from fontbakery.profiles.gdef import com_google_fonts_check_gdef_spacing_marks as check

    test_font = get_test_font()
    assert_SKIP(check(test_font),
                'if a font lacks a GDEF table...')

    add_gdef_table(test_font, {})
    assert_PASS(check(test_font),
                'with an empty GDEF table...')

    # Add a table with 'A' defined as a mark glyph:
    add_gdef_table(test_font, {'A': 3})
    assert_results_contain(check(test_font),
                           WARN, 'spacing-mark-glyphs',
                           'if a mark glyph has non-zero width...')
Example #3
0
def test_check_gdef_mark_chars():
    """ Are some mark characters not in in GDEF mark glyph class? """
    from fontbakery.profiles.gdef import com_google_fonts_check_gdef_mark_chars as check

    test_font = get_test_font()
    assert_SKIP(check(test_font),
                'if a font lacks a GDEF table...')

    # Add a GDEF table not including `acutecomb` (U+0301) as a mark char:
    add_gdef_table(test_font, {})
    message = assert_results_contain(check(test_font),
                                     WARN, 'mark-chars',
                                     'if a mark-char is not listed...')
    assert 'U+0301' in message

    # Include it in the table to see the check PASS:
    add_gdef_table(test_font, {'acutecomb': 3})
    assert_PASS(check(test_font),
                'when properly declared...')
Example #4
0
def test_check_gdef_spacing_marks():
    """ Are some spacing glyphs in GDEF mark glyph class? """
    from fontbakery.profiles.gdef import com_google_fonts_check_gdef_spacing_marks as check

    print("Test: SKIP if a font lacks a GDEF table")
    test_font = get_test_font()
    status, message = list(check(test_font))[-1]
    assert status == SKIP

    print("Test: PASS with an empty GDEF table")
    add_gdef_table(test_font, {})
    status, message = list(check(test_font))[-1]
    assert status == PASS

    print("Test: WARN if a mark glyph has non-zero width")
    # Add a table with 'A' defined as a mark glyph:
    add_gdef_table(test_font, {'A': 3})
    status, message = list(check(test_font))[-1]
    assert status == WARN and message.code == 'spacing-mark-glyphs'
Example #5
0
def test_check_gdef_non_mark_chars():
    """ Are some non-mark characters in GDEF mark glyph class spacing? """
    from fontbakery.profiles.gdef import com_google_fonts_check_gdef_non_mark_chars as check

    test_font = get_test_font()
    assert_SKIP(check(test_font),
                'if a font lacks a GDEF table...')

    add_gdef_table(test_font, {})
    assert_PASS(check(test_font),
                'with an empty GDEF table.')

    add_gdef_table(test_font, {'acutecomb': 3})
    assert_PASS(check(test_font),
                'with an GDEF with only properly declared mark chars.')

    add_gdef_table(test_font, {'acute': 3, 'acutecomb': 3})
    message = assert_results_contain(check(test_font),
                                     WARN, 'non-mark-chars',
                                     'with an GDEF with a non-mark char (U+00B4, "acute") misdeclared')
    assert 'U+00B4' in message
Example #6
0
def test_check_gdef_mark_chars():
    """ Are some mark characters not in in GDEF mark glyph class? """
    from fontbakery.profiles.gdef import com_google_fonts_check_gdef_mark_chars as check

    print("Test: SKIP if a font lacks a GDEF table...")
    test_font = get_test_font()
    status, message = list(check(test_font))[-1]
    assert status == SKIP

    print("Test: WARN if a mark-char is not listed...")
    # Add a GDEF table not including `acutecomb` (U+0301) as a mark char:
    add_gdef_table(test_font, {})
    status, msg = list(check(test_font))[-1]
    assert status == WARN and msg.code == "mark-chars"
    assert 'U+0301' in msg.message

    print("Test: PASS when properly declared...")
    # Include it in the table to see the check PASS:
    add_gdef_table(test_font, {'acutecomb': 3})
    status, message = list(check(test_font))[-1]
    assert status == PASS