aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtGui
diff options
context:
space:
mode:
authorChristian Tismer <[email protected]>2022-04-10 17:22:14 +0200
committerChristian Tismer <[email protected]>2022-05-22 19:27:43 +0200
commit4362ded78ae459265c1e6b7cf562d5cdad382003 (patch)
treeb76145748f01064b76021bbcac526e36bd6006db /sources/pyside6/tests/QtGui
parent37b5b3e2db07d4256aa17376d231a76ea3c393cd (diff)
PyEnum: Prepare Enum tests for both old and new enums
These tests are now completely identical to the old tests and have an adapted Python Enum version if suitable. Both versions can be selected once at runtime. Having both test versions available as a runtime option is a nice feature that really helps understanding the consequences of the PyEnum move. [ChangeLog][PySide6] The QEnum tests are enabled for both the old Qt Enums and the new Python Enums. Change-Id: I78a7473f4a86f8d2115acc56e4ed11cf135eb000 Pick-to: 6.3 Task-number: PYSIDE-1735 Reviewed-by: Christian Tismer <[email protected]>
Diffstat (limited to 'sources/pyside6/tests/QtGui')
-rw-r--r--sources/pyside6/tests/QtGui/bug_617.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/sources/pyside6/tests/QtGui/bug_617.py b/sources/pyside6/tests/QtGui/bug_617.py
index d917745be..36ad2b8ed 100644
--- a/sources/pyside6/tests/QtGui/bug_617.py
+++ b/sources/pyside6/tests/QtGui/bug_617.py
@@ -41,7 +41,12 @@ from PySide6.QtGui import QColor
class MyEvent(QEvent):
def __init__(self):
- QEvent.__init__(self, QEvent.Type(999))
+ if sys.pyside63_option_python_enum:
+ # PYSIDE-1735: Python Enum: We cannot assign arbitrary numbers.
+ # They must exist as constants in the type.
+ QEvent.__init__(self, QEvent.Type(1000))
+ else:
+ QEvent.__init__(self, QEvent.Type(999))
class Bug617(unittest.TestCase):
@@ -52,7 +57,8 @@ class Bug617(unittest.TestCase):
def testOutOfBounds(self):
e = MyEvent()
- self.assertEqual(repr(e.type()), 'PySide6.QtCore.QEvent.Type(999)')
+ self.assertEqual(repr(e.type()), "<Type.User: 1000>"
+ if sys.pyside63_option_python_enum else "PySide6.QtCore.QEvent.Type(999)")
if __name__ == "__main__":