mirror of
https://github.com/centau/vide.git
synced 2026-10-21 03:36:10 +00:00
Fix children being unparented after moving to another parent
This commit is contained in:
parent
a4151bd41e
commit
c3c09de1ba
2 changed files with 30 additions and 3 deletions
|
|
@ -1050,6 +1050,33 @@ TEST("create()", wrap_root(function()
|
|||
CHECK(parent:FindFirstChild "c")
|
||||
end
|
||||
|
||||
do CASE "children moved to another parent"
|
||||
local other = create "Frame" {}
|
||||
|
||||
local child = create "Frame" {}
|
||||
local children_a = source { child }
|
||||
local children_b = source {}
|
||||
create "Frame" { children_a }
|
||||
local parent_b = create "Frame" { children_b }
|
||||
|
||||
children_b { child }
|
||||
children_a {}
|
||||
CHECK(child.Parent == parent_b)
|
||||
|
||||
local a = create "Frame" {}
|
||||
local b = create "Frame" {}
|
||||
local destroy = root(function()
|
||||
create "Frame" { function() return a end }
|
||||
create "Frame" { function() return { function() return b end } end }
|
||||
end)
|
||||
|
||||
a.Parent = other
|
||||
b.Parent = other
|
||||
destroy()
|
||||
CHECK(a.Parent == other)
|
||||
CHECK(b.Parent == other)
|
||||
end
|
||||
|
||||
do CASE "garbage collection test"
|
||||
local wref
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue