summaryrefslogtreecommitdiff
path: root/tests/auto/qscriptengine/tst_qscriptengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix license headersJani Heikkinen2018-01-151-17/+12
| | | | | | | | | | old header.LGPL21 was used in some src and test files. Replace ones in src/ with correct header.LGPL one and ones in tests/ with correct header.GLP-EXCEPT one. Also add correct license files and remove unnecessary ones Change-Id: Ifc7bb0f25bd9df652ddafe0faceaebd52b495bef Reviewed-by: Liang Qi <liang.qi@qt.io>
* purge symbian vestigesOswald Buddenhagen2016-04-061-6/+0
| | | | | Change-Id: I3e66ce25ea21aa846b44b6f99b8afbe0959a6526 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add verbose messages date conversion tests of tst_QScriptEngine.v5.5.0-alpha1Friedemann Kleint2015-03-111-4/+31
| | | | | | Task-number: QTBUG-44885 Change-Id: Iac155df75cba2402919f30dce2fa794025f396ce Reviewed-by: Frederik Gladhorn <frederik.gladhorn@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: Iffc10aac2cdaf7c7ceba051ec447f15758c3d8e0 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* Update license headers and add new license filesAntti Kokko2014-08-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I8b229a6405aefe7951ad0d13d6432d01a4ec8263 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Autotest: Fix unexpected rounding of floating point in date testsThiago Macieira2013-09-281-2/+2
| | | | | | | | | | | | QString("new Date(%0)").arg(1380318500 * 1000.0) expands to "new Date(1.38032e+12)". That's an unnecessary rounding and cuts off interesting bits out of the date. It took me quite a while debugging QScriptEngine trying to find out why the time_t and the JS Date internal numbers were different. Change-Id: Id880f3f11edd0af07e1726eac0242d4a9625c368 Reviewed-by: John Layt <jlayt@kde.org>
* Revert "Skip failing qscriptengine tests on Windows."Thiago Macieira2013-09-281-6/+0
| | | | | | | | | | This reverts commit eff4a0f3fca2e22d4be888cdd7953e1c2ab8c918. That commit disabled a test that had a legitimate failure, caused by a QDateTime regression. Said regression was fixed by qtbase commit 475cbed2446d0e3595e7b8ab71dcbc1ae5f59bcf. Change-Id: I1212dc8414d5a0d8d87bbe2e2a667475fd30414c Reviewed-by: John Layt <jlayt@kde.org>
* Skip failing qscriptengine tests on Windows.v5.2.0-alpha1Mitch Curtis2013-09-241-0/+6
| | | | | | | Task-number: QTBUG-33622 Change-Id: Id719eadf3caa5ed34850ae189652f26eed7a6aea Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Revert "Don't remove milliseconds now that toString() includes them."Mitch Curtis2013-09-241-0/+2
| | | | | | | | | This reverts commit 37ec5822522baaa5b6e316103477d6da7e6d6a9c, as 15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c was also reverted with: https://codereview.qt-project.org/#change,65560 Change-Id: I73bd91e3ac97384db27107051faead7a8cad3d91 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't remove milliseconds now that toString() includes them.Mitch Curtis2013-06-051-2/+0
| | | | | | | | | | | | | | This patch fixes a test failure introduced by 15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c. tst_QScriptEngine::dateConversionJSQt and tst_QScriptEngine::dateConversionQtJS removed milliseconds from the JS-converted datetime, as QTime::toString() previously did not include them. Now it does, so we can remove this code. Change-Id: Iaddfc050adf8360bee776086b27de001702d221d Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Fix CLANG-warnings.Friedemann Kleint2013-03-081-0/+2
| | | | | | | | | | - Unused member variable. - Unused static functions. - Return false for pointer. Change-Id: Ie78332d3754e7f53ed75d6006c11d60c29719c7b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Doc: Fix module name formatSze Howe Koh2013-01-261-6/+6
| | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation QtScript -> Qt Script QtScriptTools -> Qt Script Tools Change-Id: Icf6b2ea3829247475f8902334b615f9a9206cc51 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: Ic4a2739c8caf2eac95e4a72d8d38cfb912d5fe2b Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-241-24/+24
| | | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Id0b72b8c895b0eab04a740bf83859c9b646dd911 Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Tests: Use qInstallMessageHandlerKai Koehne2012-09-141-4/+4
| | | | | | | qInstallMsgHandler got deprecated in Qt 5. Change-Id: I4da748659f232d8b0fe4b16fe9cf83290762dd2c Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Capture full backtrace when a native function calls back into JSKent Hansen2012-08-221-0/+41
| | | | | | | | | | | | | | | | | | | | | | Commit df0ec196031d33850324dc5eeed2d71f61413885 assumed that JSC's Interpreter::throwException function is called exactly once when an exception occurs. That's wrong. If there is a native call inbetween two JS calls on the stack, the call stack will be unwound to the point of the native call frame, and throwException will return. After the native (C) call frame has been unwound, throwException will be called again to unwind remaining JS call frames, and so on. This was causing QtScript to discard the backtrace belonging to the inner-most JS frames; the backtrace would be regenerated from a partially unwound state. Fix this by ignoring subsequent calls to the uncaughtException() callback once a backtrace has been captured; the backtrace is already cleared before each evaluation is started. Task-number: QTBUG-26889 Change-Id: I03e1d60fbac5e592cff1dd5ef70f397cf94454ae Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Make QScriptEngine::uncaughtExceptionBacktrace() work againKent Hansen2012-08-151-8/+7
| | | | | | | | | | | This function has been broken since Qt 4.6 (when the JavaScriptCore- based back-end was introduced). Fix it by introducing a callback in JSC that allows us to capture the stack when an uncaught exception occurs. Task-number: QTBUG-6139 Change-Id: I4a829323c9fb0c8b2f16a2e5d6f0aeb13cc32561 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove dead code from backtrace autotestKent Hansen2012-08-151-35/+0
| | | | | | | | | | | | With the JSC-based back-end, Error objects don't have a "stack" property, and there is no Error.backtrace() function. Commit a670b4756885b106db04651cd2a7030e02f0cc2f removed all mention of them from the documentation, but not from the autotest; this code wasn't reached anymore because of a preceding QEXPECT_FAIL in the autotest function. Change-Id: Ib34cbd5edff126137cec02bf68624e4a102ace84 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add default conversion for types long and ulongKent Hansen2012-08-141-0/+34
| | | | | | | | | | | | | | Such conversion is not guaranteed to be lossless on all platforms, but it's still reasonable to support these types by default. JSC::JSValue already had constructors for them. The type matching / overload resolution in the QObject binding already handled long and ulong, but the value conversion itself was missing, for some reason. Task-number: QTBUG-2124 Change-Id: I14ff29a8e949403234b7659c0aca8b48bcdbda0e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Move test helper function to separate header fileKent Hansen2012-08-091-15/+2
| | | | | | | | Makes it possible to use the collectGarbage_helper function in other autotests too (e.g., tst_qscriptextqobject). Change-Id: I4fefa36aba13ebf9f931f0e2b90d7ddbc0036a6c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QScriptEngine::pushContext(): Don't inherit parent context's scopeKent Hansen2012-08-081-0/+27
| | | | | | | | | | | | | | This was a regression introduced in Qt 4.6 (JavaScriptCore-based backend). pushContext() should always create a context with a "clean" scope (only the Global Object and the context's own activation object should be in the scope chain). The scope chain API is internal, but the wrong behavior could still be observed e.g. through QScriptEngine::evaluate(). Task-number: QTBUG-18188 Change-Id: I138dabc665d7275fb85d3b5e1b473d56096a989e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Ensure QObject wrappers are garbage-collected if appropriateKent Hansen2012-07-031-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address the "###" comment. When QScriptEngine::newQObject() is called with the option PreferExistingWrapperObject, the resulting wrapper object is cached by the engine, in case it will be needed later (e.g., by a subsequent newQObject() call for the same QObject, with the same wrap options). But if a QObject wrapper object is only referenced by the QtScript internals (i.e., not reachable from the JSC stack/heap, or kept in a QScriptValue), the wrapper should not be kept alive if the ownership is ScriptOwnership, or if the ownership is AutoOwnership and the C++ object has no parent. If the wrapper is marked in that case, it won't get collected, and hence the C++ object will be kept alive, too. In practice, QtScript appears to leak memory (the objects will only be destroyed when the engine is destroyed). Our copy of JSC doesn't have a concept of weak references; the ClientData callback in the JSC markRoots() function (which causes QScriptEnginePrivate::mark() to be called) was moved to the end. This enables the wrapper and connection marking logic to determine whether a wrapper can be safely discarded (if it hasn't been marked by JSC by this point, it must be a weak reference). Task-number: QTBUG-21993 Change-Id: I61f6aafc91f080b80d3f5859148e645b80d9b653 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix crash when converting invalid JSValue to stringKent Hansen2012-06-011-0/+9
| | | | | | | | JSC::JSValue::toString() expects that the input is valid. Task-number: QTBUG-21896 Change-Id: I3199fcba94be5426cb3d193b57d16176daae83a0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove trailing semi-colonKent Hansen2012-05-311-1/+1
| | | | | | | Task-number: QTBUG-22152 Change-Id: Iad9f14ea4bbe401091aa5c56f8ce7abf0e69af8b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Deprecate the Encoding argument of qsTranslateLars Knoll2012-05-211-12/+8
| | | | | | | | | | This is the same as change 4822a821facbbf834c6aab5a8a7da2b3e43f09f7 in qtdeclarative. We always assume the js source code is Utf8 encoded, as also on the C++ side. Change-Id: I4f49484241718dfc4a2bb39a674b54df46aa8c8d Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Skip tst_QScriptEngine::collectGarbageOlivier Goffart2012-05-201-0/+1
| | | | | | | | | | | | This test is blocking CI. It is possible that depending on the optimisation flags, some pointers are still on the stack. This feature is also tested in tst_QScriptEngine::collectGarbageAfterConnect Change-Id: I264f634aa58a002738b8d9c87c43ee1790bb329a Reviewed-by: Toby Tomkins <toby.tomkins@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: I752b02a8155143626d22bd86082177550bd1cfb4 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: I6597406c8041227410e672b86a567e1161a0ab59 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-091-1/+1
| | | | | Change-Id: I323b788326712d95f6213ab8a68c18cfe28b7c76 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove TESTED_CLASS/TESTED_FILES comments from tests.Jason McDonald2011-12-061-3/+0
| | | | | | | | | These comments were mostly empty. Appropriate naming of tests and appropriate placement of tests within the directory tree provide more reliable indicators of what is being tested. Change-Id: I9d15ceb0aab96ceecb0d5d75ef3f7978eb85ba11 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove SkipMode parameter from QSKIP.Jason McDonald2011-10-211-1/+1
| | | | | | | | | | The SkipMode parameter has been removed from the API in qtbase, so it must be in all calls to QSKIP. Task-number: QTBUG-21851, QTBUG-21652 Change-Id: I8579b648437eaa9d4c81deb7ed581d88af11d5b5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix tst_QScriptEngine::dateConversion tests.Jedrzej Nowacki2011-05-261-2/+2
| | | | | | | | The tests were broken by fix to QDataTime::toString that add "Z" at the end of a string representation in ISODate (merge-request 1149 and QTBUG-9698). Reviewed-by: Zeno Albisser
* Update licenseheader text in source files for qtscript Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Remove Q_ASSERT from qscriptengine autotestJason McDonald2011-05-181-1/+4
| | | | | | | | | | | | Rather than aborting in debug builds and failing silently in release builds, output a meaningful warning message and return a null QScriptValue which will cause the "isQObject" check in the testfunction to fail. Change-Id: I69fd9c15a69924d0abfde6710ea6ae4bf7e013fa Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 3b7f3757efb038fe523a00d474d1b92920f9abe8)
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+6140
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12