From 048c51fe3cb1f64889c249aa8eb5964c2e14519a Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 7 Sep 2018 14:05:54 -0300 Subject: [PATCH] Add cel tests --- scripts/cel.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/cel.lua diff --git a/scripts/cel.lua b/scripts/cel.lua new file mode 100644 index 000000000..cdaff30dc --- /dev/null +++ b/scripts/cel.lua @@ -0,0 +1,22 @@ +-- Copyright (C) 2018 David Capello +-- +-- This file is released under the terms of the MIT license. +-- Read LICENSE.txt for more information. + +local s = Sprite(32, 64) +assert(#s.layers == 1) +assert(#s.cels == 1) + +local c = s.cels[1] +assert(c.sprite == s) +assert(c.layer == s.layers[1]) +assert(c.frame == 1) +assert(c.image) +assert(c.bounds == Rectangle(0, 0, 32, 64)) +assert(c.color == Color()) +assert(c.data == "") + +c.color = Color{ r=255, g=100, b=20 } +c.data = "test" +assert(c.color == Color{ r=255, g=100, b=20 }) +assert(c.data == "test")