mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-22 14:07:15 +02:00
Merge pull request #1369 from KLayout/issue-1357
Implemented fix for issue #1357 (RBA/pya binding for QObject#findChil…
This commit is contained in:
Vendored
+29
@@ -767,6 +767,35 @@ class QtBinding_TestClass < TestBase
|
||||
|
||||
end
|
||||
|
||||
def test_60
|
||||
|
||||
# findChild, findChildren
|
||||
|
||||
w = RBA::QWidget::new
|
||||
w.objectName = "w"
|
||||
w1 = RBA::QWidget::new(w)
|
||||
w1.objectName = "w1"
|
||||
w2 = RBA::QWidget::new(w1)
|
||||
w2.objectName = "w2"
|
||||
|
||||
assert_equal(w.findChild.objectName, "w1")
|
||||
assert_equal(w.findChild("w2").objectName, "w2")
|
||||
|
||||
assert_equal(w.findChildren().collect { |c| c.objectName }.join(","), "w1,w2")
|
||||
assert_equal(w.findChildren("w2").collect { |c| c.objectName }.join(","), "w2")
|
||||
|
||||
begin
|
||||
# Qt5++
|
||||
re_cls = RBA::QRegularExpression
|
||||
rescue => ex
|
||||
# Qt4
|
||||
re_cls = RBA::QRegExp
|
||||
end
|
||||
assert_equal(w.findChildren(re_cls::new("^.2$")).collect { |c| c.objectName }.join(","), "w2")
|
||||
assert_equal(w.findChildren(re_cls::new("^w.$")).collect { |c| c.objectName }.join(","), "w1,w2")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
||||
Reference in New Issue
Block a user