aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/tests
Commit message (Collapse)AuthorAgeFilesLines
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-28335-30639/+0
| | | | | | | | 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 C codeChristian Tismer2020-10-272-60/+0
| | | | | | | | | | | | It will be assumed that Python is always Python 3. All checks for Python 2 are removed. This is the second part of cleaning up the C code from references to Python 2. Task-number: PYSIDE-904 Change-Id: I3006412c2a5bb65402101b0aac5a5f2fc79ce2f8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* remove traces of Python2 from Python codeChristian Tismer2020-10-271-5/+2
| | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-221-0/+13
|\ | | | | | | Change-Id: I68ec1e4b80fcc8c395eacb7d5046fdd8e00535e0
| * Update SmartPointers conversionsRenato Araujo Oliveira Filho2020-10-211-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | * Updated test to accept base types derived using std::shared_ptr; * Generate new coode to be able to convert smart pointers into shared pointers of base class. Functions that accepts SharedPointer<A> as argument should be able to accept SharedPointer<B> if B is derived from A. Task-number: PYSIDE-1397 Change-Id: I7e5235980daaf4651dad3ab1c880373f1c64e134 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-212-49/+26
|\| | | | | | | Change-Id: I8831b840fa7816b8919ecbaab17b41822a0a6012
| * Extend SharedPtr API with std::shared_ptrRenato Araujo Oliveira Filho2020-10-202-49/+26
| | | | | | | | | | | | | | | | | | | | | | Make sure that we have copy constructor for SharedPtr with derived types. This will be necessary for test SharedPtr implicit conversions. Task-number: PYSIDE-1397 Change-Id: Ic970c84bef025403a0fbef79dce97433254d2f56 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-1614-1/+322
|\| | | | | | | Change-Id: I27beffe4a6e2fc2f818960c3b9f5ffbfaac4a670
| * Enable typesystem typedefs across modulesFriedemann Kleint2020-10-157-1/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a specialization of template type ValueWithUnit from libsample to libother would fail since the SBK index array of libsample would be used with the index from libother for it. Build up the inheritance for typesystem typedefs early on and add a lookup which matches the template specializations found during traversing functions to the type def and the class that is generated for it so that it can be used. As a side effect, special case entries for template specializations can be deleted from the signature mappings since they change to the class name and thus are normal types. Task-number: PYSIDE-1202 Change-Id: I5cc9650f70e9dc975171c80919685ebf5e752749 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Add a test for typesystem typedefsFriedemann Kleint2020-10-157-0/+161
| | | | | | | | | | | | | | | | | | Mimicks some template which might be used trying to enforce correctness of units by type checking. Task-number: PYSIDE-725 Change-Id: Ia7008d7db5638920eee3d0ef36cc32a63796b98e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-013-0/+11
|\| | | | | | | Change-Id: Idaf124ad5e1d6a41d52918cecba47499be5e7324
| * shiboken2: Generate functions from invisible namespaces into their parent ↵Friedemann Kleint2020-09-302-0/+5
| | | | | | | | | | | | | | | | | | | | | | namespaces Add them in ShibokenGenerator::getFunctionGroupsImpl() with some helpers. Fixes: PYSIDE-1075 Change-Id: Ie627c6e12f82e40cdb4f306ddac6b682e77124c5 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Generate functions from invisible top level namespaces as global ↵Friedemann Kleint2020-09-303-0/+6
| | | | | | | | | | | | | | | | | | | | | | functions Mainly add those in ShibokenGenerator::getGlobalFunctionGroups() with some adaptions. Task-number: PYSIDE-1075 Change-Id: I6dabac72c204904e76162542b5aa3ea1ac3b56ec Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Add QStringView/QByteArrayViewFriedemann Kleint2020-09-304-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-309-45/+41
|\| | | | | | | Change-Id: I13721e13d2fab13945385fe529afe4ab431e0532
| * shiboken2: Correctly generate final classes with protected methods without ↵Friedemann Kleint2020-09-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | protected hack Add a missing check for final class. Amends 170756fa1e5de0ce7ba33521f1eb168d70ad276d. Fixes: PYSIDE-1388 Change-Id: I6b7cd5c9a769838287ac7165bdc2d5ad63b289a1 Reviewed-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Consolidate tests for invisible namespacesFriedemann Kleint2020-09-298-45/+37
| | | | | | | | | | | | | | | | | | | | | | | | Move the tests for PYSIDE-1074 from samplenamespace.h to removednamespaces.h. The latter has also a test case for an invisible namespace under a visible namespace besides the invisible top level namespace test. Task-number: PYSIDE-1074 Task-number: PYSIDE-1075 Change-Id: I5d1c6428f6ceadf929063c2c69723a7871173f4e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-295-25/+47
|\| | | | | | | Change-Id: Ie6da3938b82f5ebe96dd12bd65a3ccc4180d2fba
| * shiboken2: Fix the tests for enums in removed namespacesFriedemann Kleint2020-09-282-24/+18
| | | | | | | | | | | | | | | | | | Change the formatting for better readability and use the "visible" attribute instead of the deprecated "generate". Task-number: PYSIDE-1075 Change-Id: Ibbb33d2482c1d682f74d2edce2dd7d3bb1a50821 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Generate properties as fieldsFriedemann Kleint2020-09-284-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add an XML attribute specifying whether code is to be generated to the XML properties. - Split the generator functions for field setters and getters apart so that they can be used for generating property setters and getters. - Generate code for all properties from XML when the PySide extension is not used, otherwise only for those with the attribute set. Task-number: PYSIDE-1019 Change-Id: Iab2ba38b90038edc667a233c23c7113fdc6fb438 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-228-0/+40
|\| | | | | | | Change-Id: Id0fc76666bbdb254a833eeb6909a0874b2611bf3
| * shiboken2: Add namespace variablesFriedemann Kleint2020-09-213-0/+9
| | | | | | | | | | | | | | | | | | | | They were ignored in the code parser. Take them into account and add a test. Task-number: PYSIDE-1224 Change-Id: I3baca95556129d695db294fdcc1ad92fc831672d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * shiboken2: Allow specifying the sequence of overloadsFriedemann Kleint2020-09-215-0/+31
| | | | | | | | | | | | | | | | | | | | | | Add an attribute to specify a number by which the functions will be sorted. This deactivates the default sorting which tries to avoid implicit conversions. Fixes: PYSIDE-1366 Change-Id: I9a891e21f86152b2fdfda9a48d685f19aa936508 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-171-1/+1
|\| | | | | | | Change-Id: I8aa48d07067c45c888c73af87314f6a88c2a6e14
| * signature: Always create a return typeChristian Tismer2020-09-161-1/+1
| | | | | | | | | | | | | | Change-Id: I6da99684efb6b3be7f3e347f71862ebfd502ecd9 Fixes: PYSIDE-1383 Reviewed-by: Kyle Altendorf <sda@fstab.net> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-102-4/+12
|\| | | | | | | Change-Id: I8a627fd459c3f9601d078a00d3d77c8b3fe04304
| * Implement default __ne__ and __eq__ for all PySide typesAlex Hughes2020-09-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * testing: Ensure that build dir precedes site-packagesChristian Tismer2020-09-071-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before the big change "Fix running the PySide2 tests for Python 3.8/Windows" the cmake paths were ordered in a way that a compilation would not interfere with an installation. With the new test layout, it suddenly became possible to do a new compilation, but shiboken would not be loaded from the compilation but use some version which is still in side-packages. This patch fixes that so that the newly inserted directories are guaranteed to come before site-packages. Change-Id: Ib999664a798661533c4fe7bfab19458ce2a1d710 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-042-2/+2
|\| | | | | | | Change-Id: Ib1d2c1b76a043526e8f715e45296104cad085a4a
| * signature: Use a clean init function to initialize itChristian Tismer2020-09-042-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the quick hack replacing "type.__signature__" by 'eval("type.__signature__")', we now use a clean initialization function `_init_pyside_extension` that is implanted into the __builtins__ module. This is the first of a series of improvements and simplifications that will be applied slowly with low priority. Task-number: PYSIDE-829 Task-number: PYSIDE-510 Change-Id: I9951239c73d02f47272f1a531fb4886c8181b9a7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Bump cmake version to 3.16Friedemann Kleint2020-09-042-2/+2
| | | | | | | | | | | | | | | | | | | | 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 Python2 from shiboken testsFriedemann Kleint2020-09-0316-247/+34
| | | | | | | | | | | | | | Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I78f18430eecf37c6a66593ac3a725d92b5a6c061 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Remove Python2 from C++ codeFriedemann Kleint2020-09-031-26/+4
|/ | | | | | | Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I7e4ffaeabb2ac8a5ffe165d43b3475a7e5d57447 Reviewed-by: Christian Tismer <tismer@stackless.com>
* signature: Avoid non-existent attributes in compiled code (Nuitka)Christian Tismer2020-08-312-2/+2
| | | | | | | | | | | In standard Python, there is (yet) no attribute "__signature__". Nuitka, the compiler, knows that and raises an AttributeError without even trying. The workaround was simple: Use "eval". Change-Id: Ice9deccd7ba2fe4c376f0a151924a68f88ca020d Fixes: PYSIDE-829 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* support Python 3.9Christian Tismer2020-08-191-4/+1
| | | | | | | | | | | This was merged with "WIP: Enable support for Python 3.9". There were minor problems, only. Thanks Cristian for adding cosmetic changes which should already have been applied in Python 3.8 or earlier. Change-Id: Id5e8696d9cfb7192243ad44c93e9f2cf347d6a7c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Enable adding operators ==, != as functions without code injectionFriedemann Kleint2020-07-226-2/+100
| | | | | | | | | | | | | As of Qt 6, there is a trend of hiding bool returns of comparison operators of container classes behind some template expression which the clang parser cannot identify. To work arouind such cases, make it possible to add them as functions without code injection which will generate the default code. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Ia7bf5d583e0f80505fe1b759347955fec5dca600 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* testing: Supply the last build history as BUILD_DIR defaultChristian Tismer2020-07-141-1/+21
| | | | | | | | | | | | Interactive testing always needs the BUILD_DIR variable. This makes sense for automated tests. Having to insert that manually all the time is a bit annoying and not necessary, since we already have that info in the history. Change-Id: I5d35ce8504af36280eba236b2be4e6b4f320d1cc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken2: Handle virtual methods returning a referenceFriedemann Kleint2020-07-142-0/+8
| | | | | | | | | | | | | | | | | | | Although it is a questionable practice, it occurs in Qt 6: virtual const QEventPoint &QPointerEvent::point(int i) const; Previously, the generated return statement return QEventPoint(); would cause a warning about returning a temporary. Fix by creating a static variable and returning a reference to it. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Id6467be22a166e99e8dcf08b2c7c14df33cd2786 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken2: Handle default parameters of const pointersFriedemann Kleint2020-07-144-4/+19
| | | | | | | | | | | | Occurs in Qt 6: QKeyEvent(..., const QInputDevice *device = QInputDevice::primaryKeyboard()); We need a const-cast here since shiboken needs a QInputDevice * for type conversion. Change-Id: Iea1137eac44a26b7bc9cf0e1908c0e42ba2de39f Reviewed-by: Christian Tismer <tismer@stackless.com>
* typesystem_sample.xml: Expand tabsFriedemann Kleint2020-06-191-11/+11
| | | | | Change-Id: I64479f27828cfb574427b457223c97176c8646ad Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-06-114-0/+12
|\ | | | | | | Change-Id: I6cf604e1ae7234ce4f0d99169e9269a7dde07a4a
| * shiboken: Fix default-initialized function argumentsFriedemann Kleint2020-06-114-0/+12
| | | | | | | | | | | | | | | | Specifying {} causes it to be qualified, check this. Change-Id: Idd23c8a5af01cd7fbb63a2e5a01bb349c530fe54 Fixes: PYSIDE-1325 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Clean the build/install output a bitCristián Maureira-Fredes2020-06-082-27/+19
| | | | | | | | | | | | | | | | | | | | | | | | * Adding STATUS or WARNING to a couple of message() calls. * Replacing some print() by log.info() * Changing some '*' by '-' * Align configuration outputs to check paths easily * Adding big message to check when shiboken2/pyside2 is being built. * Including the cmake_minimum_required() function instead of an 'if'. Change-Id: Idb6c5797286d400192d083403063e2ae582e3fe6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | dumpcodemodel: Improve XML outputFriedemann Kleint2020-06-051-12/+66
| | | | | | | | | | | | | | | | | | | | | | - Skip empty namespaces - Add a command line option to join namespaces - Add an XML comment with file location - Filter out anonymous structs Change-Id: I061540a6a4bcb583a19ee70efc268571324521ff Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-05-261-2/+4
|\| | | | | | | Change-Id: I9c7163094bc934f481002adcea78ef4928ed26be
* | shiboken: Prepare build system for Qt 6Friedemann Kleint2020-05-063-5/+5
| | | | | | | | | | | | | | | | Introduce a version variable to the CMakeLists. Task-number: PYSIDE-904 Change-Id: Icf823db22025f6d4ac1867ae86e9357fff824daa Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Enable injecting raw code for setattro/getattroFriedemann Kleint2020-05-044-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | Setattro/getattro functions can be added. As shiboken also uses these functions internally, the code blocks are inserted into those implementations. As those are special functions, only raw code is injected. No macros are replaced for arguments or instances. Fixes: PYSIDE-1280 Change-Id: I207dcf70b3a9f5edc51ff6566b31a2a8aa4776ed Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-03-061-11/+132
|\| | | | | | | Change-Id: I116f2abfda7263fac8a31ffbe8fc82bfa0cbc618
| * Change the dumpcodemodel tool to output typesystem XMLFriedemann Kleint2020-03-051-11/+132
| | | | | | | | | | | | | | | | Make the previously existing debug output an option and output typesystem XML by default. Change-Id: I3d95bdb56446097377880e1ca0b54d3b8b93ea24 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"Friedemann Kleint2020-03-042-28/+88
|\ \