mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Update some tests with the new app.activeFrame/Layer behavior
This commit is contained in:
parent
b750a92647
commit
bef770c2b3
@ -1,4 +1,4 @@
|
|||||||
-- Copyright (C) 2018 Igara Studio S.A.
|
-- Copyright (C) 2018-2019 Igara Studio S.A.
|
||||||
--
|
--
|
||||||
-- 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.
|
||||||
@ -6,8 +6,6 @@
|
|||||||
local s = Sprite(32, 64)
|
local s = Sprite(32, 64)
|
||||||
assert(s == app.activeSprite)
|
assert(s == app.activeSprite)
|
||||||
assert(s == app.site.sprite)
|
assert(s == app.site.sprite)
|
||||||
assert(s == app.activeCel.sprite)
|
|
||||||
assert(s == app.site.cel.sprite)
|
|
||||||
assert(s == app.activeFrame.sprite)
|
assert(s == app.activeFrame.sprite)
|
||||||
assert(s == app.site.frame.sprite)
|
assert(s == app.site.frame.sprite)
|
||||||
assert(1 == app.activeFrame.frameNumber)
|
assert(1 == app.activeFrame.frameNumber)
|
||||||
@ -15,8 +13,13 @@ assert(1 == app.site.frame.frameNumber)
|
|||||||
assert(1 == app.site.frameNumber)
|
assert(1 == app.site.frameNumber)
|
||||||
assert(0.100 == app.activeFrame.duration) -- Default frame duration
|
assert(0.100 == app.activeFrame.duration) -- Default frame duration
|
||||||
assert(0.100 == app.site.frame.duration)
|
assert(0.100 == app.site.frame.duration)
|
||||||
|
assert(s == app.activeLayer.sprite)
|
||||||
|
assert(s == app.site.layer.sprite)
|
||||||
|
assert(s == app.activeCel.sprite)
|
||||||
|
assert(s == app.site.cel.sprite)
|
||||||
|
|
||||||
-- TODO fix these tests when there is no UI
|
app.activeFrame.duration = 0.8
|
||||||
--app.command.NewFrame()
|
|
||||||
--assert(2 == app.activeFrame.frameNumber)
|
app.command.NewFrame()
|
||||||
--assert(0.100 == app.activeFrame.duration) -- Default frame duration
|
assert(2 == app.activeFrame.frameNumber)
|
||||||
|
assert(0.8 == app.activeFrame.duration) -- Copy frame duration of previous frame
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
-- Copyright (C) 2019 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.
|
||||||
@ -26,17 +27,22 @@ do -- NewLayer/RemoveLayer
|
|||||||
assert(#s.layers == 1)
|
assert(#s.layers == 1)
|
||||||
local lay = s.layers[1]
|
local lay = s.layers[1]
|
||||||
app.command.NewLayer{top=true}
|
app.command.NewLayer{top=true}
|
||||||
|
local lay2 = app.activeLayer
|
||||||
assert(#s.layers == 2)
|
assert(#s.layers == 2)
|
||||||
assert(s.layers[2].isImage)
|
assert(s.layers[2].isImage)
|
||||||
|
|
||||||
app.command.NewLayer{top=true, group=true}
|
app.command.NewLayer{top=true, group=true}
|
||||||
|
local lay3 = app.activeLayer
|
||||||
assert(#s.layers == 3)
|
assert(#s.layers == 3)
|
||||||
assert(s.layers[3].isGroup)
|
assert(s.layers[3].isGroup)
|
||||||
|
|
||||||
|
assert(app.activeLayer == lay3)
|
||||||
app.command.RemoveLayer()
|
app.command.RemoveLayer()
|
||||||
|
assert(app.activeLayer == lay2)
|
||||||
assert(#s.layers == 2)
|
assert(#s.layers == 2)
|
||||||
|
|
||||||
app.command.RemoveLayer()
|
app.command.RemoveLayer()
|
||||||
|
assert(app.activeLayer == lay)
|
||||||
assert(#s.layers == 1)
|
assert(#s.layers == 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -178,8 +178,15 @@ do
|
|||||||
-- required size.
|
-- required size.
|
||||||
app.activeTool = 'pencil'
|
app.activeTool = 'pencil'
|
||||||
app.useTool{ color=red, cel=bgCel1, points={ Point(0, 0) }}
|
app.useTool{ color=red, cel=bgCel1, points={ Point(0, 0) }}
|
||||||
app.useTool{ color=red, cel=bgCel2, points={ Point(1, 0) }}
|
app.useTool{ color=red, layer=bgCel2.layer, frame=bgCel2.frame, points={ Point(1, 0) }}
|
||||||
app.useTool{ color=yellow, cel=fgCel1, points={ Point(1, 1) }}
|
|
||||||
|
-- After using the tool in bgCel2, the activeFrame is the frame
|
||||||
|
-- number 2.
|
||||||
|
assert(bgCel2.frame == app.activeFrame)
|
||||||
|
assert(bgCel2.frame == fgCel2.frame)
|
||||||
|
|
||||||
|
app.activeFrame = fgCel1.frame
|
||||||
|
app.useTool{ color=yellow, layer=fgCel1.layer, points={ Point(1, 1) }}
|
||||||
app.useTool{ color=yellow, cel=fgCel2, points={ Point(2, 1) }}
|
app.useTool{ color=yellow, cel=fgCel2, points={ Point(2, 1) }}
|
||||||
|
|
||||||
assert(bgCel1.bounds == Rectangle(0, 0, 1, 1))
|
assert(bgCel1.bounds == Rectangle(0, 0, 1, 1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user