def test_spine_export_one_layer(): expected = { 'bones': [{ 'name': 'root' }], 'slots': [{ 'attachment': 'name', 'bone': 'root', 'name': 'name' }], 'skins': { 'default': { 'name': { 'name': { 'height': 1080, 'rotation': 0, 'width': 1920, 'x': 0, 'y': 540 } } } }, 'animations': {}, } img = Image() img.layers = [ Layer("name"), ] result = spine_export(img, None, None, "", None) assert (result == expected)
def test_spine_export_skin(): expected = { 'bones': [{ 'name': 'root' }], 'slots': [{ 'attachment': 'skin1', 'bone': 'root', 'name': 'name2' }], 'skins': { 'skin1': { 'name2': { 'name2': { 'height': 1080, 'rotation': 0, 'width': 1920, 'x': 0, 'y': 540 } } } }, 'animations': {}, } img = Image() group = GroupLayer("[skin]skin1", image=img) group.layers = [ Layer("name2", group), ] img.layers = [group] result = spine_export(img, None, None, "", None) assert (result == expected)
def test_spine_export_merge(): img = Image() group1 = GroupLayer("[merge]name1", image=img) group1.layers = [ Layer("name2", group1), Layer("name3", group1), ] img.layers = [group1] img2 = Image() img2.layers = [Layer("name1")] result = spine_export(img, None, None, "", None) expected = spine_export(img2, None, None, "", None) assert (result == expected)
def test_spine_export_empty(): expected = { 'bones': [{ 'name': 'root' }], 'slots': [], 'skins': { 'default': {} }, 'animations': {}, } img = Image() result = spine_export(img, None, None, "", None) assert (result == expected)
def test_spine_export_ignored(): expected = { 'bones': [{ 'name': 'root' }], 'slots': [], 'skins': { 'default': {} }, 'animations': {}, } img = Image() img.layers = [ Layer("[ignore]name"), ] result = spine_export(img, None, None, "", None) assert (result == expected)