aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@wingware.com>2013-05-27 21:53:02 -0400
committerJohn Cummings <jcummings2@users.sf.net>2013-06-13 17:02:44 +0200
commit709f98d254efde9f98476913e79ea02fd88cd7c2 (patch)
tree729ec10d0efa832a2d0da17e32d164e68c21cd57 /tests
parent45268bd0ad5a6569adad2e529574d7bf536d0bff (diff)
Prevent infinite recursion in invalidate
Change-Id: I8946a8572b608bf8ede211d270f797f135f8083a Reviewed-by: John Cummings <jcummings2@users.sf.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/libsample/objecttype.h4
-rw-r--r--tests/samplebinding/objecttype_test.py8
-rw-r--r--tests/samplebinding/typesystem_sample.xml5
3 files changed, 17 insertions, 0 deletions
diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h
index 18c5038a7..6c6b5ecbe 100644
--- a/tests/libsample/objecttype.h
+++ b/tests/libsample/objecttype.h
@@ -125,6 +125,10 @@ public:
//Deprecated test
bool deprecatedFunction() { return true; }
+ // nextInFocusChain simply returns the parent to test object cycles; the parent
+ // may be returned by the QWidget's implementation but isn't always returned
+ ObjectType* nextInFocusChain() { return m_parent; }
+
private:
ObjectType(const ObjectType&);
ObjectType& operator=(const ObjectType&);
diff --git a/tests/samplebinding/objecttype_test.py b/tests/samplebinding/objecttype_test.py
index d83e9b084..6e24ba9db 100644
--- a/tests/samplebinding/objecttype_test.py
+++ b/tests/samplebinding/objecttype_test.py
@@ -30,6 +30,7 @@ import unittest
import sys
from sample import ObjectType, Str
+import shiboken
class ObjectTypeTest(unittest.TestCase):
@@ -78,6 +79,13 @@ class ObjectTypeTest(unittest.TestCase):
o.destroyCppParent()
self.assertEqual(sys.getrefcount(o), 2)
+ def testNextInFocusChainCycle(self):
+ parent = ObjectType()
+ child = ObjectType(parent)
+ next_focus = child.nextInFocusChain()
+
+ shiboken.invalidate(parent)
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 0a9a764ee..813e0a09e 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -732,6 +732,11 @@
<define-ownership owner="c++" />
</modify-argument>
</modify-function>
+ <modify-function signature="nextInFocusChain()">
+ <modify-argument index="return">
+ <parent index="this" action="add"/>
+ </modify-argument>
+ </modify-function>
</object-type>
<object-type name="OtherBase" />