aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-6353/+0
| | | | | | | | | | | | | 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>
* Remove QJSValue constructors that take QJSEngine argumentKent Hansen2012-02-021-12/+12
| | | | | | | | | | | Rationale: These were remnants from QtScript. The difference from the standard constructors is that the value is eagerly bound to the engine, so they can be a bit faster. But they are also more low-level and look ugly in use. Task-number: QTBUG-23604 Change-Id: I5dae7452389383f60055d5ccc4f28d53c52f6092 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::propertyFlags() functionKent Hansen2012-02-021-56/+0
| | | | | | | | | | | | | | | | Rationale: The API is incomplete. There is no way to set/update the flags; adding a third (optional) argument to setProperty() is ugly. If necessary, a QJSPropertyDescriptor API should be added, to enable complete setting/querying of properties. The flags were moved to QJSValuePrivate, and the propertyFlags() implementation kept, because there is one place the read-only flag is checked internally (in qv8typewrapper). Task-number: QTBUG-23604 Change-Id: I089dce28dbda428662aac7c8d1536987fe6d855c Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove invalid QJSValue typeKent Hansen2012-02-021-104/+100
| | | | | | | | | | | | | | | | | | | Rationale: It's confusing to have an invalid type (which doesn't exist in JavaScript), and it creates lots of extra cases that have to be handled e.g. in value conversion and comparison. The Undefined type should be sufficient. Also, the invalid value type was being (ab)used to 1) make setProperty() act as a property deleter, and 2) signify that a property queried by property() doesn't exist. The recently introduced functions has(Own)Property() and deleteProperty() now provide that functionality. Default-constructed QJSValues now have the Undefined type. Task-number: QTBUG-23604 Change-Id: I1847492724d31e03ee1212c09ec87a2010920dc5 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSEngine::newVariant() functionKent Hansen2012-02-011-27/+3
| | | | | | | | | | | | | Rationale: This is a remnant from QtScript. There is no reason one should be able to explicitly wrap an arbitrary C++ type in a QVariant. toScriptValue() will automatically wrap the type in a QVariant if it's a type that's not specifically handled by the meta-type system, or if it can't usefully/losslessly be converted to a native JavaScript type. Task-number: QTBUG-23604 Change-Id: I5790cd92b9ffd5fcfbee1cd73a8eaa16fc74846f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSEngine::newDate() functionsKent Hansen2012-02-011-8/+9
| | | | | | | | | | | | | | Rationale: Passing a QDateTime to toScriptValue() should be sufficient, there's no need to have a dedicated factory function for Date objects. QDateTime has API for specifying a time in milliseconds, so the newDate() overload that takes a double argument should be redundant. Task-number: QTBUG-23604 Change-Id: Iec1d4ce8e1fd0a6ebef58dde3141730d27c2fb8c Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::instanceOf() functionKent Hansen2012-02-011-1/+0
| | | | | | | | | | | | | Rationale: This is a remnant from QtScript. There is no good reason for providing this type of low-level "prototype inheritance chain" checks in this high-level QJSValue class. If you want to check if an object is of the "right type", you can check if it has the properties you require using property(). Task-number: QTBUG-23604 Change-Id: I3a274212cc57c38228fab73423af481e1b95d8a5 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* QJS{Engine,Value}: Remove QRegExp-specific functionsKent Hansen2012-02-011-25/+19
| | | | | | | | | | | | | Rationale: QRegExp regular expressions have different semantics than JavaScript RegExp. This can cause data loss and unexpected behavior. qjsvalue_cast() and fromScriptValue() can still be used to convert between QRegExp and JS RegExp. Task-number: QTBUG-23604 Change-Id: Iacf4aaea232aff9e4cecf4afa40753229bc5d643 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::toInteger() functionKent Hansen2012-02-011-1/+1
| | | | | | | | | | | | Rationale: This is a remnant from QtScript. A function called toInteger() that returns a double looks strange. Use toInt32() to convert a QJSValue to an integer. Task-number: QTBUG-23604 Change-Id: I2829704c64b077fca264b660c46248c3f35cb5c0 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSEngine::toObject() and QJSValue::toObject()Kent Hansen2012-02-011-82/+1
| | | | | | | | | | Rationale: There is no compelling usecase for these functions. They are a remnant from QtScript. Task-number: QTBUG-23604 Change-Id: I6d8b4299956dd8f6284934739c4f1a65e4deb64c Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-231-1/+1
| | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6a730abc0c396fb545a48b2d6938abedac2e3f1c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Add QJSValue::callAsConstructor() functionKent Hansen2012-01-201-22/+22
| | | | | | | | | | The old name, construct(), was bad. This name is more descriptive and consistent with the other callXXX() functions. Task-number: QTBUG-23604 Change-Id: Ie205b0c52721782101e665f7dfedcac9051a00d0 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::callWithInstance() functionKent Hansen2012-01-201-11/+11
| | | | | | | | | | | | | | With the deprecated call() overload, it was confusing what the first argument was (the this-object or an actual argument passed to the function). Introduce a dedicated function for the "explicit this-object" case. This makes code more readable, and eliminates the need to pass a "dummy" this-object to call() in the quite common case where you don't care about the this-object. Task-number: QTBUG-23604 Change-Id: I18f8be6592a848436351516bea266fc7e9195777 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::call() overloadKent Hansen2012-01-201-11/+11
| | | | | | | | | | | | This overload takes only an argument list, not a this-object, since that is a very common way of calling stand-alone ("non-member") functions. Now there is no longer a need to pass a dummy value for the this-object. Task-number: QTBUG-23604 Change-Id: Iae952d91fce5bcaa62a05b9978c15f32802da90a Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::isCallable() functionKent Hansen2012-01-201-85/+85
| | | | | | | | | | | This replaces the isFunction() function. isFunction() will be removed. It's possible that objects are callable even if they aren't Function instances. Also, "isCallable" is consistent with call(). Task-number: QTBUG-23604 Change-Id: I42e0ab2ad9dc84e7793199254bbd89d5c9466e6a Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::toInt() and toUInt()Kent Hansen2012-01-201-112/+112
| | | | | | | | | | These replace toInt32() and toUInt32(), which are obsolete and will be removed. Task-number: QTBUG-23604 Change-Id: I83c055dbbe399fa7242889cee8a177440a693d9a Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Use QGuiApplication, not QApplication, in testsDamian Jansen2012-01-131-3/+3
| | | | | Change-Id: I7802293e6cafb90686c103972bc036cf74184714 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Remove obsolete toBoolean() and isBoolean() QJSValue gettersSimon Hausmann2012-01-111-33/+33
| | | | | | | We should use "toBool" and "isBool" for consistency with QVariant. Change-Id: I266f2a36a034a5b323e614777ceacbc0d2ffec16 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I0a8d99909cac867dce72da70b1bbcb649989a51b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix that QJSEngine cannot be used from threads other than the gui threadSimon Hausmann2011-12-151-0/+30
| | | | | | | | | | | | | Implicitly allocate & enter an isolate per thread if needed, store it in TLS and exit it upon thread destruction. As the code that represents QObject dependencies in the GC through implicit dependencies uses its own context, its per-thread data is folded into the v8engine TLS to ensure that it is destructed before the isolate is exited. Task-number: QTBUG-23099 Change-Id: I86538b54939b2fe64db843052eac04c7fd31813e Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Remove TESTED_CLASS/TESTED_FILES comments from tests.Jason McDonald2011-12-061-3/+0
| | | | | | | | | These comments were mostly empty or inaccurate. Appropriate naming of tests and appropriate placement of tests within the directory tree provide more reliable indicators of what is being tested. Change-Id: If69bdb39fd162d167cb948ddcbb73503b414e791 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QtDeclarative: Fix warnings in tests.Friedemann Kleint2011-11-281-5/+6
| | | | | | | | | | | - Unused parameters - Missing interfaces - tst_QQuickListView: Fix call canvas->rootContext()->setContextProperty to use a QVariant (instead of implicitly converting to QObject*) which was apparently intended. Change-Id: Idc95d9408051e6f5b7005a7eccd764ac218ff867 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Make compile and pass CI tests.Michael Brasser2011-11-111-1/+0
| | | | | Change-Id: Ie2ec20d9e346ccaf698762d6abf0224c39fb3490 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove Q_WS_*, symbian and maemo code in QtDeclarativeDamian Jansen2011-10-261-3/+1
| | | | | Change-Id: If64daf80f9d19973e0bc2d864b003a66be5ca61d Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Remove SkipMode from qtestlib API.Jason McDonald2011-10-211-7/+7
| | | | | | | | | | The SkipMode parameter to QSKIP has been removed in qtbase, therefore it must also be removed here. Task-number: QTBUG-21851, QTBUG-21652 Change-Id: I8016f8c28338b1b532bdb593c796d699b99250dc Reviewed-by: Charles Yin <charles.yin@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Skip failing tests.Martin Jones2011-10-201-0/+6
| | | | | | | | Possibly due to V8 update. Task-number: QTBUG-22238 Change-Id: Ide61c6693726e7b21766cac1166716a3af97e9d5 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix QJSEngine::newQObject ownership behaviourSimon Hausmann2011-10-061-22/+18
| | | | | | | | | | | | | | Ensure the indestructible flag is set to false for objects wrapped through QJSEngine::newQObject, to ensure that they get deleted upon gc when they don't have a parent. Re-enabled the QJSEngine::garbageCollect and ownership auto-tests that verified this behaviour. Change-Id: I181bff0cc44d071d650a2f73494e49cce6ad538e Reviewed-on: http://codereview.qt-project.org/2398 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Remove Symbian-specific code from tests.Jason McDonald2011-09-301-6/+0
| | | | | | | | | | Symbian is not a supported platform for Qt5, so this code is no longer required. Change-Id: I5cb6d3b41fbb9fa5fea6176ad949e4e7be7c30b5 Reviewed-on: http://codereview.qt-project.org/5767 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix missing/outdated license headers.Jason McDonald2011-09-161-17/+17
| | | | | | Change-Id: Ib5f244a61cb65db829ee83ec9e4d5e4189319a9f Reviewed-on: http://codereview.qt-project.org/4936 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Don't enumerate Function.prototype.{connect,disconnect}Kent Hansen2011-08-261-0/+19
| | | | | | | | | | | | | | | QML/JS adds connect and disconnect methods to the standard Function.prototype object. Follow the convention of ECMA-262: Function properties should be non-enumerable. In particular, we don't want such built-in properties to show up in user code "for-in" statements. Task-number: QTBUG-21120 Change-Id: I416106badf35daddf32e16f757d37b2b09e58310 Reviewed-on: http://codereview.qt.nokia.com/3587 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Enable tst_QJSEngine::stacktrace test.Jedrzej Nowacki2011-08-021-21/+21
| | | | | | | | | The test can be enabled because QJSValueIterator is back. Change-Id: I33a84b0e584137ecff0d65c2a6152ca972e863f1 Reviewed-on: http://codereview.qt.nokia.com/2440 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Enable globalObjectProperties_enumerate test.Jedrzej Nowacki2011-08-021-11/+4
| | | | | | | | | The test can be enabled because QJSValueIterator is back. Change-Id: I81220ea17470663dab799eb818168480d2df1a54 Reviewed-on: http://codereview.qt.nokia.com/2439 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Merge the QJSEngine and QJSValue development branch into master.Simon Hausmann2011-07-291-0/+6491
This replaces the dependency to QtScript with two new builtin classes QJSValue and QJSEngine. This is still work in progress, development continues now in the master branch. Change-Id: I7f5487feb45c972f25a22b10cc81b9218b9805de Reviewed-on: http://codereview.qt.nokia.com/2299 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>