Test new Sprite.pixelRatio property

This commit is contained in:
David Capello 2021-04-09 16:19:58 -03:00
parent 3a63ec4cf0
commit 691bc0ace1

View File

@ -1,4 +1,4 @@
-- Copyright (C) 2019 Igara Studio S.A. -- Copyright (C) 2019-2021 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.
@ -120,10 +120,22 @@ do
assert(s.gridBounds == Rectangle{0, 0, 16, 16}) assert(s.gridBounds == Rectangle{0, 0, 16, 16})
s.gridBounds = Rectangle{2, 3, 8, 4} s.gridBounds = Rectangle{2, 3, 8, 4}
assert(s.gridBounds == Rectangle{2, 3, 8, 4}) assert(s.gridBounds == Rectangle{2, 3, 8, 4})
s:saveAs("_test_sprite_gridbounds.png") s:saveAs("_test_sprite_gridbounds.aseprite")
local s2 = Sprite{ fromFile="_test_sprite_gridbounds.png" } local s2 = Sprite{ fromFile="_test_sprite_gridbounds.aseprite" }
assert(s.gridBounds == Rectangle{2, 3, 8, 4}) assert(s2.gridBounds == Rectangle{2, 3, 8, 4})
end
-- Pixel ratio
do
local s = Sprite(32, 32)
assert(s.pixelRatio == Size{1, 1})
s.pixelRatio = Size{3, 2}
assert(s.pixelRatio == Size{3, 2})
s:saveAs("_test_sprite_pixelratio.aseprite")
local s2 = Sprite{ fromFile="_test_sprite_pixelratio.aseprite" }
assert(s2.pixelRatio == Size{3, 2})
end end
-- Sprite{ fromFile, oneFrame } -- Sprite{ fromFile, oneFrame }