aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/QtCore
Commit message (Collapse)AuthorAgeFilesLines
* Remove Py_TPFLAGS_HAVE_VERSION_TAG in Python 3Boxiang Sun2018-07-052-0/+66
| | | | | | | | | | | | | The Py_TPFLAGS_DEFAULT in Python 3 has the Py_TPFLAGS_HAVE_VERSION_TAG flag, which causes the type attribute cache in _PyType_Lookup. According to the Shiboken implementation for Python 2, this is not we expected. So remove the Py_TPFLAGS_HAVE_VERSION_TAG flag from Py_TPFLAGS_DEFAULT in Python 3. Task-number: PYSIDE-60 Change-Id: Id731a59b65640eb5adea56fe06e0deb58ac4a168 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add test for "Segfault when emitting string with emoji"Christian Tismer2018-07-042-0/+79
| | | | | | | | | | | | | The used constant was encoded directly as a unicode literal. This was the same possible in Python 2 and 3 due to https://www.python.org/dev/peps/pep-0414/ . Note that the emoji character creates a 1 or 2 codepoints long constant because Python 2 can be built with UCS-4 or UCS-2. Task-number: PYSIDE-336 Change-Id: Icc7ea664cf64f9e53ef5f7696c56c6470f7ada4a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement proper slice assignment for QByteArrayBoxiang Sun2018-07-021-40/+85
| | | | | | | | | | | | | | | | | | | Index assignment now only accept str/bytes, bytearray, QByteArray with size 1; Slice assignment only accept str/bytes, bytearray, QByteArray with limitation, that is if the step is not 1, then the number slots and the size of the target value must be equal. Range delete: a[2:5] = None Shrink: value length smaller than the slot length of the slice Expanse: value length bigger than the slot length of the slice Range assignment with step: a[2:5:1] = ... Range assignment with step which bigger than 1: a[2:9:2] = ... Range assignment with native step: a[5:2:-1] Change-Id: Ib9b929d09a691ed18c91e0c1c6b5dde827bf8d42 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix failing versioninfo_test when the version is not a pre-release oneAlexandru Croitor2018-06-081-1/+1
| | | | | | | | | | | | The test used to fail when pre-release version parts are empty (aka there is no "beta1" or "alpha2"). Make sure to always include at least an empty string when those version parts are not set, and adjust the test accordintly to check for a string. Change-Id: Ia30bb99de7f122456e132516346df4e3c0a1fa94 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge branch '5.9' into 5.11Alexandru Croitor2018-06-0714-128/+138
|\ | | | | | | Change-Id: I2de0fe8456fca242c56ea28520126f9ebbf540d8
| * Improve the QByteArray implementationBoxiang Sun2018-06-0114-132/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The available constructors for QByteArray are now: bytes, bytearray, and QByteArray, unicode is not accepted anymore. Also the concatenation is now possible between QByteArrays. Even though is not possible to initialize a QByteArray with an unicode, we include the possibility to compare it with one (Compatibility with PyQt). The __repr__ and __str__ are now properly working. There seemed to be a confusion regarding data types between Shiboken, Python2 and Python3 related to bytes, so now the structure is based on the flag SBK_BYTES_NAME, which is define as "bytes" for Python3 and "str" for Python2. Many tests were modified to properly handle string, using the `py3kcompat` module. Task-number: PYSIDE-232 Change-Id: I8b671f367c60a0870c72dcbe5662106b3225037d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * Improve sbkstring::toCString to support unicodeBoxiang Sun2018-06-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | If `unicode` is used in Python 2, shiboken cannot properly translate it to `const char *`. sbkstring did not supported a proper conversion of unicode types in Python2, and this change includes it. Task-number: PYSIDE-100 Change-Id: I3a70d935ad61b0e567e620c62754800370270a6b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.11Friedemann Kleint2018-06-011-4/+4
|\| | | | | | | Change-Id: I31a0ff26bc02e6cc2ec2a816c16d170fc334f800
| * Fix test to assert only if english is the localeCristian Maureira-Fredes2018-06-011-4/+4
| | | | | | | | | | | | Change-Id: I3188c33414d283478a6ff6d7d354ce9231b4f106 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.11Friedemann Kleint2018-05-188-1/+263
|\| | | | | | | Change-Id: I20cf741f5b07426ad5113eb8c52f144102c331ce
| * Add default parameter to Q*ApplicationsCristian Maureira-Fredes2018-05-152-0/+41
| | | | | | | | | | | | | | | | | | | | | | When no arguments are passed, build an empty list and to start a QCoreApplication, QApplication and QGuiApplication. This is a small effort to include the idea of a default parameter from Python. Change-Id: Ieedc1e7ee17de996778aa2d0bddfb88c5ef208cf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Change license from last filesCristian Maureira-Fredes2018-05-141-1/+1
| | | | | | | | | | | | | | | | Just renaming PySide2 -> Qt for Python for these files that somehow got excluded when renaming the whole project. Change-Id: Id6dfbae1ab3bd603f1db5e0346664004102fd19f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * Add more QtCore classesFriedemann Kleint2018-05-116-1/+162
| | | | | | | | | | | | | | | | | | Add QIdentityProxyModel, QLockFile, QMessageAuthenticationCode, OperatingSystemVersion and QSignalBlocker. Task-number: PYSIDE-487 Change-Id: I680c3d175394e9d560152a38195d015fc6abb7fa Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * Fix QSocketNotifier constructorCristian Maureira-Fredes2018-05-092-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The first argument was modified to be a socket type, but it needs to be an int (file descriptor). Adding a new signature solves the compatibility problem between Python2 and 3. A test case was added. Task-number: PYSIDE-629 Change-Id: Id9dea37459350dfc90d0f0ab9e2e1993d03fe6e4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.9' into 5.11Friedemann Kleint2018-05-03124-132/+137
|\| | | | | | | Change-Id: I15e8a6120c249bfc5a0e2b3fa262989fafccbf57
| * Change license from all the filesCristian Maureira-Fredes2018-05-03124-124/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing the word 'project' from all the headers, and changing the PySide reference from the examples to Qt for Python: The following line was used inside the source/ and build_scripts/ directory: for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done and the following line was used inside the examples/ directory: for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * Implement Python slicing support for QByteArrayBoxiang Sun2018-04-301-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PySide2 for Python 3 didn't support get item by slice, e.g. ``` >>> from PySide2.QtCore import QByteArray >>> ba = QByteArray('1234567890') >>> ba[2:4] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: sequence index must be integer, not 'slice' ``` This is because get item by slice is supported by mp_subscript. But current PySide2 doesn't implemented it. So I added __mgetitem__ in QByteArray. And we also need to keep __getitem__ to support iterate over QByteArray. Also removed the __getslice__ from QByteArray. Task-number: PYSIDE-567 Change-Id: I01f79cc2ab8700da92155cfad96be2e98bb8b331 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * Rename PySide references to Qt for PythonCristian Maureira-Fredes2018-04-27124-124/+124
| | | | | | | | | | | | | | | | | | When referring to the project one should use "Qt for Python" and for the module "PySide2" Change-Id: I36497df245c9f6dd60d6e160e2fc805e48cefcae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.11Friedemann Kleint2018-04-261-1/+36
|\| | | | | | | Change-Id: Id40dab17b02800199f70072115d7473041f683d8
| * Add default return value to pythonTypeIsValueTypeCristian Maureira-Fredes2018-04-191-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a class inherits from two base classes, Shiboken sets the converter of the newly created SbkObject to 0 (SbkObjectTypeTpNew), and handle the multiple inheritance in a different way. When any SbkObject try to release its ownership, it first verify if the ownership is already on the C++ side by checking the attribute hasOwership and also if the converter is a ValueType. The later fails if the converter is null, so a default value (false) was added. A test case using deleteLater() was included, which uses the releaseOwnership method internally. Task-number: PYSIDE-11 Change-Id: I34fba0d3e5d28b99b49a183ed08e977a311da632 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Add new API of Qt 5.11Friedemann Kleint2018-03-191-0/+4
| | | | | | | | | | | | | | Task-number: PYSIDE-487 Change-Id: I67ce74f06bba2f0161bb6e49be5aa8d7cfeea793 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.9' into devFriedemann Kleint2018-02-262-3/+15
|\| | | | | | | Change-Id: I1bc352322e41c3288a8a6f93dc2873e393607d72
| * Add condition to qmimedatabase_testCristian Maureira-Fredes2018-02-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | An assert related to a Mimetype comment fails if the language is unset or is not English. Since this assert is not critical to the functionality of the module, we can remove it or add a simple condition to test it only when the system's language is English. The last one was applied. Task-number: PYSIDE-575 Change-Id: Ida85268e25522e406878dd6ac4e5e70852f8d8e4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Fix error with second Qt.UniqueConnection callCristian Maureira-Fredes2018-02-011-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation was considering only Py_True as a success, but not Py_False. The else statement will enter just in case of error, as intended. Added a test case to verify the proper behavior of Qt.UniqueConnection. Task-number: PYSIDE-34 Change-Id: I5bafe0e81383022dcd7fc6251fc61d0ab5e918d0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devFriedemann Kleint2018-01-193-3/+87
|\| | | | | | | Change-Id: I0bebba45aa05c2eb02c35bf76b63bb7eaa67b562
| * Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-01-191-3/+4
| |\ | | | | | | | | | Change-Id: I5f2e1660a27efafa445592898db4dfe3250306e0
| | * qinstallmsghandler_test.py: Test qDebug() in debug builds onlyFriedemann Kleint2018-01-161-3/+4
| | | | | | | | | | | | | | | | | | | | | Otherwise, messages are suppressed and the test fails. Change-Id: Ie7fb8192e542a09822f6e1f70392100f4cdc0f11 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * | Fix return conversion for readData/readLineDataCristian Maureira-Fredes2018-01-152-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | The proper approach is to replace the returning data as Python Strings instead of QByteArray. Task-number: PYSIDE-40 Change-Id: I554b88bb79b7ae7d36fdc8c597704e3fcadd4527 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | | Merge remote-tracking branch 'origin/5.9' into devFriedemann Kleint2018-01-091-5/+20
|\| | | | | | | | | | | Change-Id: I9eec3aeb13cf21bc9ec3c877340ed92d904c461e
| * | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-12-211-5/+20
| |\| | | | | | | | | | Change-Id: I78039827d32c1d4d540a8b1b2afd4841e40d5c2c
| | * Fix QtCore test bug829 to run on WindowsFriedemann Kleint2017-12-191-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test used Python functionality to create a temporary file which caused an access error on Windows, apparently due to the file still being open. Besides, the temporary file was leaked. Rewrite using QTemporaryFile and make sure the file is closed and the QTemporaryFile is deleted before using it and delete it in __del__(). Task-number: PYSIDE-431 Change-Id: I5d63e76ead7169d9f3f2267ee53aa91b601a3968 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | | Merge remote-tracking branch 'origin/5.9' into devFriedemann Kleint2017-11-302-60/+0
|\| | | | | | | | | | | Change-Id: Iedf9086aa8aea8587eb70fcf1770daf008ccc9cc
| * | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-11-272-60/+0
| |\| | | | | | | | | | Change-Id: I79637555fbfbd596dee4313baf80149d03bb5206
| | * 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>
* | | Add new API of 5.10Friedemann Kleint2017-11-151-0/+49
|/ / | | | | | | | | | | | | | | Add QRandomGenerator, QRandomGenerator64 and QSemaphoreReleaser. Change-Id: I28c5527d00ef04d92f5f6ea5f965c48905f8b2a9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Add bindings for QRegularExpressionFriedemann Kleint2017-09-052-0/+57
| | | | | | | | | | | | Task-number: PYSIDE-487 Change-Id: I5902ce37ad40b8180b6710b3e7cd091925ad392d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Add bindings for QVersionNumberFriedemann Kleint2017-09-052-0/+49
| | | | | | | | | | | | Task-number: PYSIDE-487 Change-Id: I0106d87418c757d14c2dd7dd9fd1ab9d0c66a449 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Re-enable bindings for QUuidFriedemann Kleint2017-09-042-0/+46
| | | | | | | | | | | | | | | | | | Remove comments, add test. The claimed cyclic dependency apparently disappeared when porting to Clang. Task-number: PYSIDE-487 Change-Id: I44556fb5de92d83bd9471a41a03db9f6eeff0a31 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-08-222-0/+44
|\| | | | | | | Change-Id: Iddee2cf511ee0f0896a04a76e5b5b8bd44d1d6f1
| * Add QTimeZoneFriedemann Kleint2017-08-022-0/+44
| | | | | | | | | | | | Task-number: PYSIDE-487 Change-Id: I9a2c19c6b8415e3f608531b315a6841eb3de55f5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * move everying into sources/pyside2Oswald Buddenhagen2017-05-22127-0/+12637
| | | | | | 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.
* move everying into sources/pyside2 (5.9 edition)Oswald Buddenhagen2017-05-22128-0/+12735
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.