aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2022-02-11 11:33:17 +0100
committerChristian Tismer <tismer@stackless.com>2022-02-11 15:21:44 +0100
commitd03776d6ef3dc0934e68b2bb7aa7260208592c3c (patch)
tree68a04e4097e566934e8113c86c7fac06305dbf96 /sources/pyside6/tests/QtCore/snake_prop_feature_test.py
parente330f659c47de880493f9bfd4ba2a000196d00bc (diff)
__feature__: Fix true_property overriding
It was assumed that an override of a property would not make any sense, and the feature was disabled. An example showed that it _does_ make sense, and this works without any effort. This does not fix other problems which are still there, like correct handling of renamed implicit function calls. This will be addressed in another change. [ChangeLog][PySide6] true_property overriding was enabled. Change-Id: Ic22f05c6c999e7f97c47161d95e785c952168bb6 Fixes: PYSIDE-1765 Pick-to: 6.2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/tests/QtCore/snake_prop_feature_test.py')
-rw-r--r--sources/pyside6/tests/QtCore/snake_prop_feature_test.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
index 92b1ff50c..754e853d5 100644
--- a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
+++ b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
@@ -46,7 +46,8 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6.QtWidgets import QApplication, QWidget
+from PySide6.QtCore import Property, QSize
+from PySide6.QtWidgets import QApplication, QMainWindow, QWidget
from PySide6.support import __feature__
"""
@@ -152,6 +153,25 @@ class FeatureTest(unittest.TestCase):
self.assertTrue(isinstance(UserClass.someFunc2, FunctionType))
self.assertTrue(isinstance(UserClass.add_action, MethodDescriptorType))
+ def testTrueProperyCanOverride(self):
+ from __feature__ import true_property
+
+ class CustomWidget(QWidget):
+ global prop_result
+ prop_result = None
+
+ @Property(QSize)
+ def minimumSizeHint(self):
+ global prop_result
+ print("called")
+ prop_result = super().minimumSizeHint
+ return prop_result
+
+ window = QMainWindow()
+ window.setCentralWidget(CustomWidget(window))
+ window.show()
+ self.assertTrue(isinstance(prop_result, QSize))
+
if __name__ == '__main__':
unittest.main()