aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
Commit message (Collapse)AuthorAgeFilesLines
* Rename PySide2 to PySide6Friedemann Kleint2020-11-02619-197412/+0
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>
* replace **locals by f-strings where possibleChristian Tismer2020-11-022-15/+13
| | | | | | | | | This change affects mostly only my own sources which were prepared for the migration to Python 3.6 . Task-number: PYSIDE-904 Change-Id: I0c2cd59f6f625f51f876099c33005ac70ca39db9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-288-20/+20
| | | | | | | | 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>
* remove traces of Python2 from Python codeChristian Tismer2020-10-278-31/+8
| | | | | | | | | | | | It will be assumed that Python is always Python 3. All checks for Python 2 are removed. This is the first part of cleaning up the Python code. We will then also clean the C code. Task-number: PYSIDE-904 Change-Id: I06050a8c1a18a19583f551b61775833a91673f4e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* feature-select: implement class propertiesChristian Tismer2020-10-271-1/+18
| | | | | | | | | | | | | | | | | | | After implementing property objects for PySide, the static properties (properties for static functions) were quite missing, for instance from QtCore.QCoreApplication and QtWidgets.QApplication . This implementation uses the normal Python properties and derives a PySide.ClassProperty class which works almost the same on classes. The static methods had to be mutated to class methods explicitly. That would be automated by PyType_Ready, but here we are doing this after class initialization. Task-number: PYSIDE-1019 Change-Id: Iabe00be18e25881cc7a97507b6fdae3e2d57ff7a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Fix deprecation warnings about constructing a QVariant from a type idFriedemann Kleint2020-10-271-1/+1
| | | | | | | | | Build the QVariant from the QMetaType, fixing warning like: libpyside/pysidemetafunction.cpp:186:64: warning: ‘Type’ is deprecated: Use QMetaType::Type instead. [-Wdeprecated-declarations] /libpyside/pysidemetafunction.cpp:186:77: warning: ‘QVariant::QVariant(QVariant::Type)’ is deprecated: Use the constructor taking a QMetaType instead. [-Wdeprecated-declarations] Change-Id: I5c9c4d775ef58ecf17326c112c5130c43fe1a09b Reviewed-by: Christian Tismer <tismer@stackless.com>
* QtQml: Implement QmlElementMaximilian Goldstein2020-10-221-4/+6
| | | | | | | | Equivalent to QML_ELEMENT in C++, this enables users to register classes for use in QML by using the QmlElement decorator. Change-Id: I697e486ef58b18cce4c310e4b556e28735a16d45 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-143-1/+236
|\ | | | | | | Change-Id: I46f5d2dc758d0e1f23377c91ba7496793461771e
| * property_python_test.py: Restrict exceptFriedemann Kleint2020-10-131-1/+1
| | | | | | | | | | | | | | | | | | Catch ImportError when trying to import support from test. Amends d3883e9186892e673e8a66ad6651409d5eaf7cf3. Task-number: PYSIDE-1402 Change-Id: I9fc77f6311596f1e52872d5ffbb491e01c207b73 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Update QtCore.Property to the current standardChristian Tismer2020-10-123-1/+236
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WAS: Feature-select: Use QtCore.Property instead of Python's property When successfully trying to use QtCore.Property for feature-select's property, I suddenly realized that the implementation only works with QtCore derived classes. This is the reworked version of Property that behaves correctly. The exhaustive Python test was adapted and is used to check the full compatibility of this implementation. In a later update, this implementation might be changed to no longer be restricted to QObject. Change-Id: If87b7b633a2c45e23a15c4d956f63e21d33af3dd Task-number: PYSIDE-1402 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Fix some testsFriedemann Kleint2020-10-062-34/+15
| | | | | | | | | | | | | | | | | | | | - QOpenGLBuffer has been moved to QtOpenGL - QPrinter no longer has API for the margins taking tuples Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I8cc6661f754f0cda3fecc56a9a7243f7501e56b9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-065-0/+101
|\| | | | | | | Change-Id: I89aa3d4c4a3fa274e2c5ccd8b5facb9531137e80
| * Generate flags operator methods for QFlags on hidden top level namespaceRenato Araujo Oliveira Filho2020-10-065-0/+101
| | | | | | | | | | | | | | | | | | | | Factor out method to write the operator functions and call it for the module wrapper, too. Fixes: PYSIDE-1326 Change-Id: I5b6faf19d253d5828474dec36b454aa20753123c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-067-32/+80
|\| | | | | | | Change-Id: I7b4ff138799ee81940c36e68a105cb42bb38a3ff
| * Move the annotations for parsing Qt-based headers to shiboken2Friedemann Kleint2020-10-021-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is one of the lesser known things that any project generating bindings for Qt-based code needs to include pyside2_global.h in order for signals, slots and properties to be recognized, since the annotation macro definitions are in this file. Move the definitions over to shiboken2 to remove the need to include it. [ChangeLog][shiboken2] Projects generating bindings for Qt-based code no longer need to include pyside2_global.h. Change-Id: I531bb7444561ccfc352f3be09ecdf854f9f7dd3d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Consolidate export/import macrosFriedemann Kleint2020-10-017-31/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the 3 libraries that need to export symbols, (libshiboken, libpyside, pysidetest), fix up the export/import macros to follow the Qt convention: - Define generic export/import macros LIBSHIBOKEN_EX/IMPORT equivalent to Q_DECL_EX/IMPORT. Remove definitions for the ancient g++ 4.X. - Reuse those in libpyside, pysidetest as PYSIDE_EX/IMPORT and PYSIDETEST_EX/IMPORT. - While building, define some BUILD_ macro indicating export. - Define the _API macros depending on the BUILD_ macro to be export or import, respectively as is done in Qt. Remove the ugly hack in pysidetest that tried to re-use the PYSIDE_API macro. - Brush up the headers a bit. Change-Id: I635891b7eec5a52a1dcf45022f7bfb6a9cfee83f Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Adapt to recent changes in qtbaseFriedemann Kleint2020-10-023-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove QProcess::pid(), adapt test (qtbase/0f8848b7e25e4d8fb9265ff6e0aa31946addd741) - Remove enum from QPrinter - Add enum GrabTransition to QPointingDevice - Remove deprecated functions from QByteArray, QXmlStreamAttributes - Adapt Qml tests - Remove fake property from QLayout Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I98cc90723cbeda15b23c5b22d026cb2ab9a358ff Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Fix QBitArray-related tests of QDataStreamFriedemann Kleint2020-10-021-55/+19
| | | | | | | | | | | | | | | | | | | | | | | | The tests were relying on the serialized format of QBitArray in Qt 5, which has changed in Qt 6. Introduce a helper function to create the serialized format and use that. Remove the corrupted data test since it could not be recreated. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I6331c96e5b4d6657a515b82db77f2c5c5da62d71 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Add QStringView/QByteArrayViewFriedemann Kleint2020-09-302-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | View types as function parameters cannot be converted in the standard way shiboken does it: QStringView cppArg0; pythonToCpp(pyArg, &cppArg0); since they reference some other data. Introduce a new "viewOn" member to type system entry for them. It causes the function arguments to be replaced by their viewed-on types (stringview->string) via metatype. Add a test in libsample and a test for QUuid::fromString(QStringView). Test returning QStringView via QRegularExpressionMatch::capturedView(). Task-number: QTBUG-84319 Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Task-number: PYSIDE-487 Change-Id: Iddb4ea268a54928d290e29012e2738772fae83f0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-241-2/+3
|\| | | | | | | Change-Id: I7e4c7f9378706438715362b1e2da9a3cd2794562
| * Add QColorConstants namespaceCristián Maureira-Fredes2020-09-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | The colors inside the namespace are defined: constexpr Q_DECL_UNUSED QColor Black {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101}; Fixes: PYSIDE-1224 Change-Id: I84ba5fae74e336ab01b3bac467c8fc6e2b45d14b Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-222-0/+88
|\| | | | | | | Change-Id: Id0fc76666bbdb254a833eeb6909a0874b2611bf3
| * signal: Supply the missing __get__ methodChristian Tismer2020-09-212-0/+88
| | | | | | | | | | | | | | | | | | The `__get__` method gets created by `PyType_Ready` when the slot `tp_descr_get` is set in the signal class. Change-Id: Id853c59546c0382afeda837f0abfd596b6ca5c7f Fixes: PYSIDE-68 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-211-18/+20
|\| | | | | | | Change-Id: Ia31df23a16575f9ecefe13ec85fb70197d103278
| * Fix crash when overriding QUiLoader::createWidget() in QUiLoaderFriedemann Kleint2020-09-171-0/+16
| | | | | | | | | | | | | | | | | | Mark the returned objects of the create functions in native (wrapper code) as owned by C++. Fixes: PYSIDE-1070 Change-Id: I8774f2f0c9adafc73e0d969384e4c0357b7c896d Reviewed-by: Christian Tismer <tismer@stackless.com>
| * uiloader_test.py: Remove unused/duplicated codeFriedemann Kleint2020-09-171-20/+6
| | | | | | | | | | | | | | | | | | Remove remains of some old test apparently testing UTF-8 paths which was identical to the existing testLoadFile(). Task-number: PYSIDE-1070 Change-Id: I50912996272a407654f070854523729ba4220b48 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Adapt to changes in qtbaseFriedemann Kleint2020-09-182-71/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Renamed QIconEngine::AvailableSizesArgument to ScaledPixmapArgument - Remove XML/SAX classes after qtbase/79e0374143ab385cb12a17443e91c8eb9d2f3a4b - Adapt quick type registering to changes in QMetaTypeInterface qtbase/92b37676328a960bc092b1f3834233c550376457 Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Task-number: QTBUG-86480 Change-Id: Ibff2bddbf040bb25fb85ca3c0845608b2bca1e7e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-175-21/+161
|\| | | | | | | Change-Id: I8aa48d07067c45c888c73af87314f6a88c2a6e14
| * feature_select: Implement True PropertiesChristian Tismer2020-09-163-21/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature is now almost fully implemented. TODO: Static properties like `QtWidgets.QApplication.platformName` are skipped for now. They need support by the meta class. Maybe this is a reason to use QtCore.Property instead of vanilla Python property and improve it. With the new infrastructure, we can also consider to add properties which have no equivalent in the Qt implementation. A prominent example is "central_widget". Change-Id: Ia0e32e41de8ab72e3bba74878e61bcbac6da50ea Task-number: PYSIDE-1019 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Fix slots being invoked from the wrong threadFriedemann Kleint2020-09-162-0/+107
| | | | | | | | | | | | | | | | | | | | In case the signal connections are routed via some GlobalReceiverV2 instance, it needs to be moved to the receiver's thread. Fixes: PYSIDE-1354 Change-Id: I85926efeab157e47ec42a830fda024d299807786 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-102-0/+75
|\| | | | | | | Change-Id: I8a627fd459c3f9601d078a00d3d77c8b3fe04304
| * Implement default __ne__ and __eq__ for all PySide typesAlex Hughes2020-09-082-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PySide types have been following the Qt implementation of comparisons, completely. This is not correct for Python, because the Python default has the operators `==` and `!=` at least. They are needed for tests like `obj in collection`. We fix this by redirecting the default case to `PyBaseObject_Type.tp_richcompare`. This is the correct way to fix it, because for types which do not define `tp_richcompare', this is the default, anyway. From the original patch, the test case is still in use. Old message: Implement __ne__ and __eq__ for QTreeWidgetItem Testing if a QTreeWidgetItem belongs to a list raises a NotImplementedError. I have exposed the operator== and the operator!= from C++ to shiboken which has solved our eq operator issue. Implemented the test from PYSIDE-74 for the QTreeWidgetItem eq operator and the ne operator. This also allows us to have the behavior "QTreeWidgetItem in ['a']" and "QTreeWidgetItem not in ['a']". Adding qtreewidgetitem_test.py to CMakeFiles.txt Fixes: PYSIDE-74 Change-Id: Id221c0163fc8c2d85730c4c26f22db5f61710706 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Further cleanup of CMakeListsFriedemann Kleint2020-09-041-50/+46
| | | | | | | | | | | | | | | | | | | | Remove some remains of Python2 and Qt 5 and some unused options. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Ic9c7d4048b6be0cdeb0f5cc9b23d13b1702f1bdc Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Fix some testsFriedemann Kleint2020-09-043-83/+0
| | | | | | | | | | | | | | | | | | | | | | - Remove widget test using QSignalTransition and QStateMachine - Remove QKeySequence from repr test; it is not guaranteed that eval(repr()) constructs a value Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I0de17ce1fa40cf7a7e9ba35d6a413084ad5eca52 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-041-1/+2
|\| | | | | | | Change-Id: Ib1d2c1b76a043526e8f715e45296104cad085a4a
| * Fix up qprocess_test.pyFriedemann Kleint2020-09-031-1/+2
| | | | | | | | | | | | | | | | | | | | Fix deprecated API and wait for the process to finish, fixing: DeprecationWarning: QProcess.start(const QString & command, QFlags<QIODevice::OpenModeFlag> mode) is deprecated p.start("dir") QProcess: Destroyed while process ("dir") is still running. Change-Id: Ib1705c9723fa1e72ea650d6f541506b62487aff7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Bump cmake version to 3.16Friedemann Kleint2020-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | Streamline the features list handling in the module CMakeLists to use the list functionality introduced in cmake 3.3. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I184034cae408c815bd80a09016a21fde2969449e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Remove QtScript, QtXmlPatternsFriedemann Kleint2020-09-0410-461/+0
| | | | | | | | | | | | | | | | | | They are obsolete in Qt 6. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I70816b3c3270a1db65ad3b3871a09c62d31420e5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Remove Python2 from PySide2 testsFriedemann Kleint2020-09-0444-461/+239
| | | | | | | | | | | | | | Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Idc6c185c0c848476a60d91b802af760fc2b70a30 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Adapt to recent Qt 6 changesFriedemann Kleint2020-09-018-421/+4
| | | | | | | | | | | | | | | | | | | | - Removal of the statemachine framework from QtCore - Addition of QAbstractFileIconProvider - Adapt some signatures - QMetaType deprecations Change-Id: Ia51354542ad1d2f0bb5530e45ebef0d6ccdb633d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | QtQml: Improve ListPropertyMaximilian Goldstein2020-08-262-0/+82
| | | | | | | | | | | | | | | | | | * Support new methods * Do more type checking * Avoids segfaults when calling unimplemented methods Change-Id: Id0cfbc2f9a79c0f916db0bb9e950d707dc5da478 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | QtQml: Move uncreatable type test into separate fileMaximilian Goldstein2020-08-264-36/+84
| | | | | | | | | | Change-Id: I01b052ffa85543d5779a87a331c78f77a6529e95 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Tests: Add registersingletontype.py to list of testsMaximilian Goldstein2020-08-191-0/+1
| | | | | | | | | | Change-Id: I8b3925ceab632b0d5e0e5511ab6a86df594f96b0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Test/QtQml: Fix registertype.pyMaximilian Goldstein2020-08-191-1/+1
| | | | | | | | | | Change-Id: Ib82cac47882220c53f688e53c9cf6429b9fa138a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-08-192-9/+13
|\| | | | | | | Change-Id: I8f58e0ed19ad967366cf647eacd8b3d737d8b56a
| * Port some tests away from deprecated APIFriedemann Kleint2020-08-182-9/+13
| | | | | | | | | | | | | | | | | | | | | | Use QRandomGenerator instead of deprecated qsrand() and remove usage of deprecated QPolygonF constructor taking the size. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Ic4b773772555716636f5dfec797052a945d431cd Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Remove QtWidgets test bug_714.pyFriedemann Kleint2020-08-182-61/+0
| | | | | | | | | | | | | | | | | | | | | | | | The test was checking reference counts on the pixmaps returned by QPixmap *QLabel::pixmap() in 5.15, which was changed to return the QPixmap by value in Qt 6. The check does not make sense anymore and the equality check at the bottom would fail. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I6d29a0417d5fa574da5eb825f0944f6700ef810c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Fix QLineF-testFriedemann Kleint2020-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | Fix signature of QLineF::intersects(). Amends 3e252bba6ea6b96acb412d08131953e74d2b84ee. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Ia299e608941d2a243e24bed780d50e5edb655d0f Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-08-171-4/+5
|\| | | | | | | Change-Id: Icee2cd5a37181070d8ef50e7143868d4f126cea5
| * feature-select: optimize feature access to the feasible maximumChristian Tismer2020-07-311-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ** fix: MSVC needs extra sign bit in basewrapper_p.h! Buglet? ** The new feature selection has some tiny overhead. It is about two dict accesses plus a slot access for every tp_(get|set)attro call. The introduction of an explicit `__init_feature__` call allows to optimize this overhead very nicely, because this init is done for each __feature__ import: First, we can remove that tiny overhead completely by not initializing the feature_select module at all if no __feature__ import is used. Second, we can optimize this access further by caching the current module dict. If the dict is unchanged, then the last select_id can be used. This reduces the overhead of frequent calls to a single slot access. Third, we finally cache the select id in unused SbkObjectType bits. That removes the last structure where repeated attribute lookup is used. The overhead is therefore quite small when something is changed. But typically these changes are infrequent. The majority of accesses do change nothing, and this case is now quite much optimized. Change-Id: I7d1a4611a1c19216fd9be8f04457bb18ebd52ab1 Reviewed-by: Christian Tismer <tismer@stackless.com>