mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-29 17:30:09 +02:00
Attempt to fix "GSI does not monitor lifetime of Qt objects"
This commit is contained in:
Vendored
+31
-5
@@ -210,20 +210,20 @@ class QtBinding_TestClass < TestBase
|
||||
|
||||
a.installEventFilter(ef)
|
||||
|
||||
aa = MyAction.new(nil, "aa")
|
||||
aa = MyAction.new(nil, "aa1")
|
||||
assert_equal(ce_log.join(","), "")
|
||||
aa.setParent(a)
|
||||
assert_equal(ce_log.join(","), "true:aa")
|
||||
assert_equal(ce_log.join(","), "true:aa1")
|
||||
ce_log = []
|
||||
|
||||
# destroy aa
|
||||
aa.destroy
|
||||
aa = nil
|
||||
assert_equal(ce_log.join(","), "false:aa")
|
||||
assert_equal(ce_log.join(","), "false:aa1")
|
||||
ce_log = []
|
||||
|
||||
no_event = true
|
||||
aa = MyAction.new(nil, "aa")
|
||||
aa = MyAction.new(nil, "aa2")
|
||||
aa.setParent(a)
|
||||
assert_equal(ce_log.join(","), "")
|
||||
ce_log = []
|
||||
@@ -231,7 +231,7 @@ class QtBinding_TestClass < TestBase
|
||||
no_event = false
|
||||
aa.destroy
|
||||
aa = nil
|
||||
assert_equal(ce_log.join(","), "false:aa")
|
||||
assert_equal(ce_log.join(","), "false:aa2")
|
||||
ce_log = []
|
||||
|
||||
end
|
||||
@@ -540,6 +540,32 @@ class QtBinding_TestClass < TestBase
|
||||
|
||||
end
|
||||
|
||||
def test_44
|
||||
|
||||
# Ability to monitor native child objects
|
||||
|
||||
parent = RBA::QScrollArea::new
|
||||
child = parent.viewport
|
||||
|
||||
# ensure parent and child are working
|
||||
assert_equal(child.destroyed?, false)
|
||||
|
||||
parent.resize(200, 200)
|
||||
assert_equal(child.width() > 100, true)
|
||||
assert_equal(child.height() > 100, true)
|
||||
|
||||
parent.resize(100, 100)
|
||||
assert_equal(child.width() < 100, true)
|
||||
assert_equal(child.height() < 100, true)
|
||||
|
||||
# now if we delete the parent, the child needs to become disconnected
|
||||
|
||||
parent._destroy()
|
||||
assert_equal(parent.destroyed?, true)
|
||||
assert_equal(child.destroyed?, true)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
||||
Reference in New Issue
Block a user