mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Test ReplaceColor{} command
This commit is contained in:
parent
b800de65a6
commit
b8affd9518
@ -4,6 +4,8 @@
|
|||||||
-- 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 -- Undo/Redo commands (like app.undo/redo())
|
do -- Undo/Redo commands (like app.undo/redo())
|
||||||
local s = Sprite(32, 32)
|
local s = Sprite(32, 32)
|
||||||
assert(s.width == 32)
|
assert(s.width == 32)
|
||||||
@ -133,3 +135,34 @@ do -- CanvasSize
|
|||||||
app.command.CanvasSize{ top=2, right=4, bottom=8 }
|
app.command.CanvasSize{ top=2, right=4, bottom=8 }
|
||||||
assert(s.bounds == Rectangle(0, 0, 38, 42))
|
assert(s.bounds == Rectangle(0, 0, 38, 42))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do -- ReplaceColor
|
||||||
|
local s = Sprite(4, 4)
|
||||||
|
local cel = app.activeCel
|
||||||
|
local red = Color(255, 0, 0)
|
||||||
|
local yellow = Color(255, 255, 0)
|
||||||
|
local blue = Color(0, 0, 255)
|
||||||
|
local r = red.rgbaPixel
|
||||||
|
local y = yellow.rgbaPixel
|
||||||
|
local b = blue.rgbaPixel
|
||||||
|
|
||||||
|
expect_eq(cel.bounds, Rectangle(0, 0, 4, 4))
|
||||||
|
expect_img(cel.image,
|
||||||
|
{ 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0 })
|
||||||
|
|
||||||
|
app.useTool{ brush=Brush(1), color=red, points={Point(1,1)} }
|
||||||
|
app.useTool{ brush=Brush(1), color=yellow, points={Point(2,2)} }
|
||||||
|
expect_eq(cel.bounds, Rectangle(1, 1, 2, 2))
|
||||||
|
expect_img(cel.image,
|
||||||
|
{ r, 0,
|
||||||
|
0, y })
|
||||||
|
|
||||||
|
app.command.ReplaceColor{ ui=false, from=red, to=blue }
|
||||||
|
expect_eq(cel.bounds, Rectangle(1, 1, 2, 2))
|
||||||
|
expect_img(cel.image,
|
||||||
|
{ b, 0,
|
||||||
|
0, y })
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user