Test that "spriteSourceSize" are generated correctly when -trim -merge-duplicates are used together

This commit is contained in:
David Capello 2020-02-06 11:54:55 -03:00
parent adc97fffb7
commit b690230387
3 changed files with 34 additions and 1 deletions

View File

@ -1,5 +1,5 @@
#! /bin/bash
# Copyright (C) 2019 Igara Studio S.A.
# Copyright (C) 2019-2020 Igara Studio S.A.
# $1 = first sprite sheet json file
# $2 = second sprite sheet json file
@ -243,3 +243,32 @@ for type in horizontal vertical rows columns ; do
-script scripts/compare_sprite_sheets.lua || exit $?
done
done
# "Trim Cels" (-trim) with -merge-duplicates didn't generate the
# correct "spriteSourceSize" for each frame.
# https://igarastudio.zendesk.com/agent/tickets/407
d=$t/ticket-407
for layer in a b ; do
$ASEPRITE -b -layer "$layer" "sprites/point4frames.aseprite" \
-trim \
-data "$d/data1-$layer.json" \
-format json-array -sheet "$d/sheet1-$layer.png" || exit 1
$ASEPRITE -b -layer "$layer" "sprites/point4frames.aseprite" \
-trim -merge-duplicates \
-data "$d/data2-$layer.json" \
-format json-array -sheet "$d/sheet2-$layer.png" || exit 1
cat >$d/compare.lua <<EOF
local json = dofile('third_party/json/json.lua')
local data1 = json.decode(io.open('$d/data1-$layer.json'):read('a'))
local data2 = json.decode(io.open('$d/data2-$layer.json'):read('a'))
for i = 1,4 do
local a = data1.frames[i].spriteSourceSize
local b = data2.frames[i].spriteSourceSize
assert(a.x == b.x)
assert(a.y == b.y)
assert(a.w == b.w)
assert(a.h == b.h)
end
EOF
$ASEPRITE -b -script "$d/compare.lua" || exit 1
done

View File

@ -15,3 +15,7 @@
* `tags3.aseprite`: 3 tags ("forward", "reverse", "pingpong") and 3
layers ("a", "b", "c"), 4x4, several linked cels + layer "c" with
empty cels.
* `point4frames.aseprite`: Indexed, 4 frames, 2 layers, same cel
content but different positions, can be used to test
`-merge-duplicates` to check if all cels go to the same sprite sheet
position.

Binary file not shown.