aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
Commit message (Collapse)AuthorAgeFilesLines
...
* tst_qqmllocale: blacklist timezone test on 32bit linuxSamuli Piippo2021-01-121-0/+2
| | | | | | | | timeZoneUpdated fails on 32bit (x86/arm) linux. Task-number: QTBUG-89889 Change-Id: I37815e73447a6e8ab9bf59fa3c356d5bd16d330f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qqmlengine: Fix crash when encountering bad singletonsMaximilian Goldstein2021-01-114-0/+43
| | | | | | | | | Previously errors occurring when parsing QML singletons would just be ignored resulting in a crash. The errors are now properly printed and the execution is aborted in time. Fixes: QTBUG-85932 Change-Id: I61cef5f97546ce2e0753bc46c548838a21b1f506 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix warning and assert when removing items from groupsMaximilian Goldstein2021-01-112-0/+48
| | | | | | | | | When removing items from groups actively shown by a model filter a warning and assert was triggered in the past. This change fixes this behavior. Fixes: QTBUG-86017 Change-Id: I49b7498a3d03141b654e453a3c35a43fc7ba804a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Avoid crash for deep aliasesMaximilian Goldstein2021-01-113-0/+16
| | | | | | | | | Aliases are seriously broken and need a larger overhaul. This patch at least prevents the application from crashing. Task-number: QTBUG-89822 Change-Id: Ib6acc5b6f621a902f7f5ce370043986486f3c0d0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Correct #if-ery in QML locale's time-zone update testEdward Welbourne2021-01-081-7/+11
| | | | | | | | | | | The feature check for timezone should apply to the whole test; it makes no sense without. The checks against Q_OS_WIN were redundant in code already subject to a Q_OS_UNIX check. Pick-to: 6.0 5.15 Task-number: QTBUG-89889 Change-Id: I419a775bf0777379662aa19e5b0c81fd6e0e26f6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make timeZoneUpdated.qml say what went wrong on failureEdward Welbourne2021-01-081-19/+73
| | | | | | Task-number: QTBUG-89889 Change-Id: I95f8e4cc6b26b1a8ab8fde2ecdd30b7b5520b6c9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QJSManagedValue: Add JavaScript 'function' typeUlf Hermann2021-01-071-20/+20
| | | | | | | | | 'function' is a separate type in JavaScript and should be treated that way. Replace the isCallable() method with a new isFunction() to reflect that, and add an entry to the Type enum. Change-Id: I09cc28a9edf8aa0380eb9caeb738dfc298a02567 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* tst_qqmlenginecleanup::test_customModuleCleanup(): Add error outputFriedemann Kleint2021-01-041-2/+10
| | | | | | | | | The test fails for MinGW in the CI for unknown reasons. Output the error string on failure. Pick-to: 6.0 Change-Id: I96415c9d5753f9013be22b55884175fda6604130 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Extend blacklisting of tst_QQmlImport::importPathOrder to MinGWTony Sarajärvi2020-12-281-0/+1
| | | | | | Task-number: QTBUG-88643 Change-Id: I51d346c127e3269eca49e387db578c16480a0565 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Blacklist qqmlenginecleanup::test_customModuleCleanup() for MinGWFriedemann Kleint2020-12-231-0/+2
| | | | | | | | The test fails for MinGW in the CI for unknown reasons. Pick-to: 6.0 Change-Id: I20199704a9c810499551b8952375926902a75aa0 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* QJSValue: Add a toPrimitive() methodUlf Hermann2020-12-192-0/+48
| | | | | | | We need a way to easily get a primitive from a QJSValue. Change-Id: I91a55d92ffa4ba6139b1e3f2e9308800b7047563 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJSManagedValue: Throw an exception when trying to call a non-callableUlf Hermann2020-12-191-12/+29
| | | | | | | The JavaScript engine does this, so we should do the same here. Change-Id: I011a60bc2c013f19306c843da7a9c22dc80a39cb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJSPrimitiveValue: Add a toVariant() method and ctor from QVariantUlf Hermann2020-12-181-0/+40
| | | | | | | | This is rather handy. Without it, we have to go through either QJSValue or QJSManagedValue, which causes much greater overhead. Change-Id: I40e2ecb6e2005f80c8f52b5e9a59028b3984eea4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a QJSManagedValueUlf Hermann2020-12-188-0/+1906
| | | | | | | | | | | | | A QJSManagedValue is a view on a QJSValue which always knows the engine the value belongs to. This allows us to implement the JavaScript semantics of the various QJSValue methods in a much more rigorous way. [ChangeLog][QtQml] The new QJSManagedValue should be used instead of QJSValue for manipulating properties and prototypes of JavaScript values, as well as for calling JavaScript functions. Change-Id: I9d445ffcf68dfa72dba9bae0818e83c80665ad66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ecmascript tests: Also raise timeout when built with cmakeUlf Hermann2020-12-181-0/+4
| | | | | | | | | | pro2cmake did not convert the QTEST_FUNCTION_TIMEOUT environment variable. As a result, when the test runs for more than 300s, it gets killed by the watchdog. Pick-to: 6.0 Change-Id: I370d2c1b7a129c41d690d41e84f0a51810d37160 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow JavaScript primitive type transformations inline in C++Ulf Hermann2020-12-186-0/+249
| | | | | | | | | | We don't want to call into the engine just for adding two numbers. This implements the most common operators on primitive JavaScript values. More are to follow in the future. Change-Id: Id51a5af59a3af9fec78a2d8f293e59e6567e9204 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Fix proxy iterationFabian Kosmale2020-12-172-0/+39
| | | | | | | | | | | If the target of a proxy was extensible, we did not set the iteratorTarget to its correct value, and thus the ForInIteratorObject would not be usable. Pick-to: 6.0 5.15 Fixes: QTBUG-86323 Change-Id: Id1924ac4087bab38c006b8eba92b619b79d36b7a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Windows/MinGW: Fix qqmltimer warnings floodFriedemann Kleint2020-12-171-19/+6
| | | | | | | | | | | | | | | | | | Replace the dubious function eventLoopWait() by QThread::msleep() since it causes a warnings flood when using MinGW: tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.) Pick-to: 6.0 Change-Id: I161d1d025f79560b21aaaeb510e4956eba54bdea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qqmltypeloader: Allow pluginless qmldir + declarative type registrationFabian Kosmale2020-12-155-0/+34
| | | | | | | | | | | | | | Assume an application which uses a QML singleton (so needs qmldir), and wants to use declarative type registration. This currently breaks because we find the qmldir, see that there is no plugin to load, and thus never search for registration functions. Requiring the creation of a plugin is rather pointless for an application which doesn't reuse the QML types; so instead enable this usecase to work. Note that qmldir + imperative registration did always work, as the imperative registration code did always run. Change-Id: Iac40020eb97d602d10eb8c4eecac5195ffeabe14 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Remove import sortingMaximilian Goldstein2020-12-117-285/+24
| | | | | | | | | | | Remove import sorting due to the fact that sorting imports can break code. [ChangeLog][QML Tooling][qmlformat] Remove import sorting and the (now obsolete) -n parameter to disable it Fixes: QTBUG-89295 Pick-to: 6.0 Change-Id: I5ff13d0ae3c715db7645b412152aadb31811ce5a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmltypeloader: Fix plugin not loading on MinGWMaximilian Goldstein2020-12-101-1/+1
| | | | | | | | | | | Usually libraries get a lib prefix when using MinGW but plugins are expected to not have a prefix, causing the plugin to not load properly. This change fixes this by using the MODULE keyword. Pick-to: 6.0 Fixes: QTBUG-89187 Change-Id: Icd543015805a8157d59c20e86134421911930ea1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Regenerate projects using pro2cmake one last timeAlexandru Croitor2020-12-103-1/+39
| | | | | | | | | And fix up some incorrect qmake project files Pick-to: 6.0 Change-Id: Ia6d27ac68195635021fe7c4a5f06386a60f3f323 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Support namespaced QML_ELEMENTMaximilian Goldstein2020-12-102-1/+17
| | | | | | | Fixes: QTBUG-87266 Change-Id: Iad8c7765b339c5498f541702bbf7df64164f5358 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix IC properties in same fileFabian Kosmale2020-12-102-0/+12
| | | | | | | | | | | Also fixes typename and metatype registration for inline components. Done-with: Fabian Kosmale <fabian.kosmale@qt.io> Pick-to: 5.15 Fixes: QTBUG-89173 Change-Id: I97d65d5539b577a8828d5711e5f2e79c8568b441 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmlistmodel: Fix crash when modelCache is nullMaximilian Goldstein2020-12-081-0/+22
| | | | | | | Fixes: QTBUG-89173 Pick-to: 5.15 Change-Id: Ife82518808fc5504ec42407e80ed3de89ed4adeb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJSValue: Add toVariant() overload with conversion behaviorUlf Hermann2020-12-071-14/+69
| | | | | | | | | | | | The QJSValue to QVariant conversion is traditionally messy. The recent addition of a special case for FunctionObject did not make that better. Rather, we now add a way of specifying that the conversion should be lossless, which avoids all conversions of JS objects and arrays. Amends commit 6b08c24297f39f3c67bc5c16f46198b33af66529. Change-Id: I6d4506b52d3175ed2f2984f8a26d560cf6311ab6 Reviewed-by: Fabian Kosmale <fabian.kosmale@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>
* Allow the QML console methods to be called from outside JSUlf Hermann2020-12-072-0/+16
| | | | | | | There may not be a stack frame and that is OK. Change-Id: Iccac4db1530c9a4b316905a3a283d36674c146a8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qv4qmlcontext: Fix bounded signal expressions when debuggingMaximilian Goldstein2020-12-041-3/+9
| | | | | | | Fixes: QTBUG-83599 Pick-to: 5.15 Change-Id: I8909f0b2d3eca909512b99c172c8dc5e93e48482 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_qqmlecmascript: Avoid memory leak on failureFabian Kosmale2020-12-031-3/+2
| | | | | | Pick-to: 6.0 Change-Id: Icf31fbe473e5b0659cfe09d5bef8652c22a2b1ce Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML engine: Fix binding setupFabian Kosmale2020-12-034-0/+33
| | | | | | | | | | | We set QProperty bindings up in the wrong way: Parent components would overwrite their child component's binding. This patch reverses the order, fixing the bug. Task-number: QTBUG-87153 Pick-to: 6.0 Change-Id: I3e90d1d14a41a7c5c337745f1453484d360a3979 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlPropertyCache: Remove unused copyAndAppend overloadFabian Kosmale2020-12-031-3/+3
| | | | | | | Original-patch-by: Lars Knoll <lars.knoll@qt.io> Task-number: QTBUG-88765 Change-Id: I85dad61a1c3ade29137be9870ce8af726be81a28 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QMetaType instead of metatype-id, take 2Fabian Kosmale2020-12-031-3/+3
| | | | | | | | | This time, the ValueTypeFactory gets converted. As a consequence, many callers get touched again. Task-number: QTBUG-88766 Change-Id: I3a8b7d5cfeb7fac85daf1702febba205971d4256 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Mark url as builtin typeUlf Hermann2020-12-022-0/+20
| | | | | | | | | Also, allow conversion from UrlObject and String. We allow the string conversion because we treat string and url as interchangeable in various places. Change-Id: Ib229c6d190e1c5d849ea18798925965b8dbeef7e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace some more foreach with ranged forVolker Hilsheimer2020-11-301-1/+1
| | | | | | | | Fix coding style as a drive-by. No need for qAsConst as QVarLenghArray is not an implicitly shared class. Change-Id: I8a9ec3c76f8f6459a1605b02f4682ab3ce091d1a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML engine: Use QMetaType instead of metatype-id in propertydataFabian Kosmale2020-11-261-1/+1
| | | | | | | | | | | | | | We don't want to convert back and forth between QMetaTypes and ids. This change is the first step towards using QMetaType directly everywhere. By reordering the members of QQmlPropertyData to avoid a gap caused by alignment, we can replace the typeid int with a QMetaType without requiring more space. There are still a few places left using metatype ids, notably the value type logic. Task-number: QTBUG-82931 Change-Id: Ic38f38d10c71ed20655877976c9cb5ee3cbe2d77 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QJSValue: On toVariant() don't try to unwrap function objectsUlf Hermann2020-11-261-0/+15
| | | | | | | | We cannot retrieve anything sensible from those. Therefore, just wrap the QJSValue into a variant. Change-Id: I8acd9fb59a8859c8b2c389efb7934b597a2e479f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow retrieving an imported script from a QML contextUlf Hermann2020-11-251-0/+11
| | | | | | | | | This way you can access the properties or call functions provided by the imported script from C++. Previously there was no way to get to them via public API from outside of QML/JS. Change-Id: Ia7813ef6fbec81898c302809118c31f9dcf0f95e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix crash when calling hasOwnProperty() on proxy objectRichard Weickelt2020-11-241-1/+30
| | | | | | | | | | | Property pointer p needs to be checked for nullptr value in QV4::ProxyObject::virtualGetOwnProperty(). This can happen when calling hasOwnProperty() or propertyIsEnumerable(). Fixes: QTBUG-88786 Pick-to: 6.0 5.15 Change-Id: I43da58fed4d8656f9187213f7317f17398739e34 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Add indent optionsMaximilian Goldstein2020-11-243-39/+343
| | | | | | | | | | | | Adds the ability to use tabs or any amount of spaces for indentation instead of the default of 4 spaces. [ChangeLog][QML][qmlformat] Added option to customize indentation. Fixes: QTBUG-86413 Change-Id: I3c370dda2d0069ef61202a2d862ce15bc513e55e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Expose interface informationMaximilian Goldstein2020-11-232-0/+30
| | | | | Change-Id: Ica3f5c6696542921bc8d399cd46d901ba06f6d83 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqml.h: Add QML_IMPLEMENTS_INTERFACESMaximilian Goldstein2020-11-232-15/+4
| | | | | | | | | | Needed in order to allow for the declarative registration of classes implementing interfaces. Fixes: QTBUG-88623 Pick-to: 6.0 Change-Id: Id9c1ae92774dd9c316ceaa737cb48ef28f56545c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Check qmltypes files in import path for validityUlf Hermann2020-11-221-1/+22
| | | | | | | | Now that we have a module describing the qmltypes format, we can run qmllint on qmltypes files. Change-Id: I23339e52b5081ecb6a2c3b127078389a2b8faab0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Don't crash when importing ES modulesUlf Hermann2020-11-203-0/+11
| | | | | Change-Id: Ica93a3e3fb0eb99be1498f1fcb94b09c113272d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tests: blacklist tst_QQmlImport::importPathOrder() on MSVCLiang Qi2020-11-201-0/+2
| | | | | | | Task-number: QTBUG-88643 Change-Id: I4614e46e9740769660f6c068ed1ff0407378b66b Reviewed-by: Heikki Halmet <heikki.halmet@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tests: blacklist tst_qqmltimer::restartWhenEventPosted() on MSVCLiang Qi2020-11-201-0/+2
| | | | | | Task-number: QTBUG-88626 Change-Id: I5c1621373753fa9dba9c3457d64c6ee5b5f516a7 Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
* Conditionally disable tests that depend on cxx11_future flagTony Sarajärvi2020-11-191-0/+2
| | | | | | | Task-number: QTBUG-88650 Change-Id: I2cac1b8ca7ec8ed8401206cf761244b3f483ca14 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_qqmlproperty: Fix interfaceBinding crash on MSVC 2019Maximilian Goldstein2020-11-182-8/+25
| | | | | | | Change-Id: I4bb4a66b7ccca838e058962bbc297659b273c78e Done-with: Fabian Kosmale <fabian.kosmale@qt.io> Fixes: QTBUG-84416 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_qmllint: Be more verbose when qmllint crashesUlf Hermann2020-11-171-0/+8
| | | | | | | Output the command line, exit status, exit code, stderr and stdout. Change-Id: I81a813bc44b7caf4c25d9097e8fbcbc3295ac6ec Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_qqmlproperty: Skip crashing interfaceBindingMaximilian Goldstein2020-11-171-0/+3
| | | | | | Task-number: QTBUG-84416 Change-Id: I79048233041802fe74e28b07def5ca0a3181c358 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>