aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsvalue
Commit message (Collapse)AuthorAgeFilesLines
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-20/+20
| | | | | | | | | | | | | 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>
* Raise minimum supported MSVC version to 2015Friedemann Kleint2018-01-061-4/+0
| | | | | | | | | | | | Remove code for older versions and streamline #ifdefs. Remove the helpers macros Q_STATIC_ASSERT_FOR_SANE_COMPILERS and V4_ASSERT_IS_TRIVIAL. Task-number: QTBUG-40658 Task-number: QTBUG-51673 Change-Id: Ifa4fab653b10ce7858739adef08364cddc6507cf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Simon Hausmann2016-11-152-0/+29
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4string.cpp The conflict resolution for qv4tsring.cpp is to essentially omit the change of commit 64714ea431f2fd355ed27edc69dba4e992511e75 as the code in 5.8 already uses the add/mul_overflow functions. This merge also reverts commit f4ac007f4a19bc095ff15d415a6629986de78e49 as we can deal with dead store elimination now. Change-Id: Iee08c87cbe1a2ff23a73ce621d56262b4e007c56
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-152-0/+29
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qmldevtools/qmldevtools.pro tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp Change-Id: I12255c16716bd8a74e7047cdb1f9302a4d1ea827
| | * QV4String: properly detect overflow when trying to convert to an array indexGiuseppe D'Angelo2016-11-042-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A wrong overflow detection caused strings like "240000000000" to pass the conversion, even though they would not fit into a uint when converted into base-10. This mis-conversion to uint then caused all sorts of side effects (broken comparisons, wrong listing of properties, and so on). So, properly fix the overflow detection by using our numeric private functions. Change-Id: Icbf67ac68cf5785d6c77b433c7a45aed5285a8c2 Task-number: QTBUG-56830 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix conversion of QByteArray back to String in JavaScriptSimon Hausmann2016-08-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 3b7e2a69f7eb8597c807de39b4de39721e9e2bd2 changed behavior so that QByteArray is converted to the JS ArrayBuffer type, which is a better fit than QVariant. However ArrayBuffer does not have a toString method in the spec, and therefore any previous implicit toString conversion such as when passing to JSON.parse() would fail. To restore compatibility this patch adds a non-spec toString() that performs an UTF-8 conversion, as it was done previously through QVariant's toString. Task-number: QTBUG-55562 Change-Id: I096046954f7b29f7258deaa9ef5c8fa9292552ef Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | | QJSValue: Adapt to introduction of QMetaType::NullptrChristian Kandeler2016-08-081-4/+4
|/ / | | | | | | | | | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] A JS null value converted to a QVariant now has type QMetaType::Nullptr rather than QMetaType::VoidStar. Change-Id: I91a64e444ada0f1884fe807f9973348ba1a878ff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Updated license headersJani Heikkinen2016-01-202-34/+24
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Replace all occurrences of qSNaN() with qQNaN()Ulf Hermann2015-12-071-8/+8
| | | | | | | | | | | | | | | | | | | | | | We generally don't want to produce signalling NaNs as those cannot be used in any further arithmetic operations. In particular -(qSNaN()) claims it's not a double. Task-number: QTBUG-49753 Change-Id: I23cec4fec2ddf08c02a7d53db7f3b9ba46b6c288 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-1/+1
|\| | | | | | | Change-Id: I11ea57222ba5aa683b7bfd7735fbc1d2cf86e875
| * Tests: Fix single-character string literals.Friedemann Kleint2015-10-131-1/+1
| | | | | | | | | | | | | | | | Use character literals where applicable. Change-Id: Ib0e618752fbc762a73a0a91c43efab61ef2c9687 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove CONFIG += parallel_test.Friedemann Kleint2015-09-051-1/+0
| | | | | | | | | | | | | | The keyword no longer has a meaning for the new CI. Change-Id: I699f2881e291cce02a6a608a8710638886e38daa Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Tests: Remove QT_DISABLE_DEPRECATED_BEFORE=0 for simple cases.Friedemann Kleint2015-09-022-2/+1
|/ | | | | | | Fix usage of API that is marked deprecated. Change-Id: Ia887437f99b9ce207891ca19bc49294acb7d629d Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* tests/qml: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).Friedemann Kleint2015-07-291-7/+7
| | | | | | | | | | | | - 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>
* Update copyright headersJani Heikkinen2015-02-122-14/+14
| | | | | | | | | 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>
* Fix mapping of JS objects/arrays to C++Simon Hausmann2014-09-171-6/+44
| | | | | | | | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] When a JavaScript object/array is passed to C++ through a QVariant, the engine no longer immediately converts the object recursively into a QVariantMap or QVariantList but instead stores a QJSValue in the QVariant. This prevents a loss of data when the JS object contains non-primitive types such as function objects for example. Code that expects the variant type to be exactly QVariant::Map or QVariant::List may need to be adapted. Registered conversion functions however ensure that code that merely calls toMap() or toList() continues to work. Task-number: QTBUG-40431 Change-Id: I1dbc1d5f8e78ad28bb62db3681b9a0b34557e7f5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-252-38/+22
| | | | | | | | | - 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>
* Fix === operator for value typesLars Knoll2013-11-151-1/+1
| | | | | | | | | Fix === comparison for urls and other QML value types. Task-number: QTBUG-33546 Change-Id: I4a7066e6bbc7de7c599fe2c7b2fdfb75e0ff5196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Properly implement Object.prototype.__proto__Lars Knoll2013-06-131-1/+1
| | | | | Change-Id: I5c3247f46cd86020425f6df8674f8bda7410757b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix a few more QJSValue autotestsLars Knoll2013-06-071-1/+0
| | | | | Change-Id: Ie870da8f6b8f9e34221bbfd10f328df1dc363294 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various errors in the qjsvalue auto testLars Knoll2013-06-071-13/+0
| | | | | | | | | | | | | | Fix creation of Array's from a QStringList Properly implement toVariant() Fix VariantObject::toString() Fix conversion of variant lists to JS values Remove an XFAIL Allow comparison of QJSValue objects created from different engines. There's no reason why we can't simply do this with v4. Change-Id: I8d8c597dbb032926501508d60bd80622ec964d67 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Small fixes to auto testLars Knoll2013-04-191-0/+1
| | | | | Change-Id: Ie18a15601b27c551a2baf13d0f57f72d711dcef2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement most of QJSEngine against V4Lars Knoll2013-04-191-1/+1
| | | | | | | | Also do various fixes in other places, so more of the QJS* autotests pass Change-Id: I39662a2ca1441f778595d260860375c5c628bf8e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-102-2/+2
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Declare QJSValue as a metatype where it is defined.Stephen Kelly2012-12-041-1/+0
| | | | | | | Instead of in multiple different TUs, therefore causing ODR violations. Change-Id: I08d3624d3ed5a995e96488361665afa197fb9fc9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-232-48/+48
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Don't put JavaScript-owned objects on the stack.Thomas McGuire2012-08-241-2/+2
| | | | | | | | | Only the fact that the object wrapper uses deleteLater() instead of delete made this not crash. Change-Id: I034d8c7f24b963be9e031446ffdfa33e6bc266cc Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Set the Qt API level to compatibility mode in all tests.Thiago Macieira2012-08-011-0/+1
| | | | | | | | | | Qt 5.0 beta requires changing the default to the 5.0 API, disabling the deprecated code. However, tests should test (and often do) the compatibility API too, so turn it back on. Task-number: QTBUG-25053 Change-Id: I6988c2360e9d88916311374a0c910bfc5b607439 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add gui-private to testsGirish Ramakrishnan2012-06-221-1/+1
| | | | | | | QWindowSystemInterface will be marked as QPA API. Change-Id: Id174a24f8432219adf1425efe1eb59cf67d48bb9 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Clean up QJSValue tests.Mitch Curtis2012-05-302-1123/+4
| | | | | Change-Id: I967facfbd0b738c3a2938904a094f6312be5dcef Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add CONFIG+=parallel_test to suspected parallel-safe tests.Rohan McGovern2012-05-281-0/+1
| | | | | | | | | | These tests have passed a parallel stress test on all three of Linux, Mac, Windows. Mark them with CONFIG+=parallel_test to allow CI to run them in parallel, saving time. Change-Id: I16407d68c583e6e9b8ef9c536cfee156d56bd2e2 Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Remove QJS exception APIKent Hansen2012-05-031-24/+8
| | | | | | | | | | | | | | | | | This API has been deprecated for a while. It's legacy stuff from QtScript. Until someone proves that QJSValue::isError() isn't sufficient to handle JavaScript exceptions, we won't provide any additional API for that. Also removed QJSValuePrivate::lessThan(), which was using the exception mechanism, but the function itself wasn't used anymore (another remnant from the QtScript days). Change-Id: I3dffc6a7835874153f90d25ae2a72c93ea6db39a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make QVariant conversion for JS null type symmetricKent Hansen2012-03-201-2/+10
| | | | | | | | | | | | | | | | If you pass (void*)0 to QJSEngine::toScriptValue(), or you pass a QVariant of type QMetaType::VoidStar containing a 0 value, you get back a QJSValue of type null (isNull() returns true); that's fine. However, if you called QJSValue::toVariant() on a JS null value, you would get back an invalid QVariant. The expected result is a QVariant of type QMetaType::VoidStar containing a 0 value. This makes the conversion of the JS null type symmetric and avoids loss of data. Change-Id: Ifa6e788152118f80adf9c2d7be1283f053b44294 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Don't allow tst_QJSEngine or tst_QJSValue instance to be collectedChris Adams2012-03-151-13/+21
| | | | | | | | | Both of those unit tests currently change the ownership of the test instance object, which could result in it being collected by the JS GC and deleted if events were processed. Change-Id: I5a9821fb56e19af1d52fea46e54755875dfbb29a Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-243-0/+3865
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>