From 4dde10a8d1711c1107742aed5041b9c5506e45c1 Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Mon, 27 Sep 2021 13:24:56 -0300 Subject: [PATCH] Add new tilemap test --- scripts/tilemap.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/scripts/tilemap.lua b/scripts/tilemap.lua index 42b7fdfb6..f90db3efe 100644 --- a/scripts/tilemap.lua +++ b/scripts/tilemap.lua @@ -855,6 +855,36 @@ do tilesetMode=TilesetMode.AUTO, points={ Point(4, 3), Point(5, 3), Point(5, 4), Point(4, 4) } } + + -- ====================================================================== + -- Cutting the canvas in the midle of the tilemap: + -- + -- ,--------- x = -1 + -- | + -- ___v _______ + -- | | | | + -- ∏|∏X|X <-- y = -1 + -- |----|--|----| + -- ∏|∏X|X + -- O|O∏|∏ + -- |----|--|----| + -- O|O∏|∏ + -- | | + -- | | + -- |____|__|____| + app.command.CanvasSize{ + ui=false, + bounds=Rectangle(3,2,2,2), + trimOutside=true + } + + expect_eq(app.activeLayer.cels[1].position, Point(-1,-1)) + expect_eq(app.activeLayer.cels[1].image.width, 2) -- width in tilemap terms + expect_eq(app.activeLayer.cels[1].image.height, 2) -- height in tilemap terms + -- ====================================================================== + + app.command.Undo() + -- ====================================================================== -- Cutting the canvas from the bottom -- ,--------- x = 2