aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/samplebinding/enum_test.py
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6/tests: Use fully qualified enumerationsFriedemann Kleint2024-12-201-22/+25
| | | | | | | Pick-to: 6.8 Task-number: PYSIDE-1735 Change-Id: I5a907b536b36521eb6dd5fcdc1ad1094bb031aa8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer2024-06-201-0/+1
| | | | | | | | Add a future statement to all Python source files. Task-number: PYSIDE-2786 Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* shiboken tests/samplebinding: Fix flake8 warningsFriedemann Kleint2024-03-131-6/+6
| | | | | | | | | - Remove * imports - Remove a hidden test that was non-functional Pick-to: 6.6 6.5 Change-Id: I34c98ef81d0ebe11b0813670149c00cfcff4eb28 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Support running PySide on Python 3.12Christian Tismer2023-10-091-1/+1
| | | | | | | | | | | | | | | | | | Builtin types no longer have tp_dict set. We need to use PyType_GetDict, instead. This works without Limited API at the moment. With some great cheating, this works with Limited API, too. We emulate PyType_GetDict by tp_dict if that is not 0. Otherwise we create an empty dict. Some small changes to Exception handling and longer warm-up in leaking tests were found, too. Pick-to: 6.6 6.5 6.2 Task-number: PYSIDE-2230 Change-Id: I8a56de6208ec00979255b39b5784dfc9b4b92def Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyEnum: Remove the now unreachable test cases for old enumsChristian Tismer2023-06-191-45/+3
| | | | | | | Task-number: PYSIDE-1735 Change-Id: I51e68c50872f1d1254218ae7556ba607f73c4ea9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PyEnum: Update docs and rename the optionChristian Tismer2023-06-161-7/+7
| | | | | | | | | | | | | The new Enum implementation can no longer be switched off. Individual features can still be deselected with the environment variable PYSIDE6_OPTION_PYTHON_ENUM which had the name PYSIDE63_OPTION_PYTHON_ENUM before. This change is meant for PySide 6.6 . Task-number: PYSIDE-1735 Change-Id: Iae5b7a9d42a0d7b005dbba20201a80713ef79be9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Fix indirections of enums/flag argumentsFriedemann Kleint2022-10-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | The information about how arguments are converted (pointer indirections, etc.) was in CppGenerator::writePythonToCppTypeConversion() and partially duplicated in AbstractMetaType::shouldDereferenceArgument(), leading to discrepancies in the indirections generated for the function calls. To fix this, introduce a struct GeneratorArgument with type, conversion mode, indirections and a few flags storing this information and use that everywhere, replacing AbstractMetaType::shouldDereferenceArgument(). Pass the argument indirections obtained from writePythonToCppTypeConversion() via writeArgumentConversion() as a list into writeMethodCall(). Add a test for passing enums by pointer. Fixes: PYSIDE-2065 Change-Id: I495c2bc04ebc0162648d74b75e321609ecd00963 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PyEnum: Simplify the test-cases with the new forgiveness modeChristian Tismer2022-07-141-5/+6
| | | | | | | | | | | | | | | | | | | | | | With the new forgiveness, all the "normal" uses of old enums are working with the new enums, too. What does not work are range violations and inheritance of enums from other enums. Also, the implemented trick does not work for enums which do not belong to a class. The induced bugs are easy to find, because they should normally break at import time. [ChangeLog][PySide6] The new forgiveness mode of Python enums allows to use old enum code, most of the time. Much changed test code was reverted. Change-Id: I9c081831309f1b2358fe86e6107b0f4d78fd48cf Pick-to: 6.3 Task-number: PYSIDE-1735 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-271-29/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PyEnum: Prepare Enum tests for both old and new enumsChristian Tismer2022-05-221-4/+16
| | | | | | | | | | | | | | | | | | 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 <tismer@stackless.com>
* Switch from os.path to pathlib.Path, systematic test changesChristian Tismer2021-02-081-1/+2
| | | | | | | | | | | | | | | | | | This patch does the systematic changes on all tests. Note that there was a bug in principle: os.path was used without importing os.path This worked through the way how the os module initializes itself, but you always will find the explicit import in the python library. But the problem is going away anyway after the transition to pathlib.Path :) Change-Id: I95144d7f9bb07a38376c3aa428df663f2e64bcb7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Provide the correct inheritance for enum typesChristian Tismer2021-01-211-1/+14
| | | | | | | | | | | | | | | | | | | | | Originally, it was planned to follow a competitor and derive enums from int objects. But this was abandoned in favor of Python Enums. We therefore simply leave most code as it is and only insert a Shiboken::Enum class that accepts an optional integer. This class is published by shiboken with signature. Derived classes still have no signature themselves, but they all inherit from this known class Enum. This is intentional to avoid creating useless signatures for every derived Enum. A test was included. Change-Id: Ifaaea40a4ddf2337e565fb57e6a69b7cc9a6040f Fixes: PYSIDE-1347 Pick-to: 6.0 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-0/+178
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>