aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript
Commit message (Collapse)AuthorAgeFilesLines
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-24374-13974/+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>
* Add test verifying that QObject-derived pointer is passed correctly.Matthew Vogt2012-02-222-0/+57
| | | | | | | | Ensure that an object derived from QObject is correctly passed to an invokable function from QML. Change-Id: I71eefe8c480e1f1574804d05244b53f29c7fbf0d Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix warnings in sequence wrapper codeChris Adams2012-02-153-0/+133
| | | | | | | | | | | | | | | Previously, the sequence wrapper had unsigned int / signed int comparisons (due to Qt container classes only allowing signed int indexes (where negative indexes are invalid). This commit ensures that unsigned indexes are bounds checked appropriately, and also fixes a warning due to QString construction from QByteArray. Finally, it updates the documentation for sequences to clarify the indexing semantics. Change-Id: I4c6e133bef6e980a9ccb62ff15a70a5d41537ee3 Reviewed-by: Martin Jones <martin.jones@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Check dynamic slot function for nullness before evaluationChris Adams2012-02-092-0/+29
| | | | | | | | | | | | | | Previously, we didn't check whether the function object handle associated with a dynamic slot's method index was null before attempting to evaluate it, which could cause a crash in some circumstances. This change also adds better error reporting during function compilation. Task-number: QTBUG-24064 Task-number: QTBUG-24037 Task-number: QTBUG-23387 Change-Id: I3c5e35e8c16187870125736013a5935fcc5cb1f2 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Handle exceptions while compiling v8 bindingsChris Adams2012-02-092-0/+33
| | | | | | | | | | | | | Previously, no exception handling existed, which could cause a crash if an invalid v8 binding expression was generated. Such invalid bindings should usually be rewritten into valid form by the bindings rewriter, but in some cases it is too costly to do so, so we need to handle exceptions. Task-number: QTBUG-24064 Task-number: QTBUG-23387 Change-Id: I7da12a936780a561c9e9cad3a4a7b62c06d6973e Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Fix error in qdeclarativeecmascript autotest.Jason McDonald2012-02-091-5/+2
| | | | | | | | | | | | The test did not correctly ignore warning messages, but instead ignored too many messages for one data row and too few for another data row. This error was exposed when testlib was changed in qtbase commit d9e35e2884cc75969f0eb860082ea11f8bb95a64 to be more strict with checking that all ignored messages are correctly produced. Task-number: QTBUG-24156 Change-Id: Iae73fb26bda83317256c504a8cb3d45783444f66 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Rewrite multiline strings properlyAlan Alpert2012-02-092-0/+46
| | | | | | | | | | | | | | | | Because the bindings rewriter works on code strings, it would leave multiline strings across multiple lines (which is illegal in ECMAScript. It now manually breaks them up when it sees them, by replacing a \n character with a literal \n. Since RewriteSignalHandler now likes to have the AST passed in too, the related method in QDeclarativeCompiler (and its customers) have been altered to use the QDeclarativeScript::Value instead of just a string. Task-number: QTBUG-23387 Change-Id: Id060de37e70590c9da2a902038ed02d948fdd70f Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Disable broken testGunnar Sletta2012-02-081-0/+2
| | | | | Change-Id: I3588153c37ef3d2ced43dba308502dd06428e0a6 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Remove QtQuick1 elements from qtdeclarativeMatthew Vogt2012-02-0317-18/+18
| | | | | | | | QtQuick1 is now contained in a separate repository. Task-number: QTBUG-23737 Change-Id: I09eae67af5693a22b896b916f816f73ccc3a89b1 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-303-3/+3
| | | | | | | | | | 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>
* Improve QRegExp property literal assignment error messageChris Adams2012-01-272-6/+25
| | | | | | | | | | | Previously, the error message given when a string literal was assigned to a regular expression property was not very helpful. This commit adds a better error message. Task-number: QTBUG-23068 Change-Id: Ia57b6434b9cdf009429e7b55edab4ab5c2b91c2a Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Fixed compile.Rohan McGovern2012-01-241-38/+75
| | | | | | | | | QEventLoop::DeferredDeletion was deprecated long ago, and finally has been removed. Replace it with QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete) Change-Id: Ic03f26a57efeb35aefab67a913f56001303aa3e4 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-233-3/+3
| | | | | | | | 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::call() overloadKent Hansen2012-01-201-1/+1
| | | | | | | | | | | | 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>
* Allow QML URLs to contain pre-encoded octetsMatthew Vogt2012-01-183-0/+89
| | | | | | | | | Use QUrl Tolerant parsing mode to permit user-supplied URLs to contain pre-encoded octets which are not mangled by string conversion. Task-number: QTBUG-22756 Change-Id: I4b160b04340b95221d1eb3336bda8c0b38d2e232 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-053-3/+3
| | | | | Change-Id: I0a8d99909cac867dce72da70b1bbcb649989a51b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix test failures with shadow builds.Andrew den Exter2012-01-031-4/+4
| | | | | | | | | | QFINDTESTDATA uses __FILE__ to determine the source directory, which means it finds the wrong source directory when the macro is used from a shared base class. Define the correct source directory in a pri file and include that wherever QDeclarativeDataTest is used. Change-Id: If3ef435f4bb3049733f49402338303c8b440f1fa Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Handle exceptions inside QV8QObjectConnectionList::qt_metacallChris Adams2011-12-292-0/+39
| | | | | | | | | Previously, exceptions were not handled in the connectionlist. This could cause v8 to assert under certain circumstances. Task-number: QTBUG-23375 Change-Id: Ie5f043b50bb6b02a77be464ca18ea8e3bbb0f501 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Fix crash in var property setterChris Adams2011-12-233-0/+14
| | | | | | | | | | | Previously, the function didn't terminate after calling the setter recursively, as it should have. This patch ensures that the setter is called correctly and then returns, and adds a unit test to ensure that no regression occurs. Task-number: QTBUG-23330 Change-Id: If512fca174e5224c2c53caad11f77782e6cead9f Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* QDeclarative tests: Introduce base class for data tests.Friedemann Kleint2011-12-212-315/+312
| | | | | | | | | | | | | | | | | In tests/auto/shared/util.* replace macros/find functions by a base class QDeclarativeDataTest with accessors for the data directory helper functions to create URLs from it. The class relies on QFINDTESTDATA, which is the standard way of locating test data. Using the class should reduce the number of calls to QFileInfo.exists(), etc significantly. In addition, provide utility functions for messages. Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Change-Id: Id2beacb157922ee9412f9e45cf9695cec1f8379a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Correctly resolve elements of QList<QUrl> propertiesChris Adams2011-12-192-0/+61
| | | | | | | | | | Previously, the value of a QList<QUrl> sequence was only resolved if there was only one element in the sequence. This commit ensures that all elements in the sequence are resolved correctly. Task-number: QTBUG-23131 Change-Id: Id27748853fe01ae22800fbd02d062e268ad7ec70 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Remove another fragile assumption from var prop unit testChris Adams2011-12-191-1/+2
| | | | | | | | | Commit 32c6ba2c3802bfda11e455c8aaaee41662c237fb removed hardcoded prop indices from one test, but missed another test case which also hardcoded a property index. Change-Id: Iaac863f8176d09077ce1773b642cb88a01cc3fd1 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* V8: Remove extra V8::Context allocated for expressing strong referencesSimon Hausmann2011-12-152-5/+29
| | | | | | | | | | | | Moved the Referencer code into QV8Engine and re-used the available v8 context there. That also makes things a bit cleaner in the sense that now references from one object to another are guaranteed to be within the same context. Previously some strong references would be across contexts that do not actually share a security token. Change-Id: I717b27a4d96323feb570023d4d84f2b2176d1a84 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Add support for QUrl types to V4Roberto Raggi2011-12-153-0/+38
| | | | | | | | | | | | | Extended the V4 instruction set with instructions to `fast convert' url registers to string and bool registers and `resolve' urls using QDeclarativeContext::resolvedUrl. Also, made IR::UrlType a special `string' type. It's a little trick to ensure that the compiler will generate correct conversions for the binary expressions. Change-Id: Ibc9e5b99302bd513f0cc52b598a1b198b11d4d30 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Remove fragile assumption from var properties unit testChris Adams2011-12-151-2/+2
| | | | | | | | | Previously, the test included some hardcoded property index values which would break if the layout of an item changed. This commit ensures that the index of the properties are looked up dynamically. Change-Id: I5a499f81a0cb859d89f0972eb7cd645107336bc9 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Cleanup: Fold QV8GCCallback class declaration(s) back into qv8engine_p.hSimon Hausmann2011-12-142-2/+0
| | | | | | | The implementation lives in qv8engine.cpp. Change-Id: I2898556fea867cdc82ea534eaf020dd8d12b25d6 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Get rid of QDeclarativeMetaType::{canCopy,copy}Kent Hansen2011-12-093-0/+46
| | | | | | | | | | | | Now that we have QMetaType::construct() that does placement new construction, we can use that to copy the value. We need to destruct the (default-constructed) existing value first, but for primitive types that's a no-op, and for Qt's types it's cheap since they use lazy initialization or "shared null". Change-Id: Idadee04b1d5b590be7fec50fb0396fd277bee973 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Fix QObject V8 wrapping for extended typesAaron Kennedy2011-12-072-0/+30
| | | | | | | | | | The meta object for extended types must be marked as dynamic, to prevent their properties from being marked as IsDirect. Task-number: QTBUG-22997 Change-Id: I825f94f072cb46981706221a1044c9e2feeedcc2 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Ensure that scarce resources work with var propertiesChris Adams2011-12-0646-100/+832
| | | | | | | | | | Now that we have a new property type which stores JavaScript handles, we need to ensure that scarce resources can be used with them. Task-number: QMLNG-18 Task-number: QTBUG-21843 Change-Id: I4a920ae39e7d33cf5e33362e5e0ee21c74cb35e3 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Document function limitation of var propertiesChris Adams2011-12-061-0/+9
| | | | | | | | | | | Functions cannot be assigned to var properties due to the fact that such an assignment signifies a binding assignment. This limitation needs to be documented. One workaround is to assign an array which contains a function element to a var property, and this commit also adds a unit test to ensure this works. Change-Id: I02363b88233282106ac6d26f14df1988155057b9 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Say hello to QtQuick moduleKent Hansen2011-12-022-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change moves the QtQuick 2 types and C++ API (including SceneGraph) to a new module (AKA library), QtQuick. 99% of this change is moving files from src/declarative to src/quick, and from tests/auto/declarative to tests/auto/qtquick2. The loading of QtQuick 2 ("import QtQuick 2.0") is now delegated to a plugin, src/imports/qtquick2, just like it's done for QtQuick 1. All tools, examples, and tests that use QtQuick C++ API have gotten "QT += quick" or "QT += quick-private" added to their .pro file. A few additional internal QtDeclarative classes had to be exported (via Q_DECLARATIVE_PRIVATE_EXPORT) since they're needed by the QtQuick 2 implementation. The old header locations (e.g. QtDeclarative/qquickitem.h) will still be supported for some time, but will produce compile-time warnings. (To avoid the QtQuick implementation using the compatibility headers (since QtDeclarative's includepath comes first), a few include statements were modified, e.g. from "#include <qsgnode.h>" to "#include <QtQuick/qsgnode.h>".) There's a change in qtbase that automatically adds QtQuick to the module list if QtDeclarative is used. Together with the compatibility headers, this should help reduce the migration pain for existing projects. In theory, simply getting an existing QtDeclarative-based project to compile and link shouldn't require any changes for now -- but porting to the new scheme is of course recommended, and will eventually become mandatory. Task-number: QTBUG-22889 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Change-Id: Ia52be9373172ba2f37e7623231ecb060316c96a7 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
* AutotestAaron Kennedy2011-12-013-0/+18
| | | | | | Change-Id: I796ef5e0d70a7e3a95858468583c4ecb447991ee Task-number: QTBUG-21864 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Take multi-line expressions into account when rewriting expressionsKai Koehne2011-12-012-5/+8
| | | | | | | | Take into account the newlines expressions might have when combining multiple expressions into one. Change-Id: Ib7170f624b6b6dee522e2d376a513ac08a8baa46 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Ignore test warningsAaron Kennedy2011-12-011-1/+13
| | | | | Change-Id: Ib22ea43970e2e4c9635063dc3af6d6f130cc2a18 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Add support for assigning literal value to sequence propertyChris Adams2011-12-017-0/+153
| | | | | | | | | | | | | | | | | It is a language semantic that we allow clients to assign a single value to a sequence/list property (assuming that the types match). Now that we support sequence types, this commit adds support for this semantic by determining whether the built-in type of the literal corresponds to the associated sequence (eg, int for QList<int>, qreal for QList<qreal>, bool for QList<bool>, QString for QStringList etc). Similarly, some value types can be constructed from literal string values (via string converters) and these need to be handled also. Task-number: QTBUG-18062 Task-number: QTBUG-21770 Change-Id: Iacd91b2af122cd8f20b7df2fa6056a7d7c52bf53 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Extend the grammar of QML binding declarations.Roberto Raggi2011-11-307-0/+147
| | | | | | | | | This allows the use of non-iterative statements on the right hand side of a binding declaration. Change-Id: I60fac880766ba99a410b3647e41b1252677a372f Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Fix the evaluation of JS switch statements in QML bindings.Roberto Raggi2011-11-296-0/+264
| | | | | | | Task-number: QTBUG-17012 Change-Id: Ic132cf63ed08592fec9c759df1b8b4d5830acea6 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Add indexed deleter to sequence wrapper, implement length setterChris Adams2011-11-292-6/+47
| | | | | | | | | | | | | | | | | | Previously, elements could not be deleted from sequences directly without reassignment. This commit adds an indexed deleter which allows elements to be deleted by specifying an index. A deleted element will be replaced with a default-constructed element in the sequence (slight departure from ECMA262r3 which specifies that it should be replaced with Undefined). This commit also implements the length property setter according to the requirements on Array [[Put]] by ECMA262r3 which allows removal of elements from a sequence (required for proper behaviour of Array.prototype methods such as splice() and pop()). Task-number: QTBUG-22808 Change-Id: I62511b3edc2ec35f92d2a2bd719278e129c98547 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* ConsoleAPI: Use environment variableAurindam Jana2011-11-241-4/+3
| | | | | | | | | Show detailed information, such as file and line number, for console.log, console.debug and print when the environment variable QML_CONSOLE_EXTENDED is set. Change-Id: I8f660f58d0fd08971ce9706b4a418ed60f312980 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Don't crash when importing script with syntax errorKent Hansen2011-11-235-0/+64
| | | | | | Task-number: QTBUG-22843 Change-Id: I2b1ed6cbbc7a566f54b441359941ea121a9033ba Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Fix default property preventing signals from being emitted.Glenn Watson2011-11-222-0/+35
| | | | | | | | | | | | Change the way connectAlias works so that even if the target for the connection is not available immediately, anything that is bound to it is notified when the target is changed. (Fix is authored by Aaron). Task-number: QTBUG-21580 Change-Id: Ida23c0e620069c50b123c71b5078929d4c7ec4e4 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add autotest for qml/v8 optimization bugKent Hansen2011-11-162-0/+31
| | | | | | | | | | | After a function that accesses a qml context property was inlined, calls to global functions would fail with "TypeError: Illegal invocation". Fixed in qtbase's v8. Task-number: QTBUG-22679 Change-Id: Id6e2604e5151585febfe1b667869dc3b1fad6e5e Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Allow aliases to QVariant propertiesAaron Kennedy2011-11-162-1/+28
| | | | | | Task-number: QTBUG-22464 Change-Id: I449d4fc709d34a69116258660d721596cd9b778b Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Fix parsing of unary expressions.Roberto Raggi2011-11-142-0/+17
| | | | | | | | | | | | | | | | | | | | Prohibit the lexer to synthesize a semicolon token after the colon-sign of a binding declaration. The parser internally was rewriting the following bindings Component.onCompleted: ++foo as Component.onCompleted: ; ++foo Task-number: QTBUG-21310 Change-Id: I0558d17fd81b5abac81fb990502d49767ea40730 Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* QV8Engine: Console APIsAurindam Jana2011-11-111-2/+4
| | | | | | | | | Modified functionality for console.log, console.debug. Added script and line information. Added functions console.warn and console.error. Change-Id: Id9f4dce5658a09b00522f8e087caf8f4242f418a Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Remove unused codepaths from QV8SequenceWrapperChris Adams2011-11-113-3/+18
| | | | | | | | | | | | The object equality comparison callback does not allow an object with a sequence resource to be equal to an object with a variant resource. As such, the SequenceType::isEqual(QVariant) codepaths are not needed. Also, QVariantList conversion is handled by toBasicVariant() in the QV8Engine, and thus we don't need conversion code for this type in the sequence wrapper. Change-Id: I2ec599c5ad6cfdb715cd4e0aae3f0cc3bb36cfdf Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Make compile and pass CI tests.Michael Brasser2011-11-111-1/+1
| | | | | Change-Id: Ie2ec20d9e346ccaf698762d6abf0224c39fb3490 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Include correct line number when throwing an exception from a slotAaron Kennedy2011-11-084-1/+28
| | | | | | Task-number: QTBUG-20344 Change-Id: I25be1520b55ce13d4e1c75e06effa1dee8530a7a Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Skip the captured properties step in bindingsAaron Kennedy2011-11-045-1/+77
| | | | | | | | | | Objects and notifiers in the capturedProperties list were not guarded which can lead to crashes if they're deleted prior to the binding completing. Now the notifiers are connected to and guarded immediately to prevent this. Change-Id: I912e323c52bf6169fb5077e552d5d38d9aa7faec Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Add support for more sequence typesChris Adams2011-11-0214-0/+1008
| | | | | | | | | | | | | | | | | | | | | | | This commit adds support for more sequence types by adding a sequence wrapper. This class enables conversion between v8::Array and C++ sequences of various types (currently just QList<int>, QList<qreal>, QList<bool>, QList<QString>, QList<QUrl> and QStringList), but more types can be added later if required). When a JavaScript object is created from such a sequence, its prototype object is set to the v8::Array prototype object. The indexed setter, indexed getter, length and toString methods are implemented directly or in terms of the underlying sequence resource. Note that currently, sequences of ValueTypes are NOT supported, due to the fact that operations like: someObj.someValueTypeSequence[i].x = 5; would not behave as required. Task-number: QTBUG-20826 Task-number: QTBUG-21770 Change-Id: I36deb448fb0e87a32084a900e70a2604ff369309 Reviewed-by: Chris Adams <christopher.adams@nokia.com>