Add test case to avoid duplicated tiles when A=0 and RGB is different

This commit is contained in:
David Capello 2021-04-19 16:52:51 -03:00
parent 5920c09c85
commit f588477f4f

View File

@ -1,4 +1,4 @@
-- Copyright (C) 2019-2020 Igara Studio S.A.
-- Copyright (C) 2019-2021 Igara Studio S.A.
--
-- This file is released under the terms of the MIT license.
-- Read LICENSE.txt for more information.
@ -522,3 +522,39 @@ do
app.undo()
end
----------------------------------------------------------------------
-- Tests bug with alpha=0 and different RGB values
----------------------------------------------------------------------
do
local spr = Sprite(32, 32)
spr.gridBounds = Rectangle(0, 0, 2, 2)
app.command.NewLayer{ tilemap=true }
local tm = app.activeLayer
local ts = tm.tileset
expect_eq(1, #ts)
app.useTool{
tool='pencil',
color=Color{ r=0, g=0, b=0, a=255 },
tilemapMode=TilesetMode.PIXELS,
tilesetMode=TilesetMode.STACK,
points={ Point(0, 0), Point(3, 0) }}
expect_eq(2, #ts)
app.useTool{
tool='pencil',
color=Color{ r=255, g=0, b=0, a=0 },
tilemapMode=TilesetMode.PIXELS,
tilesetMode=TilesetMode.STACK,
points={ Point(0, 0), Point(1, 0) }}
-- If #ts is == 3, it means that the last useTool() with a r=255 a=0
-- created a new tile, that shouldn't be the case (because a=0
-- should ignore RGB values to compare tiles)
expect_eq(2, #ts)
end