summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-142-0/+64
| | | | | | | | | | | | | | 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>
* Fix GC issues related to QObject connections and ownershipKent Hansen2012-08-092-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue 1: Even if a sender object was only weakly referenced, the connection's slot function would still get marked. If the slot was a closure, its scope could hold a reference to the sender object, so by marking the closure, the sender would get marked, too - even if there were no other references to the closure outside of the QObject connection structure. This would cause the sender object to stay alive, rather than being garbage-collected (i.e., it leaked). Issue 2: It's possible that a closure used as a slot in a connection for one QObject holds the only reference to another QObject that has connections of its own. In that case, if the first object is explicitly referenced, the second object (and its connections) should get marked. But depending on the order in which the connections were marked, the second object might get treated incorrectly. This commit solves both issues by introducing an iterative scheme for marking connections. The first pass marks only connections whose sender object is referenced elsewhere in the JS environment. The second pass marks connections whose sender object is referenced by slots of the connections marked in the first pass. And so on, until no more connections should be marked. At that point, any remaining unmarked connections are effectively dead (belonging to QObjects that can be reclaimed by the GC). Task-number: QTBUG-26590 Change-Id: I50aa66f7fe407a6827b6f2a12e027275a2fb4655 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Move test helper function to separate header fileKent Hansen2012-08-094-15/+64
| | | | | | | | 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>
* Set the Qt API level to compatibility mode in all tests.Thiago Macieira2012-08-0131-0/+31
| | | | | | | | | | 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: I432719e9520662c9dda5eaa580f0b508de4120fe Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Test that the package configs for QtScript work.Stephen Kelly2012-07-195-0/+97
| | | | | Change-Id: I044409a384a1931c7727cc679fb54a87be627a45 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix QScriptContextInfo::functionMetaIndex() for overloaded slotsKent Hansen2012-07-131-6/+0
| | | | | | | | | | | | | | | | | | This was a regression against the pre-JavaScriptCore implementation, where we used to store the selected method index as an internal member of the QScriptContext(Private). But in the JSC-based implementation, QScriptContext is implemented as a pointer to a JSC::CallFrame, and there are no unused fields in CallFrame where the method index can be stashed. Refactor the Qt method call logic so that the method selection is separate from the actual processing of the target method. This way, QScriptContextInfo can compute the method index the same way that the actual method call did. Task-number: QTBUG-6133 Change-Id: I619fa8b91542d0b6ab5a44b00266cc0705c95823 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>
* Don't crash if queued signal handler no longer existsKent Hansen2012-06-261-0/+33
| | | | | | | Task-number: QTBUG-26261 Change-Id: Ie269c56c0336b1c937d4ec551f913ae7537d0338 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix namespace compilation on macx clang developer build OSX 10.7Toby Tomkins2012-06-211-0/+5
| | | | | Change-Id: Ic111b51472e0252446be4c2db0f991aac1c72e1d Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Skip a test case that started failing after the upgrade to Unicode 6.1Konstantin Ritt2012-06-152-1/+2
| | | | | | | | | | | U+10C1 and U+10CD has been added in the Unicode 6.1 and assigned with general category Lu (Uppercase Letter). toLower(Lu) can never be Lu, thus the failing testcases are just wrong -> omit them. This also avoids using of QUnicodeTables internals in JSC. Change-Id: I6aa6dab686dc3e3556ebe83c395c5d93e42cfb4f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Skip a test case that started failing after the upgrade to Unicode 6.1Lars Knoll2012-06-131-0/+1
| | | | | Change-Id: I6aa6dab686dc3e3556ebe83c395c5d93e42cfb4c Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Disable these tests for nowLars Knoll2012-06-131-1/+1
| | | | | | | | They cause valgrind errors and crashes and it's unclear how they are at all related to QtScript Change-Id: I0bf1d6b047e0770d965a174cd66bfb3d7cad4ac3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* don't reference $$QT_SOURCE/BUILD_TREE - they're unavailable hereOswald Buddenhagen2012-06-062-2/+2
| | | | | Change-Id: I88316acb4cfc867689dfa636dd7554ac0976275f Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Fix crash when accessing QObject properties through activation objectKent Hansen2012-06-011-0/+18
| | | | | | | | | | | | | | | | Since objects in the scope chain have to be JSActivationObjects, QScriptContext::setActivationObject() creates a proxy object that should delegate access to the actual object. This case was not handled in the toQObject() conversion function, so for activation property access through evaluation (where the this-object would be the proxy object, not the actual QObject), the this-object conversion to QObject would fail, and the assert "this-object must be a QObject" was triggered. Task-number: QTBUG-21760 Change-Id: I40e868d9717ec76e0df18d5848c6ad99546ba34f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix scripttools compilation when some features are disabledKent Hansen2012-06-011-0/+6
| | | | | | | Task-number: QTBUG-20378 Change-Id: Ia1dc574824cb1d58c237d60675d1b8a5f8f44c43 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Don't crash in debugger if QScriptEngine is deletedKent Hansen2012-06-011-0/+18
| | | | | | | Task-number: QTBUG-21548 Change-Id: I925a920c8685cf4cf40c7ad03c2d519e2f2121fb Reviewed-by: Kent Hansen <kent.hansen@nokia.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>
* Fix race condition in tst_qsharedmemory autotestKent Hansen2012-05-281-1/+2
| | | | | | | Task-number: QTBUG-25655 Change-Id: I9d0c1498decfe94a84b3ddaba566eac92066e14d Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Deprecate the Encoding argument of qsTranslateLars Knoll2012-05-212-13/+9
| | | | | | | | | | 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>
* qMalloc, qFree and qRealloc are deprecated.Debao Zhang2012-05-201-1/+1
| | | | | | | | Use the stdlib version directly instead Change-Id: Ib289b37c9a00b7da1926e20cc1c1b5a52388fb2f Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.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 the test generator for the test qscriptvaluegenerated.Friedemann Kleint2012-05-1611-1401/+0
| | | | | | | | | | The data will not be re-generated any more since the module is done. See also 58f53b807fafcadf76282f0c8c7f20451c7a97a5. Change-Id: Ida365dbb2e0a70b1cf7d5f0714e5df4cc7084d30 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove large, static QString[] arrays from test qscriptvaluegenerated.Friedemann Kleint2012-05-105-263/+173
| | | | | | | | | | | | They seems to trigger a compiler error for linux-arm-gnueabi-g++ (32bit). Use const char *-arrays and introduce utility functions to populate the static hashes, sets. Fix some string and iterator usage errors. Change-Id: I4e32c6ffa004e141bc04c3a2971c379f71072b38 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Change uses of {to,from}Ascii to {to,from}Latin1Thiago Macieira2012-05-031-14/+14
| | | | | | | | | | This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I4f44512856ea99112d8eb6d341d6058c1fc439dc Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Port qtscript to QMetaMethod-based connectNotify()Kent Hansen2012-05-011-32/+43
| | | | | | | | | | | | | | The const char *-based API is deprecated and will be removed in Qt5. Also improve the autotest so we check precisely the number of connect/disconnect notifications received. The hacks to manually call the notify functions aren't needed anymore, because the internal QMetaObject::(dis)connect() now does it for us. Change-Id: I2e5efed34ee1cba0aad8e60ea00dc9bc2a25bc6c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fixed compile for removal of const from QRegExp::indexInRohan McGovern2012-04-301-1/+1
| | | | | | Task-number: QTBUG-25064 Change-Id: I8adfe68a610a37b667803939553739d64a714c51 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Remove insignification from qscriptjstestsuite test.Jason McDonald2012-04-261-2/+0
| | | | | | | | | | This test has not failed on Windows since CI testing on that platform began. Task-number: QTBUG-24426 Change-Id: I0cafb1bcf94fbd96d81bb4075e045ff434f58d28 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove insignification from qscriptv8testsuite test.Jason McDonald2012-04-261-2/+0
| | | | | | | | | | This test has not failed on Windows since CI testing on that platform began. Task-number: QTBUG-24427 Change-Id: I955eeb23b954d46b3b9170cd58fdc77493ab3476 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Don't use the QRegExp methods that modify the objectThiago Macieira2012-04-241-2/+4
| | | | | | | | | | | | | | QRegExp matching methods modify the object, which we don't want to. In particular, when we receive a QRegExp from the user or we store in a context that might require thread-safety, make sure we make a copy before using it. QRegularExpression has no such shortcoming. Task-number: QTBUG-25064 Change-Id: I4f57d8df2e4de13aa95bb72da53c2565b38ae616 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Adapt qtscript to QMetaMethod::signature() renamingKent Hansen2012-04-171-2/+2
| | | | | | | | | | QMetaMethod::methodSignature() should be used instead, and it returns a QByteArray. Change-Id: I81150e238dab7eda26d0466ac407a4f3ba79a7c7 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Disable qtscriptengineagent autotest for non-developer buildsKai Koehne2012-03-151-1/+1
| | | | | | | | It uses qt_script_isJITEnabled , which is only exported with -developer-build. Change-Id: I1c3d69c82896b8b940b5913629b68227a66f9815 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Make QScriptValue QObject handling consistent.Stephen Kelly2012-03-061-1/+2
| | | | | | | | | | | The behaviour has been inconsistent since ae85d7c965e7d50404c056a77c73bfe00267fa12 in qtbase which added special handling of QObjects to QVariant. Change-Id: Ie75faa3cc3387cff8894cdba025c93f2cc2ea491 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Use new plugin system in QtScript.Friedemann Kleint2012-02-234-2/+9
| | | | | | | | | Add static plugin test and QtDBusScriptPlugin which were left over (see f1653db0f4b7ceba448a39dc16ba45c0f817ef5b). Change-Id: Ifd1e13882f7e39ce724a6e94732b238255ce3128 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Windows: Mark two failing QtScript tests insignificantMiikka Heikkinen2012-02-232-1/+3
| | | | | | | | | Once underlying issues are fixed, the tests need to be re-enabled. Task-number: QTBUG-24203 Change-Id: I38449fd3753f647abaaab24f8928d28fd921cdcb Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Port QtScript autotests to QMetaObjectBuilderKent Hansen2012-02-224-113/+49
| | | | | | | | | The tests were using a custom meta-object builder that generated meta-objects of an old revision. Kill the custom builder and use QMOB instead. Change-Id: I4eeb6f08474f780dead13fc1a9e3605b93973672 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Compile windowsJan-Arve Saether2012-02-201-0/+3
| | | | | | Change-Id: I5adabccb85738f16a13f725ade7fa0e17d565b1e Reviewed-by: Jo Asplin <jo.asplin@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Use new plugins system in Qt Script.Friedemann Kleint2012-02-173-5/+9
| | | | | Change-Id: Ie28cc00899abaa3f42a0f43ed199e3c14d45df3e Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fixed tst_QScriptValue::toQObject for new QVariant cast behaviorRohan McGovern2012-02-091-2/+2
| | | | | | | | | | | | | | | ae85d7c965e7d50404c056a77c73bfe00267fa12 in qtbase allows QObject derived types to be extracted from a QVariant by value<QObject*>(), which was previously not possible. The change also applies to qscriptvalue_cast, so update this test for the new expected behavior. Note that the behavior of QScriptValue::toQObject has not been updated, which means the result of v.toQObject() vs qscriptvalue_cast<QObject*>(v) on the same QScriptValue may now give different results. Change-Id: I70007002dc89d094d76754e58cc9042b4b4f0f67 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-3051-55/+60
| | | | | | | | | | 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-2351-52/+52
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6597406c8041227410e672b86a567e1161a0ab59 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Use QFINDTESTDATA in tst_qscriptextensionplugin.Friedemann Kleint2012-01-131-4/+10
| | | | | | | Find plugins on Windows as well. Change-Id: I013cc74299a6d476d8d5f9554cdee71d4092b4ac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Improve tst_qscriptextqobject.Friedemann Kleint2012-01-101-6/+27
| | | | | | | | - Improve test to output more information on failure reasons should further signals, slots, properties be added. Change-Id: I1a6df8c0689a1082037d43a1d8ddea2d44bbe5ef Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Bypass autotests that currently fail on Ubuntu 11.10 x64.Toby Tomkins2012-01-103-1/+9
| | | | | | | | | | | These tests currently do not pass the CI system. They are bypassed with an associated QTBUG assigned to fix them. Bypassing allows the modules tests to be flagged as enforcing. Task-number: QTBUG-23463 Change-Id: I8ef665b5a62426b6d1cc3b4952a9cc4e4136c2a4 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix Qt IPC-test on Windows.Friedemann Kleint2012-01-098-148/+273
| | | | | | | | | | | | | | | | | | | - Introduce base class for tests using the lackey executable that locates the binary and the scripts and provides convenience functions for error handling and creating arguments. - Simplify .pro files accordingly, make all binaries command line applications (remove QtGui and Mac bundles) - Use absolute paths for scripts and executable. - Remove Windows CE code. - Introduce QTemporaryDir to tst_qsystemsemaphore and create scripts there instead of creating many temporary files. Acked-by: Jo Asplin <jo.asplin@nokia.com> Change-Id: I26dcda98c2372705d19bcb586b8e36cdccebcd41 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fixed compile of tst_qscriptextensionplugin on some Windows configurationsRohan McGovern2012-01-091-0/+1
| | | | | | | | | | | | | | | | | | | The debug and release versions of staticplugin are qmake'd with the same destination directory. This causes the generated staticplugin .prl file to always refer to the debug versions of Qt libraries, even if Qt was configured with -release. The .prl mechanism is not useful for this test, so simply disable it to solve the problem. This commit is cherry-picked from Qt 4 into Qt 5. The problem was hidden until recently in Qt 5 due to a build system bug in qtbase, fixed by 3225942dbb7faaeff477e137af9c3d78fcaf518e. (cherry picked from commit f5a63feb8953799de7e787f333575ee37fae8a3f) Change-Id: I4e88bb0944f83a101445063d59298e49f92451a2 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-0950-52/+52
| | | | | Change-Id: I323b788326712d95f6213ab8a68c18cfe28b7c76 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>