aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-27 15:36:24 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-28 10:10:43 +0000
commita5d4a71d32d1b2a095119351a0935c49f3ac0a50 (patch)
treee1de37493a9d0394500c6ab5c2976d7959e42229 /sources/pyside2/tests
parent0a70c8485771ae8cc62faaa775b1db2a5dbd95ef (diff)
QApplication::setStyle ownership transfer
Due to the nature of the qApp singleton, it was not enough to add the refcount of the style via the typesystem, as usual. An additional step of getting a reference to the qApp to set the parent of the style was required. A test case was included. Change-Id: I5e60983e961e7d3d310b1e1c2f6f9b80ee095308 Fixes: PYSIDE-861 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/QtWidgets/qstyle_test.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtWidgets/qstyle_test.py b/sources/pyside2/tests/QtWidgets/qstyle_test.py
index eb2a73d29..1dcce2737 100644
--- a/sources/pyside2/tests/QtWidgets/qstyle_test.py
+++ b/sources/pyside2/tests/QtWidgets/qstyle_test.py
@@ -26,6 +26,7 @@
##
#############################################################################
+import sys
import unittest
from helper import UsesQApplication
@@ -78,6 +79,13 @@ class SetStyleTest(UsesQApplication):
QApplication.instance().processEvents()
self.assertTrue(proxyStyle.polished > 0)
+ def testSetStyleOwnership(self):
+ style = QStyleFactory.create(QStyleFactory.keys()[0])
+ self.assertEqual(sys.getrefcount(style), 2)
+ QApplication.instance().setStyle(style)
+ self.assertEqual(sys.getrefcount(style), 3)
+
+
if __name__ == '__main__':
unittest.main()