aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Support runtime functions evaluation by index through QQmlEngineAndrei Golubev2021-02-121-0/+35
| | | | | | | | | | | Add execution function that can evaluate runtime functions available in the compilation unit. Private API for now as it's unclear what would be a comprehensive solution to support all existing use cases Task-number: QTBUG-84368 Task-number: QTBUG-91039 Change-Id: Icf755b53484587d7983eaae4821c1aa0111d5c05 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_qqmlengine: remove unused QSKIPSamuli Piippo2021-02-121-4/+0
| | | | | | | | The boot2qt condition is not true on boot2qt QEMU builds and the test passes correctly in CI using QEMU. Change-Id: Ifd87e543168f2dd8639a9287652e606a706f8ede Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove usage of deprecated QStandardPaths::DataLocationKarsten Heimrich2020-10-231-2/+2
| | | | | | Task-number: QTBUG-87037 Change-Id: I1969dba3b6edfaf202a316576674efed481bb1e4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQmlEngine: Add method to explicitly capture a propertyUlf Hermann2020-10-231-20/+33
| | | | | | | | | | Also, use that method to capture the uiLanguage notify signal. Previously the wrong signal was captured. The test still happened to pass because we manually re-evaluated all bindings when the uiLanguage property changed. Add a test which avoid that. Change-Id: I3961b60b365a8705930936f20881421bd4ceffe5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Do not resolve URLs when assigning them to a propertyUlf Hermann2020-06-221-8/+1
| | | | | | | | | | | | | | | We don't know in advance if a URL is part of the source code and should be relative to the current element, or if it is part of the application data and should not be touched. [ChangeLog][QtQml][Important Behavior Changes] URLs are not resolved or intercepted anymore when assigning them to a "url" property. Instead they are resolved and possibly intercepted when used to access an actual resource. Fixes: QTBUG-76879 Change-Id: Iaa2385aff2c13aa71a12e57385d9afb5dc60a073 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix baseUrl returning an empty urlJaeyoon Jung2020-06-101-0/+13
| | | | | | | | | | | Do not append the directory separator if the current path is the root directory. Otherwise it is treated as a remote path incorrectly and an empty url is returned as a result. Change-Id: Icc62114702265e9e1b247624370a78999e564d5f Task-number: QTBUG-83121 Pick-to: 5.15 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix memory leaks in tst_qqmlengineUlf Hermann2020-06-081-16/+17
| | | | | Change-Id: I16f6c0929f6275dfb39c5dca4fbb0061704a15a7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow multiple URL interceptors per engineUlf Hermann2020-03-171-1/+1
| | | | | | | | | | | We may want to have, for example, a QQmlFileSelector and a component-specific interceptor that chooses a theme or similar. Also, make the API public. We want to propose this as alternative to dynamically registering QML files via qmlRegisterType(QUrl, ...). Change-Id: I4a535d3ea556da6710fde816579ec188b3f57099 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix all import versionsUlf Hermann2020-02-191-2/+7
| | | | | | | | | Bump all the *.15 versions to QT_VERSION and use QML_IMPORT_VERSION rather than IMPORT_VERSION. Change-Id: I5bfbc960d119a7386bdcedb9bdbfdbfa4486a187 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* tst_qqmlengine: Don't rename the QObject QML typeUlf Hermann2020-01-271-1/+6
| | | | | | | | | Registering a plain QObject as singleton instance does interesting things to following tests. This didn't break in the CI as the CI then retries the failed tests in isolation, which works. Change-Id: Ieaa898067cb470f3e90f6e9059fb4b4b3a42de00 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Qt.uiLanguage and QJSEngine::uiLanguage propertiesSimon Hausmann2020-01-231-0/+33
| | | | | | | | | | | | | | [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>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-141-0/+31
|\ | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickitemsmodule.cpp src/quick/items/qquickitemview.cpp Change-Id: I02191959a5023c4320f5487a7fb3a71f8711195f
| * On QQmlEngine destruction drop singletons before type loaderUlf Hermann2020-01-101-0/+31
| | | | | | | | | | | | | | | | The singleton destruction can trigger additional types to be loaded. Fixes: QTBUG-80840 Change-Id: Ifa406b2a1cfd3b9e9b36e8005dfc0808eebf15cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-081-0/+10
|\| | | | | | | Change-Id: Ib381f350ada365747ce20b989bfdc368d75f2219
| * qmlRegisterSingletonInstance: Do not crash if instance gets deletedFabian Kosmale2019-10-071-0/+10
| | | | | | | | | | | | | | | | | | | | Use a QPointer, so that we notice if the object has been deleted. Also ensure that in the documentation the function is in a single line, as qdoc will otherwise silently omit it. Change-Id: Idecd370d00089997cd18b3247ad2290a561b2b69 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Clean up tst_qqmlengine.cppFabian Kosmale2019-10-071-11/+14
|/ | | | | | | | - avoid setContextProperty in multiple places - ignore expected warning Change-Id: I0d7ed77ef58f5b7bb40bd633811498f107f4c700 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce qmlRegisterSingletonInstanceFabian Kosmale2019-07-191-0/+40
| | | | | | | | | | This method is intended as a replacement for common setContextProperty use cases, where the user is only using one single engine and has already created the object. Task-number: QTBUG-73064 Change-Id: Ib9ec023a0ad679aa22e90ebcb4a0c07622459c61 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix qqmlengine autotest for androidJan Arve Sæther2019-07-191-5/+9
| | | | | | | | | Most of the fixes are due to the fact that qml files are embedded as resources Change-Id: Ief615fea608a839a4e0a09459cf60f500cbe8c72 Task-number: QTBUG-73512 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split qqmltypeloader{_p.h|.cpp} into a several filesUlf Hermann2019-07-111-0/+1
| | | | | | | No one can read this mess. Change-Id: Icec4f2afc466435c1ae5e4e80fa2c1b5baf7d087 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make sure urlInteceptor() works standaloneJan Arve Sæther2019-07-051-1/+1
| | | | | | | | | | | | It called QQmlEngine::setImportPathList() which removed E:/dev/qt-5d/qtbase/qml from the import path, which again caused it to fail loading because it could not find QtQml module. It worked by accident since other tests before it (such as qtqmlModule) already had QtQml loaded. Change-Id: Ife94fe0c6d5cf612350dd782b12648dcea42608a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Port from QLatin1Literal to QLatin1StringGiuseppe D'Angelo2019-06-111-1/+1
| | | | | | | | QLatin1Literal is an undocumented and deprecated typedef for QLatin1String, just use the original. Change-Id: Ib6e2b7ac369be12aed0e455c91cf31b807eae4ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* add std::function overload to qmlRegisterSingletonTypeFabian Kosmale2019-06-111-0/+19
| | | | | | | | | | | | | | | | | | | | | | This changes enables passing stateful lambdas to qmlRegisterSingletonType, which helps when porting away from setContextProperty. Unfortunately, we cannot directly add an overload for std::function, as this causes ambiguity in the overload set when a lambda of the form auto f = [](QQmlEngine*, QJSEngine*) -> QObject* is passed to the function (which is what the examples do) We therefore use a template to support abribtrary callables f, then SFINAE them out if f is not convertible to the desired std::function, or when f is convertible to a plain C function pointer, thus removing the ambiguity Change-Id: I6ca95ad692d8bb785e420b85bf3d8c1d0007ce17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add test for cached getter lookupMichal Klocek2019-05-091-0/+11
| | | | | | Task-number: QTBUG-75335 Change-Id: I14480018f2429eb5ec744a50640642eee09ce3f3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Re-use existing IC when freezing propertiesUlf Hermann2019-03-271-0/+13
| | | | | | | | | | | | | There is no reason to start from the empty class in that case. Furthermore, if the properties are already frozen, starting from the empty class will walk the IC hierarchy to the current IC. However, if the garbage collector has removed the intermediate classes in the mean time, we end up at a new IC which is equivalent but not the same. Therefore, the freezing never terminates. Task-number: QTBUG-74190 Change-Id: Id544bd00d3b4b563fb06dfce0edd0385e1d32a6c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Provide API to access singletons associated with a QQmlEngineRichard Weickelt2018-06-211-0/+91
| | | | | | | | | | | | | | | | | | | This patch adds allows C++ code to retrieve the instance of a registered singleton type. Until now this required a deturn via QML expression. Two methods are added to QQmlEngine: A generic one that encapsulates all singleton objects in a QJSValue and a template function for QObject-derived singleton types. An additional convenience function is added to query the QML type id. This function may also be used for other purposes in the future. [ChangeLog][QtQml][QQmlEngine] Added API to access singletons associated with a QQmlEngine. Task-number: QTBUG-39970 Change-Id: I67c132ede35f80b9aaf1c5e5456715cf4f1b0848 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devSimon Hausmann2018-06-191-0/+32
|\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/qml/compiler/qv4codegen.cpp tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp Change-Id: I010505326d76ee728ffe5fbd4c7879f28adadb12
| * Formals come after locals in the CallContextLars Knoll2018-05-291-0/+32
| | | | | | | | | | | | | | | | | | | | | | The method updating the internal class for a CallContext messed up the order between locals and formals, leading to wrong name lookups for signal handlers taking implicit arguments Task-number: QTBUG-68522 Change-Id: I36d55b3b0cfe9af6397455782551498b7ddb940a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-041-0/+23
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmltypeloader.cpp src/qml/qml/qqmltypeloader_p.h Done-with: Simon Hausmann <simon.hausmann@qt.io> Task-number: QTBUG-68091 Change-Id: I7c0ab3c9446ac50da07b58f54e24eb4587f7f28c
| * Normalize URL before loading typesErik Verbruggen2018-04-271-0/+27
| | | | | | | | | | | | | | | | | | This prevents loading of types with slightly different paths multiple times, like "qrc:/One.qml" and "qrc:///One.qml". Task-number: QTBUG-65723 Change-Id: I6e26db6d1d271b2ed37b97eb990618843e99c372 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Make sure we call Codegen::defineFunction with proper argumentsLars Knoll2018-05-021-1/+1
|/ | | | | | | | | | | | | | | So far, when instantiating QML bindings, the node parameter could be the same or a child of the body. This will break badly when we introduce lexical scopeing as that node could be an AST::Block that opens it's own context. Changing this requires some smaller adjustments to our autotests, as error locations will now be slightly different (pointing to the beginning of the binding, not the beginning of the RHS of the binding). Change-Id: I2c536a4fe6d8b549a138cc7967ef034eb2523f3b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix calling Qt.createComponent() from QQmlEngine::evaluate()Simon Hausmann2018-03-081-0/+12
| | | | | | | | | | | | | If we're run from a top-level evaluate() call from the JS engine, then let's assume that any created components are top-level components that belong to the root QML engine context. This is not quite a typical use-case, but our API allows for this and this seems like an easy and sensible solution. Task-number: QTBUG-66792 Change-Id: Ic1c9171c257e8e60c0b2c43f9194bd038744ed2d Reviewed-by: Oleg Yadrov <oleg.yadrov@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-27/+27
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Allow exported signal handlers for signals with revisionThomas Hartmann2018-01-121-0/+12
| | | | | | | | | | | | | | | Properties of QML objects or alias properties to QML objects have to know about the revision of the QML type. If the property is used as a grouped property and a signal or property is assigned. Without this patch this is not working with signals that have a revision. To get this working we store the minor version of the QML type in QQmlPropertyData and retrieve the QQmlPropertyCache with the correct AllowedRevisionCache using this minor version. Task-number: QTCREATORBUG-18820 Change-Id: I1e20169e0d5a2ae11059a951aa83a5c94106accb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Enable tests for boot2qtSami Nurmenniemi2017-09-211-0/+4
| | | | | | | | | | | | | | Some tests needed fixing - Disabled tests too heavy for qemu - Skipped tests requiring OpenGL without support from the platform - Skipped tests requiring functionality on broken offscreen platform - Skipped tests that take too long on qemu + software renderer - Blacklisted tests for created bugs QTBUG-63049, QTBUG-63053 QTBUG-63055 and QTBUG-63057 Task-number: QTBUG-60268 Change-Id: I0346b0e436cf286d7d9cbc140acf324a4087cfb9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for enum declarations in QMLMichael Brasser2017-07-131-0/+3
| | | | | | | | | | | | | | | | | Enums can be declared with the following syntax: enum MyEnum { Value1, Value2 } Grammar changes done by Simon Hausmann. [ChangeLog][QtQml] Enums can now be declared directly in QML. Task-number: QTBUG-14861 Change-Id: Ic6b6e032651d01ee2ecf9d5ce5734976cb3ad7ab Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* tst_qqmlengine::clearComponentCache(): Use QTemporaryDirFriedemann Kleint2017-06-081-5/+25
| | | | | | | | | The test used to create a file temp.qml in the working directory. Put it into a temporary directory. Change-Id: I0720a4b4c652c83656505a5dc979660b94503717 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix build of tst_qqmlengineSzabolcs David2017-05-091-0/+1
| | | | | | | | | | | | It fixes the following compile error: tst_qqmlengine.cpp:279:51: error: variable ‘QCryptographicHash md5’ has initializer but incomplete type tst_qqmlengine.cpp:279:28: error: incomplete type ‘QCryptographicHash’ used in nested name specifier Change-Id: I647a5a487d79f201118bfbddd757aa9cece180e4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Add an autotest for GC crashes on some platformsRobin Burchell2017-04-211-1/+10
| | | | | | | | | Related to QTBUG-59977, where crashes were seen on some platforms. Try to prevent this from creeping out and inconveniencing other modules again. Task-number: QTBUG-59977 Change-Id: I89730c7882e4d87e6049f087724988a7aa52d5a5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* add QQmlEngine::offlineStorageDatabaseFilePath(db), use in LocalStorageShawn Rutledge2017-02-021-0/+29
| | | | | | | | | | | This is C++ API to get the actual storage path for a particular database. [ChangeLog][QtQml] Added QQmlEngine::offlineStorageDatabaseFilePath(dbName) to allow getting the actual storage path for a particular database. Task-number: QTBUG-52013 Change-Id: I1cbd9454c537f08c97f4dafc06fd6b14e81c51af Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Enable QML/JS disk cache by defaultSimon Hausmann2016-08-051-0/+6
| | | | | | | Except on Windows, where there is still one bug to fix. Change-Id: I1a22f42859733eedd37596a3e8fc09680720ff10 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Moved resolved type references over to QV4::CompiledData::CompilationUnitSimon Hausmann2016-05-311-0/+5
| | | | | Change-Id: I99bb37bf4d4aa4aedd8e02a0fb4afb4a908573a6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Add delayed property to Binding.Michael Brasser2016-04-081-2/+2
| | | | | | | | | | Provide a way to avoid potentially expensive or unexpected intermediate values. [ChangeLog][Binding] Add delayed property to Binding as a way to avoid potentially expensive or unexpected intermediate values. Change-Id: I6aaca570859cc1344eeb9c9f19f32660e8c0b4e0 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-291-0/+9
|\ | | | | | | Change-Id: Iec1b2de53c275996364c4bab0123ccb3e6e9895e
| * Pass Qt.include() URLs through the URL interceptor if presentKevin Krammer2016-01-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | JavaScript files loaded by the Qt.include() function did not get passed through the QQmlEngine's URL interceptor, while those loaded by import statements did. Now both include variants have the resolved URL passed through the interceptor, e.g. an installed QQmlFileSelector Task-number: QTBUG-50483 Change-Id: Ife75e6b644687f3fb04048a311e570cdcbab8c6d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-201-17/+12
|/ | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I04760a0801837cfc516d1c7c02d4f503f6bb70b6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QML: Fix typeof context property.Erik Verbruggen2015-10-271-0/+14
| | | | | | | | This was missing from f21e8c641af6b2d10f0d7e7e0fc6a755dab3673c. Task-number: QTBUG-48524 Change-Id: I5cc6a979d965a1ef6b7fbc916a7ca9df868b459a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* tests/qml: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).Friedemann Kleint2015-07-291-10/+11
| | | | | | | | | | | | - Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Change-Id: I8cc97fd9b48fc789a849e9527c292c4e05accd97 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Tests: Replace Q[TRY]_VERIFY(v == true|false) by QVERIFY(v)|QVERIFY(!v).Friedemann Kleint2015-07-271-1/+1
| | | | | | | | Preparing the replacement of Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) for non-boolean types. Change-Id: I8a4e44a2b4e20a9c8b811799e3932c8ce1a2cbbb Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>