From 8b104313fa7e1bec8488f2e63c06023ce6de1909 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 22 Apr 2021 12:59:04 -0300 Subject: [PATCH] Test magic wand in a fully opaque transparent layer --- scripts/selection_tools.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/selection_tools.lua diff --git a/scripts/selection_tools.lua b/scripts/selection_tools.lua new file mode 100644 index 000000000..24fa8791b --- /dev/null +++ b/scripts/selection_tools.lua @@ -0,0 +1,28 @@ +-- Copyright (C) 2021 Igara Studio S.A. +-- +-- This file is released under the terms of the MIT license. +-- Read LICENSE.txt for more information. + +dofile('./test_utils.lua') + +---------------------------------------------------------------------- +-- Test magic wand in transparent layer +-- Note: A regression in the beta was found in this case. + +do + local s = Sprite(4, 4, ColorMode.INDEXED) + app.command.LayerFromBackground() + + local i = s.cels[1].image + i:clear(0) + i:putPixel(0, 0, 1) + expect_eq(4, i.width) + expect_eq(4, i.height) + + app.useTool{ tool='magic_wand', points={Point(0, 0)} } + expect_eq(Rectangle(0, 0, 1, 1), s.selection.bounds) + + app.useTool{ tool='magic_wand', points={Point(1, 0)} } + expect_eq(Rectangle(0, 0, 4, 4), s.selection.bounds) + assert(not s.selection:contains(0, 0)) +end