aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
Commit message (Collapse)AuthorAgeFilesLines
* Make standalone installations relocatableAlexandru Croitor2017-11-151-1/+1
| | | | | | | | | | | | | | | | | | This is achieved by registering a qt.conf file with a Prefix pointing to a directory relative to the loaded PySide2 module (e.g. QtCore). Thus Qt does not crash due to not finding platform plugins. Because this change would affect tests, which are ran before the PySide package is installed, a new environment variable called PYSIDE_DISABLE_INTERNAL_QT_CONF is introduced. This variable disables the registration of the internal qt.conf file, thus it will not point to a not yet created location, which will allow tests to run as before. Change-Id: I5a96037adfafe1f08ea57535aa4a2a0d1660dfaf Task-number: PYSIDE-558 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Remove QtCore::static_protected_methods_testFriedemann Kleint2017-11-142-60/+0
| | | | | | | | | The test calls QThread::sleep(), which was static protected in Qt 4, but is public in Qt 5. In addition, the test is flaky on macOS. Task-number: PYSIDE-431 Change-Id: Ie0faae785cda61937b3f20290f1dccbcb20bffda Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update and complete the signature moduleChristian Tismer2017-11-141-1/+15
| | | | | | | | | | | | | | | | | | | | | | | There is now an external typing module for Python 2.7 and Python 3.6 from Guido (PSF license again) that makes the differences between both versions vanish. Also, when generating interface files, some types did not show correctly, and the constant "0" is wrong in almost all cases. Values in signatures looked often bad since they have no nice __repr__, and it was almost impossible to create correct .pyi files. Now, these instances are created as wrapped string types with a nice __repr__. A call of these objects creates the real constant. This way, also objects can be rendered which are dependent from the existence of other objects (i.E. QPixMap). This patch improves the usability of the signature module. We can now generate source code or .pyi files without modifications. Task-number: PYSIDE-510 Change-Id: I55490d76a29fc6c0e4f821c0c77d5e5d1e28976e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove sys.path manipulations from testAlexandru Croitor2017-11-081-10/+6
| | | | | | | | The sys.path hack is no longer necessary because we pass a proper PYTHONPATH from the CMakeLists file to the test wrapper. Change-Id: Ie9ad8802e64cf7c9ffec16ae55777d5d23654662 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement proper void pointer (void*) supportAlexandru Croitor2017-11-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This change introduces a new type into the shiboken2 module which is imported by calling "import PySide2.support.VoidPtr". The type takes care of conversions from / to void* values in function signatures. Creating an instance can be done by passing either a shiboken wrapped object, or an integer representing an address, or a python object that implements the buffer interface. For example, this is useful for passing numpy arrays to C OpenGL functions that take void* parameters. First you convert the array into a bytestring (using numpy.array.tobytes(), then you instantiate a VoidPtr from that bytestring, and finally you pass it along to a GL function. One corner case that is currently not supported is void** parameters. Change-Id: I01e291d6856cb6bd8b5175adc3ead6b728036535 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Support the qApp macro correctly, final version incl. debugChristian Tismer2017-10-272-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For short the new features: - there is a qApp in QtCore, QtGui and QtWidgets for compatibility, and also in __builtins__ for a true macro-like experience. - if you delete any qApp variable, the Q*Application is reset and you can start over. Long description: There is a qApp macro in Qt5 which is equivalent to Q*Application.instance() . Python does not have macros. Both PyQt5 and PySide2 have an according structure in QtWidgets. In the case of PySide2, the qApp variable is first initialized to None and later to QApplication(). This does not reflect the original sense of the qApp macro, because - it only handles QApplication, - it does not handle destruction. This "macro" should live in QtCore, but both PyQt5 and PySide2 decided to put this in QtWidgets. As a compromize, I propose to put qApp into all three modules, and into __builtins__ as well, so wherever you create an application, you find this "macro" in place. While changing the code, I stumbled over the template set_qapp_parent_for_orphan. I tried to make sense out of it and finally removed it. There were no side effects but bug PYSIDE-85 is gone, now. With some extra effort, I created a singleton qApp that changes itself. This way, a true macro was simulated. Note that this was not possible with a garbage collected variable, and I had to make shiboken aware of this. As the final optimization, I turned qApp also into a fuse variable: Delete any qApp variable and Q*Application will finish when there is no extra reference. Task-number: PYSIDE-85 Task-number: PYSIDE-571 Change-Id: I7a56b19858f63349c98b95778759a6a6de856938 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Stabilize QtQml/bug_847.pyFriedemann Kleint2017-10-271-1/+8
| | | | | | | | | Add more checks for QML loading. Wait until the window is exposed until starting the safety timer and increase its interval. Task-number: PYSIDE-431 Change-Id: I6225f2357d9576be15c6134d26982939698a9984 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Signature: Improve error reportingChristian Tismer2017-09-251-4/+7
| | | | | | | | | | | | It is likely that with Qt 5.9 we get new signature text that is not recognized. This becomes a problem because COIN takes much time. This patch does not stop on the first parser error, but collects all warnings and raises an error at the end. Task-number: PYSIDE-510 Change-Id: I898e0a7a59e8313c115d7ce8160908bf85d4140c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement introspection with __signature__ packageChristian Tismer2017-09-202-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature module was turned into a package under 'PySide2/support/signature'. The package is completely isolated so that nothing is leaking into the normal import machinery. The package is also not initialized unless a __signature__ attribute is accessed. The only change to Python during a PySide run is the existence of the __signature__ attribute. As a side effect, all tests run at the same speed as before this extension. The module does not actively import PySide modules. Instead, it inspects sys.modules and reloads its mapping.py if needed. Example usage: >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ The module has been thoroughly tested on macOS. I consider this ready. Task-number: PYSIDE-510 Change-Id: Ibb231a7fbb4ccc1a7249df55e3881a4e21a19c0d Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add QTimeZoneFriedemann Kleint2017-08-022-0/+44
| | | | | | Task-number: PYSIDE-487 Change-Id: I9a2c19c6b8415e3f608531b315a6841eb3de55f5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Stabilize QtWidgets bug_728.pyFriedemann Kleint2017-07-271-1/+16
| | | | | | | | | | Add a timer periodically checking for the dialog to appear and close it via reject() instead of using a hardcoded interval to quit the application, which can cause crashes. Task-number: PYSIDE-431 Change-Id: I35db1db5f6865d196f8565c7bd034de2162bf4ff Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* audio_test.py: Use QGuiApplicationFriedemann Kleint2017-07-201-1/+2
| | | | | | | | On Windows, the WASAPI audio plugin is used, which requires CoInitialize() and hence QGuiApplication. Change-Id: Iad045224b6153a08234ff69e69eb8d1986654b43 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* helper: Add UsesQGuiApplicationFriedemann Kleint2017-07-201-14/+25
| | | | | | | Add helper for testing with QGuiApplication. Change-Id: Ib56b0b118a5fe8e01c822c859419784921418913 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix Windows module extensions and tests to work with --debug buildAlexandru Croitor2017-07-121-1/+1
| | | | | | | | | | | | | | | | | | Use the same imp.get_suffixes() mechanism as on Unix, to determine the suffix part of module extension files. This fixes debug builds to work on Windows. Note that the whole build stack has to use the same configuration, no mixing is allowed on Windows. For release build you need: python.exe + setup.py without --debug flag + release build of Qt5. For debug build you need: python_d.exe + setup.py with --debug flag + debug build of Qt5. Change-Id: I6188c859b5757d11e87d6a9e32b9ba558f7f609e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Improve suffix names for shared libraries and cmake config filesAlexandru Croitor2017-07-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This change decouples the naming of general shared libraries, python module extensions, and cmake configuration files. All of them are now computed depending on the python version and python build configuration, and can also be manually set via CMake variables. The module extensions names now use the most detailed 'import' prefix, which usually informs whether a debug or release python was used, or the Python ABI flags (for Python >= 3.2). When a debug Python interpreter is used for building PySide2, the preprocessor define Py_Debug is now correctly propagated to PySide2 sources, which fixes previous crashes in debug builds. This affects only Linux and macOS builds. There is a subsequent change for making it work for Windows builds. All in all, this now allows proper mixing of debug / release versions of the Python interpreter with debug / release versions of PySide2 on Linux and macOS. Task-number: PYSIDE-508 Change-Id: I88a05c3ada0fb32c7c29bdb86d7a2c15acc963b8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Simplify the test for loading modulesChristian Tismer2017-07-1026-489/+27
| | | | | | | | | | Some time ago, I added the test file that makes sure that all modules can load. This file needed to repeat for each module without any other tests. Now we have a real "PySide2.__all__" variable, and we can remove these tests in favor of one simple test. Change-Id: I96d91e749c134f30afc30751abb874ede2639d10 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Silence some build warnings when building pysidetestAlexandru Croitor2017-06-231-0/+3
| | | | | | Change-Id: I91a1c87e6153a65a6e4088a41fbe0f696c2dd058 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove incorrect dependency in pysidetest targetAlexandru Croitor2017-06-231-1/+1
| | | | | | | | | | | Even though the final library name is libpyside, the actual target that generates that file is called pyside2, as indicated by the project(pyside2) command in the CMakeLists.txt file. Also set the CMake policy of not ignoring incorrect dependencies. Change-Id: Iba65dfd5fe7e34e7557c756a838017fe48f0ffd5 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* pysidetest_delegatecreateseditor_test: Add QtWidgets dependencyFriedemann Kleint2017-06-022-2/+2
| | | | | | | | | | | The test was failing since the method TestView::setItemDelegate(QAbstractItemDelegate *) was rejected due to QAbstractItemDelegate being unknown. Fix by adding the dependency to QtWidgets. Task-number: PYSIDE-431 Change-Id: I65c3690eccfdd55b310f45d65a2b0d8c32bedd36 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Use Q_SLOTS instead of slotsFriedemann Kleint2017-06-021-1/+1
| | | | | | | | | When mixing Python and C++, Qt needs to be used with 'CONFIG += no_keywords' to suppress the 'slots' macro definition, which clashes with a Python header. Task-number: PYSIDE-526 Change-Id: I4feeae2de21db712b4de6653e243d556623436a1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix typos in licensesFriedemann Kleint2017-05-3016-48/+48
| | | | | Change-Id: I781418f8747d51a0d329c0562e076600989b3768 Reviewed-by: Christian Tismer <tismer@stackless.com>
* move everying into sources/pyside2Oswald Buddenhagen2017-05-22565-0/+39205
in preparation for a subtree merge. this should not be necessary to do in a separate commit, but git is a tad stupid about following history correctly without it.