aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine
Commit message (Collapse)AuthorAgeFilesLines
* QJSEngine: Add a function to throw a pre-generated error objectUlf Hermann2021-01-221-2/+4
| | | | | | | | | | | | | | | It makes little sense that you can construct an error object but not throw it. The test was definitely meant to actually throw the error object, not return it. [ChangeLog][QtQml] QJSEngine has gained an additional overload to the throwError() method, with the effect that calling throwError() with a character literal as argument is now ambiguous. You should explicitly construct a QString instead. Change-Id: I90c6c9edf10509daa142a86581d6a3f7ff45af2c Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-9/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Allow checking for and catching errors from QJSEngineUlf Hermann2020-12-071-0/+14
| | | | | | | | | As you can manually throw an error, you should be able to catch it again, too. Change-Id: I82475df1969a1fd76f4cf5fc0a8d921dfafaef89 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Integrate sequences with registration macrosUlf Hermann2020-11-111-6/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | You get to write QML_SEQUENTIAL_CONTAINER(value_type) now, and qmltyperegistrar will generate a sensible registration call from that. A registration might look like this: struct MyStringListForeign { Q_GADGET QML_ANONYMOUS QML_SEQUENTIAL_CONTAINER(QString) QML_FOREIGN(MyStringList) QML_ADDED_IN_VERSION(3, 1) }; It's unfortunate that we need to use a metaobject to transfer all of this information, but there is no other sensible way. Transform the containers defined in qv4sequenceobject.cpp to use the new style, and move them out of the builtins, into QtQml. Recognize that only one of them was ever tested, and add tests for the rest. Task-number: QTBUG-82443 Change-Id: I3a30f9e27266bb575eea26c5daf5dad1ec461cc5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Update MetaType things in testsDavid Skoland2020-11-041-4/+5
| | | | | | | Also fix some minute errors. Change-Id: I1815224a6efdd7e619dfe5a5911d8b1166a3b3c8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-062-6/+6
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* QJSEngine: provide a way to check if an exception was thrownFabian Kosmale2020-09-021-0/+21
| | | | | | | | | | | [ChangeLog][QML][QJSEngine] QJSEngine::evaluate gained an optional stackTrace parameter. It can be used to check if the returned QJSValue comes from an uncaught exception, and to retrieve the backtrace of the execution leading to the error. Fixes: QTBUG-54925 Change-Id: I2b5ada1f0c33c335b4b9d0d1268e70ca63a1fad1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix QtQml after QMetaType/QVariant changes in Qt CoreLars Knoll2020-08-281-1/+1
| | | | | Change-Id: I2a983cf8188e88d80d3b7726208d821427eb8f3c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove deprecated function QJSValue::engineFabian Kosmale2020-08-261-3/+0
| | | | | | | | | [ChangeLog][QJSValue] The deprecated function QJSValue::engine() has been removed. Change-Id: I2be35379e0a9e51f5371a2c98b955282955b7147 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Adapt to qtbase changesFabian Kosmale2020-08-231-7/+7
| | | | | | | | | | | The internal QVariant constructor taking a QMetaTypeId has been removed. Thus, construct QMetaTypes where necessary from the id, or avoid a QMetaType -> ID -> QMetaType roundtrip where we already have a metatype. Also fix a few missing includse that were previously transitively included. Change-Id: I56ce92281d616108a4ff80fe5052b919d1282357 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* tst_qjsengine: Fix comparison related failuresFawzi Mohamed2020-08-201-3/+8
| | | | | | | | | | | | The new QMetaType/QVariant comparison is strict, so that several comparisons now fail. so we try to convert before comparing. Remaining ugliness: QString -> QChar conversion not provided, so change input to string QVariant(static_cast<QObject *>(x)) != QVariant(x) if x is a subclass of QObject. Change-Id: Ie0b7ba40d36a5e935976d1947d95295c48cd0c23 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Prepare for removal of Threads::Threads special casesAlexandru Croitor2020-08-061-1/+6
| | | | | | | | | The Threads::Threads target will automatically be propagated via the Qt6::Platform target. Task-number: QTBUG-85877 Change-Id: I33aec0b393be82467970eefd69f31feda3ac996e Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix race condition in QQmlData::createPropertyCacheFabian Kosmale2020-06-051-0/+23
| | | | | | | | | | | | | | As noted in QJSEnginePrivate::cache, there can be a race between calling addRef on the QQmlPropertyCache and another thread derefing and consequently deleting it. To avoid this, we introduce a doRef flag in QQmlMetaTypeData::propertyCache, which tells it to ref the the cache. This fixes the issue, as the QQmlMetaTypeDataPtr in propertyCache() acts as a mutex. Fixes: QTBUG-84692 Pick-to: 5.15 Change-Id: I962d28cfd22696aad89a660e41c55f63a8791b44 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-05-151-0/+16
|\ | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktextedit/BLACKLIST Change-Id: If1868d27ea40fdc206971c2f7a24e91c5e62b1bf
| * V4: Avoid integer overflow in DataViewCtorFabian Kosmale2020-04-211-0/+16
| | | | | | | | | | | | Fixes: QTBUG-83667 Change-Id: Ia54510bd7c20fb232b117c1ea0fa5facfcd1a9a5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Implement URLSearchParamsMaximilian Goldstein2020-05-061-0/+1
| | | | | | | | | | | | | | | | | | | | Implements URLSearchParams (https://url.spec.whatwg.org/#urlsearchparams), completing our implementation of the URL object. Still needs the for..of iterator to get implemented. Change-Id: Iad33ed2f3fe0b2598ca2b0b21a4743f5f7dc19fd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Implement URL objectMaximilian Goldstein2020-04-081-0/+1
| | | | | | | | | | | | | | | | | | Implements the JavaScript URL object (https://url.spec.whatwg.org/#api). Except that it does not currently implement the searchParams field. Task-number: QTBUG-54988 Change-Id: I19abc69e075cbf84bd15e6791be195ce16f3fe73 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | CMake: Regenerate projectsAlexandru Croitor2020-04-062-1/+55
| | | | | | | | | | Change-Id: I7f1716d8524e1e6a1491a01ba71dbd7f078ade14 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove QRegExp from qml autotestsLars Knoll2020-04-031-109/+15
| | | | | | | | | | | | | | | | QRegExp will get removed in Qt6. Clean up by removing dependencies on QRegExp in the autotests. Change-Id: I8ef8561ba30b98b61cd9ed52907b48c5969f2c49 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Improve conversion between JS RegExp and QRegularExpressionLars Knoll2020-04-031-1/+56
| | | | | | | | | | | | | | Add support for InvertedGreedinessOption and MultilineOption. Change-Id: I19dce6e356a7ec406640bb8858885cd576b4aa2f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Include qjsengine and qjsvalue autotests in the cmake buildLars Knoll2020-04-021-0/+5
| | | | | | | | | | | | | | | | | | This looks like a bug in the pro2cmake tool. It somehow didn't include those two test cases in the build. Modifying the pro file slightly makes pro2cmake add them. Change-Id: If6215f111494d0912e590428a0f4ca2c3b653856 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Store a QV4::ReturnedValue in QJSValueUlf Hermann2020-03-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Being careful, we can now save primitive values inline. We use the heap pointer of QV4::Value as either QString* or QV4::Value* for complex types. We cannot store persistent managed QV4::Value without the double indirection as those need to be allocated in a special place. The generic QVariant case is not supported anymore. The only place where it was actually needed were the stream operators for QJSValue. Those were fundamentally broken: * A managed QJSValue saved and loaded from a stream was converted to a QVariant-type QJSValue * QVariant-type QJSValues were not callable, could not be objects or arrays, or any of the special types. * Cyclic references were forcibly broken when saving to a data stream. In general the support for saving and loading of managed types to/from a data stream was so abysmally bad that we don't lose much by dropping it. [ChangeLog][QML][Important Behavior Changes] When saving a QJSValue to a QDataStream only primitive values or strings will be retained. Support for objects and arrays was incomplete and unreliable already before. It cannot work correctly as we don't necessarily have a JavaScript heap when loading a QJSValue from a stream. Therefore, we don't have a proper place to keep any managed values. Using QVariant to keep them instead is a bad idea because QVariant cannot represent everything a QJSValue can contain. Fixes: QTBUG-75174 Change-Id: I75697670639bca8d4b1668763d7020c4cf871bda Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-121-4/+4
|\| | | | | | | | | | | | | | | Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
| * Fix deprecation warning against QDateTime(QDate)Edward Welbourne2020-02-181-4/+4
| | | | | | | | | | | | Change-Id: Iaba4d9f1ea4b265326a8d1b07573b0f30b4d7428 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Regenerate qtdeclarativeAlexandru Croitor2020-02-121-3/+2
| | | | | | | | | | | | | | Change-Id: I48d7fd306f3d1b161a8e73029282ee591b1ef612 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-01-291-4/+33
|\| | | | | | | | | | | | | Conflicts: dependencies.yaml Change-Id: Ie3e9dc62031a85e5e81cbdf04694b95159d49fca
| * Add Qt.uiLanguage and QJSEngine::uiLanguage propertiesSimon Hausmann2020-01-231-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] Added Qt.uiLanguage and QJSEngine::uiLanguage properties These properties mirror the same value in QML and C++ and can be used freely. They also provide API symmetry to Qt for MCUs. QQmlApplicationEngine binds to this property and applies translations accordingly by constructing a QLocale with the value and using QTranslator::load(locale). Change-Id: Id87d6ee64679b07ff3cb47844594e8eeebd8c8b6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Christian Kamm <mail@ckamm.de>
| * Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | as type is going to be deprecated. This change was done automatically with the help of clazy. In addition, ColumnRoleMetadata was changed to take an int instead of a QVariant::Type Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2020-01-161-0/+182
|\| | | | | | | Change-Id: I0c5b939c70bdb91ccdf7068784308416dcaa5736
| * V4: Avoid integer overflow on typed array length checkUlf Hermann2020-01-081-0/+36
| | | | | | | | | | Change-Id: I370b4c4bd0d7962878849ca7c5edef6cb36eca25 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * Check stack limit in FunctionPrototype::method_apply()Ulf Hermann2020-01-081-0/+13
| | | | | | | | | | | | | | | | | | We could just crash there, assuming unlimited memory, but as this particular place seems to be a very attractive target for various mischief, let's just plug it. Change-Id: I3b0369ceb34dafd12ce8dc1f189fc5f9ee82c169 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * V4: Don't crash when iterating invalid Proxy objectsUlf Hermann2020-01-081-0/+15
| | | | | | | | | | | | Fixes: QTBUG-81109 Change-Id: I97f37c68d33f414d7bffa9b66e0aaed93370dc68 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * V4: Don't crash when sorting arrays with non-stringifyable entriesUlf Hermann2020-01-081-0/+12
| | | | | | | | | | | | Fixes: QTBUG-81108 Change-Id: I7e121776a2416b5338c4c1309ec7cc31c703ad28 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * QV4: Support printing arrays with circular referencesFabian Kosmale2020-01-071-0/+13
| | | | | | | | | | | | Fixes: QTBUG-81105 Change-Id: Iaf0597cea3a5572f020c5f87a843774f33cc01fd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * QV4: Array.includes: Support large arraysFabian Kosmale2020-01-071-0/+12
| | | | | | | | | | | | | | | | | | Creating new ScopedValues in the loop was quite wasteful, and would trigger a crash. We now simply reuse the ScopedValue. Fixes: QTBUG-81104 Change-Id: Ie1efd144886861a21c8f6827d7fd23699a1e0dcc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * QV4: Check recursion limit in toStringFabian Kosmale2020-01-071-0/+22
| | | | | | | | | | Change-Id: I18b7a4e00150f6c47c991a5164901159b7f946b9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * V4: Catch error when compiling broken RegExpsUlf Hermann2020-01-071-0/+17
| | | | | | | | | | | | | | Otherwise we try to assign an invalid RegExp object, which crashes. Change-Id: I85478406524a2a9d7542758caaa1b42b4090bb93 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * V4: Fix sorting of sparse arraysUlf Hermann2020-01-061-0/+21
| | | | | | | | | | | | | | setArrayData() needs to handle a nullptr argument. Change-Id: I1ea05d9db9beb1fede6d3c068cfcf700702e8aa6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * Avoid oob access on Array.concatUlf Hermann2020-01-061-0/+21
| | | | | | | | | | | | | | | | | | | | As we have already determined that we're past the end of the allocated space on the source object by checking os->values.alloc, we should conclude that all the remaining values are undefined. Fixes: QTBUG-81037 Change-Id: I664f22b7eb37c26061e8a9e2f88bcf2a7b6e09f3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2019-11-251-0/+1
|\| | | | | | | Change-Id: I48b9c2e4f3a75c18470c55f73f2089dc1401de54
| * Make ScopedValue's CHECK_EXCEPTION also check isInterruptedUlf Hermann2019-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | While there should be no way to generate an infinite loop from any of the affected methods, you can certainly generate a really long loop, for example with Array(1E9).join(). We should be able to interrupt this. Also, the various call()s could return with isInterrupted set. We should respect that and immediately return. Fixes: QTBUG-78955 Change-Id: I7e18b24db0bf39df03134027b2b5dba452ac7c1c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Regenerate all projects with new CMake API versionAlexandru Croitor2019-11-151-3/+3
| | | | | | | | | | | | Change-Id: Ie0db35f674137c229eaf049616f38f8e818f7092 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Regenerate testsAlexandru Croitor2019-11-141-19/+18
| | | | | | | | | | | | Change-Id: I67a6c8f1659e7b471a4fcb92a2699292cf4eea81 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-10-112-0/+15
|\| | | | | | | Change-Id: I4a91928610f79c8e21a05781953ffa41508c828a
| * Fix deployment of QtQuick for Android with dummy_imports.qmlJan Arve Sæther2019-08-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | We rely on the qmlimportscanner to find out what to deploy, but it is limited to scanning .qml files. These tests creates the QML code from C++, so qmlimportscanner fails to detect those dependencies. Therefore, we add a dummy_imports.qml file that has the sole purpose of giving qmlimportscanner which additional dependencies the test has. Change-Id: I4237b738e408c309b9b21de7e53d1a4e4acb7e2e Task-number: QTBUG-73512 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Remove the last usages of deprecated APIsSona Kurazyan2019-08-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | - Replaced the usages of deprecated APIs by corresponding alternatives. - Fixed building the tests with disabled deprecated APIs. Task-number: QTBUG-76491 Change-Id: Ie8c5deb22c2074d39a64346c20e5384a7b2ad99b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-08-151-0/+15
|\| | | | | | | Change-Id: I6f2152aeecaeb8e63fdbc1cdf1444132a054b6f5
| * Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-261-0/+15
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/handlers/qquickpointerdevicehandler.cpp src/quick/scenegraph/qsgdefaultglyphnode.cpp src/quick/scenegraph/qsgdefaultglyphnode_p.cpp src/quick/scenegraph/qsgdefaultglyphnode_p_p.h tests/auto/qml/qjsengine/tst_qjsengine.cpp Done-With: Jan Arve Sæther <jan-arve.saether@qt.io> Done-With: Laszlo Agocs <laszlo.agocs@qt.io> Change-Id: I35749152f8dce44b9af8d52b1283629879010f11
| | * V4: Add label for loop in spread in ArrayPatternErik Verbruggen2019-07-171-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch also rotates the loop back so that the condition is at the top of the loop. It's a cherry-picked from commit 0282b89ec672e25a465a8e51bc74c7fd58a624b1. Without explicitly setting the label, we get a default constructed Label from labelForOffset in PlatformAssemblerCommon::link, which leads to a jump into nirvana. This issue arises only with backward jumps, as we fill in the information for forward jump targets once we actually encounter the target. Fixes: QTBUG-77047 Change-Id: Id928831f90eace494adb1eb1190f674a6f033b20 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add QtDeclarative Test CoverageLeander Beernaert2019-08-141-0/+57
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All tests compile and run on a developer build. These tests are failing: tst_qqmlsqldatabase Fails due to missing sql driver tst_qqmlsqldatabase Fails in wip/qt6 tst_ququicklayouts Fails in wip/qt6 tst_flickableinterop Fails in wip/qt6 tst_qquickpinchandler Fails in wip/qt6 tst_qquickflickable Fails in wip/qt6 tst_qquickgridview Fails in wip/qt6 tst_qquickimage Fails due to missing jpeg plugin tst_qquicklistview Fails in wip/qt6 tst_qquicktext Fails in wip/qt6 tst_qquickcanvasitem Fails in wip/qt6 tst_scenegraph Fails due to missing jpeg plugin tst_TestFiltering Fails in wip/qt6 Change-Id: I4b9d69c118e23c095cb72ad5a67653fc30943bb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>