Ejemplo n.º 1
0
def test_check_ufolint(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import com_daltonmaag_check_ufolint as check
    _, ufo_path = empty_ufo_font

    assert_PASS(check(ufo_path),
                'with an empty UFO.')

    os.remove(os.path.join(ufo_path, "metainfo.plist"))
    assert_results_contain(check(ufo_path),
                           FAIL, "ufolint-fail",
                           'with maimed UFO.')
Ejemplo n.º 2
0
def test_check_unnecessary_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import com_daltonmaag_check_unnecessary_fields as check
    ufo, _ = empty_ufo_font

    assert_PASS(check(ufo),
                'with an empty UFO.')

    ufo.info.openTypeNameUniqueID = "aaa"
    ufo.info.openTypeNameVersion = "1.000"
    ufo.info.postscriptUniqueID = -1
    ufo.info.year = 2018

    assert_results_contain(check(ufo),
                           WARN, "unnecessary-fields",
                           'with unnecessary fields in UFO.')
Ejemplo n.º 3
0
def test_check_ufolint(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (com_daltonmaag_check_ufolint
                                                 as check)
    _, ufo_path = empty_ufo_font

    print('Test PASS with empty UFO.')
    c = list(check(ufo_path))
    status, _ = c[-1]
    assert status == PASS

    print('Test FAIL with maimed UFO.')
    os.remove(os.path.join(ufo_path, "metainfo.plist"))
    c = list(check(ufo_path))
    status, message = c[-1]
    assert status == FAIL
    assert type(message) == str
Ejemplo n.º 4
0
def test_check_ufolint(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_ufolint as check)
    _, ufo_path = empty_ufo_font

    print('Test PASS with empty UFO.')
    c = list(check(ufo_path))
    status, _ = c[-1]
    assert status == PASS

    print('Test FAIL with maimed UFO.')
    os.remove(os.path.join(ufo_path, "metainfo.plist"))
    c = list(check(ufo_path))
    status, message = c[-1]
    assert status == FAIL
    assert type(message) == str
Ejemplo n.º 5
0
def test_check_required_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import com_daltonmaag_check_required_fields as check
    ufo, _ = empty_ufo_font

    assert_results_contain(check(ufo),
                           FAIL, "missing-required-fields",
                           'with an empty UFO.')

    ufo.info.unitsPerEm = 1000
    ufo.info.ascender = 800
    ufo.info.descender = -200
    ufo.info.xHeight = 500
    ufo.info.capHeight = 700
    ufo.info.familyName = "Test"

    assert_PASS(check(ufo),
                'with an almost empty UFO.')
Ejemplo n.º 6
0
def test_check_recommended_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_recommended_fields as check)
    ufo, _ = empty_ufo_font

    assert_results_contain(check(ufo),
                           WARN, "missing-recommended-fields",
                           'with an empty UFO.')

    ufo.info.postscriptUnderlineThickness = 1000
    ufo.info.postscriptUnderlinePosition = 800
    ufo.info.versionMajor = -200
    ufo.info.versionMinor = 500
    ufo.info.styleName = "700"
    ufo.info.copyright = "Test"
    ufo.info.openTypeOS2Panose = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

    assert_PASS(check(ufo),
                'with an almost empty UFO.')
Ejemplo n.º 7
0
def test_check_unnecessary_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_unnecessary_fields as check)
    ufo, _ = empty_ufo_font

    print('Test PASS with empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == PASS

    ufo.info.openTypeNameUniqueID = "aaa"
    ufo.info.openTypeNameVersion = "1.000"
    ufo.info.postscriptUniqueID = -1
    ufo.info.year = 2018

    print('Test WARN with unnecessary fields in UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == WARN
Ejemplo n.º 8
0
def test_check_unnecessary_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_unnecessary_fields as check)
    ufo, _ = empty_ufo_font

    print('Test PASS with empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == PASS

    ufo.info.openTypeNameUniqueID = "aaa"
    ufo.info.openTypeNameVersion = "1.000"
    ufo.info.postscriptUniqueID = -1
    ufo.info.year = 2018

    print('Test WARN with unnecessary fields in UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == WARN
Ejemplo n.º 9
0
def test_check_required_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_required_fields as check)
    ufo, _ = empty_ufo_font

    print('Test FAIL with empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == FAIL

    ufo.info.unitsPerEm = 1000
    ufo.info.ascender = 800
    ufo.info.descender = -200
    ufo.info.xHeight = 500
    ufo.info.capHeight = 700
    ufo.info.familyName = "Test"

    print('Test PASS with almost empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == PASS
Ejemplo n.º 10
0
def test_check_required_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_required_fields as check)
    ufo, _ = empty_ufo_font

    print('Test FAIL with empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == FAIL

    ufo.info.unitsPerEm = 1000
    ufo.info.ascender = 800
    ufo.info.descender = -200
    ufo.info.xHeight = 500
    ufo.info.capHeight = 700
    ufo.info.familyName = "Test"

    print('Test PASS with almost empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == PASS
Ejemplo n.º 11
0
def test_check_recommended_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_recommended_fields as check)
    ufo, _ = empty_ufo_font

    print('Test WARN with empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == WARN

    ufo.info.postscriptUnderlineThickness = 1000
    ufo.info.postscriptUnderlinePosition = 800
    ufo.info.versionMajor = -200
    ufo.info.versionMinor = 500
    ufo.info.styleName = "700"
    ufo.info.copyright = "Test"
    ufo.info.openTypeOS2Panose = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

    print('Test PASS with almost empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == PASS
Ejemplo n.º 12
0
def test_check_recommended_fields(empty_ufo_font):
    from fontbakery.profiles.ufo_sources import (
        com_daltonmaag_check_recommended_fields as check)
    ufo, _ = empty_ufo_font

    print('Test WARN with empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == WARN

    ufo.info.postscriptUnderlineThickness = 1000
    ufo.info.postscriptUnderlinePosition = 800
    ufo.info.versionMajor = -200
    ufo.info.versionMinor = 500
    ufo.info.styleName = "700"
    ufo.info.copyright = "Test"
    ufo.info.openTypeOS2Panose = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

    print('Test PASS with almost empty UFO.')
    c = list(check(ufo))
    status, _ = c[-1]
    assert status == PASS