示例#1
0
def test_parse_kerning():
    parsed = meta.parse_line("kerning first=65  second=218 amount=-1")

    assert parsed == meta.Kerning(first=65, second=218, amount=-1)

    assert parsed.first == 65
    assert parsed.second == 218
    assert parsed.amount == -1
示例#2
0
def test_parse_common():
    parsed = meta.parse_line(
        "common lineHeight=32 base=27 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=1 redChnl=0 greenChnl=0 blueChnl=0"
    )
    assert parsed == meta.Common(
        lineHeight=32,
        base=27,
        scaleW=256,
        scaleH=256,
        pages=1,
        packed=0,
        alphaChnl=1,
        redChnl=0,
        greenChnl=0,
        blueChnl=0,
    )

    assert parsed.lineHeight == 32
示例#3
0
def test_parse_char():
    parsed = meta.parse_line(
        "char id=246  x=150   y=43    width=12    height=17    xoffset=1     yoffset=10    xadvance=14    page=0  chnl=15"
    )

    assert parsed == meta.Char(
        id=246,
        x=150,
        y=43,
        width=12,
        height=17,
        xoffset=1,
        yoffset=10,
        xadvance=14,
        page=0,
        chnl=15,
    )

    assert parsed.height == 17
示例#4
0
def test_parse_info():
    parsed = meta.parse_line(
        'info face="Raleway" size=32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=0 aa=1 padding=0,0,0,0 spacing=1,1 outline=0'
    )

    assert parsed == meta.Info(
        face="Raleway",
        size=32,
        bold=0,
        italic=0,
        charset="",
        unicode=1,
        stretchH=100,
        smooth=0,
        aa=1,
        padding=(0, 0, 0, 0),
        spacing=(1, 1),
        outline=0,
    )

    assert parsed.face == "Raleway"
    assert parsed.size == 32
示例#5
0
def test_parse_page():
    parsed = meta.parse_line('page id=0 file="raleway-thin-32_0.png"')
    assert parsed == meta.Page(id=0, file="raleway-thin-32_0.png")
    assert parsed.id == 0
    assert parsed.file == "raleway-thin-32_0.png"