mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-29 00:23:48 +00:00
Test Rectangle:contains/union/intersect(s) functions
This commit is contained in:
parent
01c9605a8c
commit
bd521ec45f
@ -37,3 +37,25 @@ assert(rc.x == 2)
|
||||
assert(rc.y == 3)
|
||||
assert(rc.width == 4)
|
||||
assert(rc.height == 5)
|
||||
|
||||
-- Rectangle:contains
|
||||
|
||||
local a = Rectangle{x=2, y=3, width=4, height=5}
|
||||
local b = Rectangle{x=3, y=4, width=1, height=1}
|
||||
assert(a:contains(b))
|
||||
assert(not b:contains(a))
|
||||
|
||||
-- Rectangle:intersect
|
||||
|
||||
assert(a:intersects(b))
|
||||
assert(b == a:intersect(b))
|
||||
|
||||
a = Rectangle{x=2, y=3, width=4, height=5}
|
||||
b = Rectangle{x=3, y=4, width=4, height=5}
|
||||
c = Rectangle{x=3, y=4, width=3, height=4}
|
||||
assert(c == a:intersect(b))
|
||||
assert(c == b:intersect(a))
|
||||
|
||||
-- Rectangle:union
|
||||
|
||||
assert(Rectangle{x=2, y=3, width=5, height=6} == a:union(b))
|
||||
|
Loading…
Reference in New Issue
Block a user