mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-31 00:32:48 +00:00
Merge branch 'master' into beta
This commit is contained in:
commit
8adc0b8832
@ -1,8 +1,11 @@
|
|||||||
|
-- Copyright (C) 2020 Igara Studio S.A.
|
||||||
-- Copyright (C) 2018 David Capello
|
-- Copyright (C) 2018 David Capello
|
||||||
--
|
--
|
||||||
-- This file is released under the terms of the MIT license.
|
-- This file is released under the terms of the MIT license.
|
||||||
-- Read LICENSE.txt for more information.
|
-- Read LICENSE.txt for more information.
|
||||||
|
|
||||||
|
dofile('./test_utils.lua')
|
||||||
|
|
||||||
do
|
do
|
||||||
local s = Sprite(32, 32)
|
local s = Sprite(32, 32)
|
||||||
for i = 1,3 do s:newFrame() end
|
for i = 1,3 do s:newFrame() end
|
||||||
@ -41,3 +44,43 @@ do
|
|||||||
assert(cb[1] == b.cels[1])
|
assert(cb[1] == b.cels[1])
|
||||||
assert(cb[3] == b.cels[2])
|
assert(cb[3] == b.cels[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Some extra tests of newCel() and deleteCel()
|
||||||
|
do
|
||||||
|
local s = Sprite(4, 4, ColorMode.INDEXED)
|
||||||
|
local layer = app.activeLayer
|
||||||
|
app.bgColor = 0
|
||||||
|
app.command.BackgroundFromLayer()
|
||||||
|
expect_img(s.cels[1].image, { 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0 })
|
||||||
|
|
||||||
|
-- Crash in old versions undoing newCel() in a background layer
|
||||||
|
s:newCel(layer, 1)
|
||||||
|
app.undo()
|
||||||
|
|
||||||
|
-- Check that newCel clears with bgColor in background layer
|
||||||
|
local img = Image(ImageSpec{ width=2, height=2,
|
||||||
|
colorMode=ColorMode.INDEXED })
|
||||||
|
array_to_pixels({ 0, 1,
|
||||||
|
2, 3 }, img)
|
||||||
|
|
||||||
|
app.bgColor = Color(1) -- bgColor used to clear the background cel
|
||||||
|
s:newCel(layer, 1, img, Point(1, 1))
|
||||||
|
expect_img(s.cels[1].image, { 1, 1, 1, 1,
|
||||||
|
1, 0, 1, 1,
|
||||||
|
1, 2, 3, 1,
|
||||||
|
1, 1, 1, 1 })
|
||||||
|
app.undo()
|
||||||
|
|
||||||
|
-- Check deleteCel()
|
||||||
|
app.bgColor = Color(2)
|
||||||
|
s:deleteCel(layer, 1)
|
||||||
|
expect_img(s.cels[1].image, { 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2 })
|
||||||
|
app.undo()
|
||||||
|
|
||||||
|
end
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
-- Read LICENSE.txt for more information.
|
-- Read LICENSE.txt for more information.
|
||||||
|
|
||||||
local none = ColorSpace() -- None
|
local none = ColorSpace() -- None
|
||||||
local srgb = ColorSpace{ sRGB }
|
local srgb = ColorSpace{ sRGB=true }
|
||||||
|
local none2 = ColorSpace{ sRGB=false }
|
||||||
assert(none ~= srgb)
|
assert(none ~= srgb)
|
||||||
|
assert(none == none2)
|
||||||
|
|
||||||
local spr = Sprite(32, 32)
|
local spr = Sprite(32, 32)
|
||||||
local cs1 = spr.colorSpace
|
local cs1 = spr.colorSpace
|
||||||
|
@ -125,3 +125,21 @@ do
|
|||||||
local s2 = Sprite{ fromFile="_test_sprite_gridbounds.png" }
|
local s2 = Sprite{ fromFile="_test_sprite_gridbounds.png" }
|
||||||
assert(s.gridBounds == Rectangle{2, 3, 8, 4})
|
assert(s.gridBounds == Rectangle{2, 3, 8, 4})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Sprite{ fromFile, oneFrame }
|
||||||
|
do
|
||||||
|
local s = Sprite(32, 32)
|
||||||
|
s:newFrame()
|
||||||
|
s:saveAs("_test1.png")
|
||||||
|
assert(#s.frames == 2)
|
||||||
|
|
||||||
|
s = Sprite{ fromFile="_test1.png" }
|
||||||
|
print(#s.frames)
|
||||||
|
assert(#s.frames == 2)
|
||||||
|
|
||||||
|
s = Sprite{ fromFile="_test1.png", oneFrame=true }
|
||||||
|
assert(#s.frames == 1)
|
||||||
|
|
||||||
|
s = Sprite{ fromFile="_test1.png", oneFrame=false }
|
||||||
|
assert(#s.frames == 2)
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user