summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue/tst_qscriptvalue.h
Commit message (Collapse)AuthorAgeFilesLines
* Usefully convert from QtScript object/array to QVariantKent Hansen2010-06-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For arrays, the conversion would crash if the array was cyclic. Introduce a set that keeps track of which objects are being converted, and return an empty list when a cycle is detected. For other types of objects, the object was previously attempted to be converted to a primitive, which typically meant you would get the string representation ("[object Object]"), since most (practically all) objects can be converted to a string -- not useful at all. Change the conversion so it converts the object to a QVariantMap instead. This was already done for slots that took a QVariantMap as argument, but only one level deep. Make the conversion recursive, using the same mechanism as for arrays to detect cycles. This change also means that you get a meaningful JS object => QVariant => JS object roundtrip. It also aligns the behavior with the Qt WebKit bridge. Update the documentation to describe the new behavior. The 4.7 changelog will also be updated under "important behavioral changes". This change exposed an issue with one of the QML autotests: A JS object was assigned to a QVariant property, which caused it to be converted to a string (rather than a QVariantMap) -- just shows that the previous behavior was unintuitive). Later, this variant property is compared to another object, the intention being to compare the _properties_ of the two objects; but because the variant property contained a string, this would cause the other operand (object) to be converted to a string as well ("[object Object]"), causing a meaningless test pass. Change the test to deserialize both objects using JSON.stringify, and compare the resulting strings, so that actual JS object => QVariant(Map) => JS object roundtrip is tested (the intention). Task-number: QTBUG-3511 Reviewed-by: Olivier Goffart
* Reduce compiling time of QScriptValue autotest suite on Windows.Jedrzej Nowacki2010-03-041-0/+2
| | | | | | | | | | | | | The QScriptValue autotest suite compiles about 24 min with MSVS2008, which is unacceptable. Tests were splited into a few files for better use of distributed compilation. Repeated calls to insert() and operator<<() where replaced by loops, that should reduce time of code optimizing. Reviewed-by: Kent Hansen
* Update of the QScriptValue autotest suite.Jedrzej Nowacki2010-02-251-6/+6
| | | | | | | The test suite was updated after changes in dataset of autotest generator. New test were added: isVariant, isQMetaObject and isQObject. Reviewed-by: Kent Hansen
* Add auto-generated tests for QScriptValueKent Hansen2010-02-021-0/+410
tst_qscriptvalue_generated.cpp was generated by Jedrzej's generator (see testgen subdirectory). The idea is that the old isXXX and toXXX tests will be replaced entirely by the auto-generated versions, but we keep them for now (with "_old" suffix) until we are sure that the auto-generated versions cover everything.