コード例 #1
0
def test_packer_cli_no_args(parsers):
    from ttblit.tool import packer

    parser, subparser = parsers

    packer = packer.Packer(subparser)

    args = parser.parse_args(['pack'])

    packer.run(args)
コード例 #2
0
def test_packer_cli_invalid_input(parsers, test_resources, output_dir):
    from ttblit.tool import packer

    parser, subparser = parsers

    packer = packer.Packer(subparser)

    args = parser.parse_args([
        'pack',
        '--force',
        '--config', str(test_resources / 'assets_invalid_input.yml'),
        '--output', output_dir
    ])

    packer.run(args)

    assert packer.targets[0][1][0].type == 'raw/binary'
コード例 #3
0
def test_packer_cli_relative_yml(parsers, test_resources, output_dir):
    from ttblit.tool import packer

    parser, subparser = parsers

    packer = packer.Packer(subparser)

    args = parser.parse_args([
        'pack',
        '--force',
        '--config', str(test_resources / 'assets_relative.yml'),
        '--output', output_dir
    ])

    packer.run(args)

    assert (pathlib.Path(output_dir) / "assets.hpp").exists()
    assert (pathlib.Path(output_dir) / "assets.cpp").exists()
コード例 #4
0
def test_packer_cli_wildcard_default(parsers, test_resources, output_dir):
    from ttblit.tool import packer

    parser, subparser = parsers

    packer = packer.Packer(subparser)

    args = parser.parse_args([
        'pack',
        '--force',
        '--config', str(test_resources / 'assets_wildcard_default.yml'),
        '--output', output_dir
    ])

    packer.run(args)

    assert (pathlib.Path(output_dir) / "assets.hpp").exists()
    assert (pathlib.Path(output_dir) / "assets.cpp").exists()

    hpp = open(pathlib.Path(output_dir) / "assets.hpp", "r").read()

    assert "asset_level_01_tmx" in hpp
    assert "asset_level_02_tmx" in hpp
コード例 #5
0
def test_packer_cli_multiple_outputs(parsers, test_resources, output_dir):
    from ttblit.tool import packer

    parser, subparser = parsers

    packer = packer.Packer(subparser)

    args = parser.parse_args([
        'pack',
        '--force',
        '--config', str(test_resources / 'assets_multi_out.yml'),
        '--output', output_dir
    ])

    packer.run(args)

    assert (pathlib.Path(output_dir) / "assets.hpp").exists()
    assert (pathlib.Path(output_dir) / "assets.cpp").exists()

    hpp = open(pathlib.Path(output_dir) / "assets.hpp", "r").read()

    assert "asset_image_packed" in hpp
    assert "asset_image_raw" in hpp