summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qsharedpointer
Commit message (Collapse)AuthorAgeFilesLines
* Set the Qt API level to compatibility mode in all tests.Thiago Macieira2012-08-011-0/+1
| | | | | | | | | | | 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: I8129c3ef3cb58541c95a32d083850d9e7f768927 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add some internal API for extracting a QSharedPointer<T> from QVariant.Stephen Kelly2012-06-201-0/+71
| | | | | | | | | | | | | The T must be derived from QObject, or it will fail to compile. This will allow scripting or other 'wrapping' and runtime environments like QtDeclarative to handle QSharedPointers to types derived from QObject properly. A QSharedPointer<T> can be inserted into a QVariant, and where T derives from QObject, a QSharedPointer<QObject> can be extracted from the QVariant, and its properties are then accessible. Change-Id: I68d6d89aceceb019267bd7301baa2047f9c09b90 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Now merge the QtShared::ExternalRefCount class into QSharedPointerThiago Macieira2012-06-121-2/+2
| | | | | | | | | Completing the work of the previous commit: we don't need separate classes. Merge into the main class's body. Change-Id: I2f89b34cb6b7f5f9e8d8b809bebd86656f458644 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Remove "delete value" from QSharedPointerThiago Macieira2012-06-125-111/+38
| | | | | | | | | | | | | | | | | | | | | | | | This allows a QSharedPointer to be used in contexts where the class in question is still forward-declared. This produced a warning in Qt 4 due to the expansion of the template, even if there was no chance of the pointer being deleted there (because the reference count could not drop to zero). Now, not only is the warning removed, but you can actually have the reference count drop to zero in a forward-declared class and it will do the right thing. That's because the deleter function is always recorded from the point of construction and we're sure that it wasn't forward-declared. The unit test for forward-declarations had to be rewritten. The previous version was passing only because the QSharedPointer object was created under the "tracking pointers" mode, which causes a custom deleter to be used in all cases. Task-number: QTBUG-25819 Change-Id: Ife37a4cea4551d94084b49ee03504dd39b8802c1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Add a unit test to QSharedPointer being deleted by a C++11 lambdaThiago Macieira2012-06-121-0/+32
| | | | | | | | | This already worked, but let's have a test so we can be sure it doesn't regress. Change-Id: I358b436d216e3ec4310f05ccf4f70f9e7aad3281 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* avoid redundant testsOswald Buddenhagen2012-06-011-6/+2
| | | | | | | | tryRun() already implies tryLink() and tryCompile(), so there is no point in executing the stages separately ... Change-Id: Id7321efaca474e8c5db2bc246ac26323d8a99e58 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark tst_qsharedpointer as parallel-safe.Rohan McGovern2012-05-291-0/+1
| | | | | | | | | This autotest seems to be parallel-safe. It was not marked as such due to an issue which rarely causes the test to hang on exit on Windows, but that appears unrelated to whether or not the test is run in parallel. Change-Id: I30bac75be3ddc14139594605481eb6af3f6795e7 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Removed CONFIG+=parallel_test from suspected parallel-unsafe tests [2]Rohan McGovern2012-05-231-1/+1
| | | | | | | | | These tests have failed a parallel stress test and may contribute to instability in test runs. Change-Id: Ibbbe01f7d9550b953fc9fbd6ed52fc99fdb5f5d7 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
* QSharedPointer: hash autotest fixGiuseppe D'Angelo2012-04-131-1/+2
| | | | | | | | | | | | | The hash autotest is wrong: it assumed that the iterator on the hash would reach the end after iterating on two elements with identical key. But three elements were added to that hash, and the third one can appear after the other two. That code path is left for the map test only. Change-Id: I51de7987e2b132b6caff7bb4bac6a57fb7fcb530 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qsharedpointer: don't inherit from QSharedPointerMarc Mutz2012-03-231-8/+12
| | | | | | | | | | | | QSharedPointer is about to be made final. Instead of inheriting from it to gain access to the d-pointer, cast it to a layout-compatible struct and access the pointer from there. Assert liberally to ensure layout compatibility. Change-Id: Ifc0fa6a6608e861469286673844325663f4f7fcc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qsharedpointer: Fix auto test fail under Windows 7Debao Zhang2012-03-152-3/+12
| | | | | | | | | | | | | | | | | The tst_QSharedPointer generate another Process to test some invalid codes, and it expect that the prcoess will crash and return a non-zero value. The process which is a console application was linked to windows subsystem, and QProcess seems can not get its return value. This cause the unit test fail. In addition, when the process crash under debug mode, a debug error report-dialog will appear, which is very annoying, so I suppress it too. Task-number: QTBUG-24160 Change-Id: Ia1c872d4515c83b0aa516bcfe3783f59797d2d49 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove HP PA-RISC atomic implementation.Bradley T. Hughes2012-02-131-5/+0
| | | | | | | | | | | This architecture is obsolete and discontinued. Support for PA-RISC can be re-added if needed, but it would be preferred to use the GCC intrinsic support from qatomic_gcc.h (on Linux/HPPA, for example). Change-Id: I952e521a2c8c68840df0d44843b5487d5c20b135 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make it possible to put QObject tracked with QWeakPointer inside QSharedPointerOlivier Goffart2012-02-101-8/+25
| | | | | | | | | | | | | | | | Do that by keeping the QWeakPointer that track QObject independent of the ones that track QSharedPointer. QSharedPointer do not touch the sharedRefCount in QObjectPrivate anymore When converting a QWeakPointer constructed from a QObject to a QSharedPointer, it will display a warning saying one should not do that. Task-number: QTBUG-22622 Change-Id: I3595e3e7401702410776c458687ab357ad9366ab Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fixed qsharedpointer unittest to run from installation directoryKurt Korbatits2012-02-101-1/+1
| | | | | | | | - Only run invalidConstructs() tests if not cross compiled Change-Id: If99fccdf9bca339507ca60c49aa89dc35c535d3d Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Make "nmake check" pass for corelib tests in Windows.Miikka Heikkinen2012-02-091-0/+2
| | | | | | | | | | | | | | | | | | - Marked four tests insignificant due to failures, these need to be fixed later and then re-enabled: - tst_qfilesystemwatcher - tst_qsettings - tst_qlibrary - tst_qsharedpointer - Skipped one invalid case (tst_QCoreApplication::argc()) - Ifdeffed around vsprintf issue in MSVC (tst_QByteArray::qvsnprintf()) Task-number: QTBUG-24157 Task-number: QTBUG-24146 Task-number: QTBUG-24128 Change-Id: I4db957a65fbf0093f5ae3dc1a04d792492818104 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
* Fixed qsharedpointer unittest on windowsKurt Korbatits2012-02-031-1/+5
| | | | | | | - Use source file location as working directory for externaltests Change-Id: Ic05259f48eece920b348ccbde9ba80c90dedfdd2 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-308-8/+8
| | | | | | | | | | 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: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-238-8/+8
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Changed qsharedpointer unittest to use build qmake over system one.Kurt Korbatits2012-01-171-1/+12
| | | | | | | | | | - If we can find the qmake belonging to the build, use that instead of qmake from the PATH for compiling subtests. Change-Id: I9445754bb02dab11c3e1bbe9dc459ecc682689a4 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Avoid using 'check' in QSharedPointer test.Stephen Kelly2012-01-091-42/+42
| | | | | | | Avoids conflict with macro on Mac OS. Change-Id: Ia8301f52c879d941eece0fa6ae47a4c21d4e6490 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright year in license headers.Jason McDonald2012-01-058-8/+8
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove QMetaObject guards and deprecate QPointer.Bradley T. Hughes2011-12-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QWeakPointer is superior and preferred. Remove QMetaObject::addGuard(), QMetaObject::changeGuard(), QMetaObject::removeGuard(), and QObjectPrivate::clearGuards(). Implement QPointer using QWeakPointer<T> instead. This changes the behavior of QPointer in 2 ways: - During destruction of a QWidget. Previously, the destructor of QWidget would reset all QPointers so that they would return zero when destroying children. Update tst_QPointer to account for this change. - When constructing a QSharedPointer to take ownership of an object after a QPointer is already tracking the object. Previously, the shared pointer construction would not be affected by the QPointer, but now that QPointer is implemented using QWeakPoiner, constructing the QSharedPointer will cause an abort(). Fix tst_QSharedPointer by removing the use of QPointer in the objectCast() test. These behavior changes are documented in the QPointer class documentation and in the changes file. Change-Id: I92d0276219c076ece7bcb60f6e1b9120ce4f5747 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Port externaltests.cpp to QTemporaryDirDavid Faure2011-12-071-69/+23
| | | | | Change-Id: I6097ea92dd4b300cb562510e0ea27cee3c01b466 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fix tst_QSharedPointer invalidConstructs:forward-declaration failureBradley T. Hughes2011-12-061-0/+6
| | | | | | | | | | When using clang, the forward-declaration test fails to link, unlike with other compilers. The standard says that deleting a forward-declared pointer is undefined behavior, so the link failure is a valid result of trying to do so. Change-Id: I527b91c15b7d51d9522d95af0630e7dacd26bb30 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove cast and assignment operators from QAtomicInt and QAtomicPointerBradley T. Hughes2011-12-021-2/+2
| | | | | | | | | | | | | | | | | | | This is a source incompatible change. There is concern that the convenience of the implicit cast and assignment operators can lead to misuse. Several commits have already been done that remove excess use of the implicit cast, which is a *volatile* read every time it's used. Users of the QAtomic* API should have to think about when they are loading the value, and if they do or don't need the acquire memory barrier on load. The code that people would write using this API is meant to be multi-threaded, concurrent, and correct. The API should not allow them to inadvertently, possibly unknowingly, shoot themselves in the foot. SC-break-rubber-stamped-by: Lars Knoll Change-Id: I88fbc26d9db7b5ec80a58ad6271ffa13bbfd191f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fixed installation of corelib testsRohan McGovern2011-12-012-2/+2
| | | | | | | | | | | | | | | | | In .pro files, removed wince/symbian-specific DEPLOYMENT cases and replaced them with TESTDATA where appropriate. In .cpp files, removed SRCDIR and relative paths to testdata and replaced them with the QFINDTESTDATA macro where appropriate. Modified test helper apps/libs to install themselves under the test they relate to. This change allows corelib tests to be correctly installed, along with their testdata, via `make install'. Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-251-9/+6
| | | | | | | | | | Bug trackers come and go, so using bug identifiers in function and test case names will ensure that those names eventually become meaningless. It is better to choose a meaningful name and provide explanatory comments where appropriate. Change-Id: I67c27782ef21b5d4eaab4854079a043c8ef6957b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Don't depend on moc to disable test functions.Jason McDonald2011-11-181-11/+7
| | | | | | | | | | | | | | | | | | | | | The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove warnings from deprecated atomic operators in autotestsBradley T. Hughes2011-11-161-1/+1
| | | | | | | | | | | | | Use QAtomic*::load() and ::store() instead of the deprecated cast, assignment, and comparison operators. These will be removed in the near future. The tests for these particular operators have not been changed, though, as the change to remove the operators will also remove the respective tests. Change-Id: I2f24d18992af0c6e0f487d707218e4e84f4bdd12 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-111-5/+4
| | | | | | | | | | | | | Tidy the autotest .pro files. Most autotest .pro files should look like this: CONFIG += testcase TARGET = tst_something QT = core testlib SOURCES = tst_something.cpp Change-Id: I877c2194e9fa9dd13478d117895e1e255a948ad7 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove obsolete MSVC workarounds from autotests.Jason McDonald2011-10-271-19/+0
| | | | | | | | Qt5 doesn't support MSVC versions before 2008, so workarounds for earlier versions are no longer required. Change-Id: I429feff99fe61d286637b960d92fd58962f8aefa Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* corelib: eliminated usage of qttest_p4.prfRohan McGovern2011-10-251-2/+3
| | | | | | | | | qttest_p4.prf was added as a convenience for Qt's own autotests in Qt4. It enables various crufty undocumented magic, of dubious value. Stop using it, and explicitly enable the things from it which we want. Change-Id: I7c1ffe9c8c294dbdc988e1582e580b1ed3f4593e Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Remove SkipMode parameter from QSKIP calls.Jason McDonald2011-10-211-2/+2
| | | | | | | | | The previous commit removed SkipMode from the testlib APi. This commit removes the parameter from all calls to QSKIP. Task-number: QTBUG-21851, QTBUG-21652 Change-Id: I21c0ee6731c1bc6ac6d962590d9b31d7459dfbc5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fail test in preference to calling qFatal.Jason McDonald2011-10-071-4/+2
| | | | | | | | | Calling qFatal may result in test output not being well-formed. Change-Id: Ia16bade4d3311485c6ba4dd23d5624d18b192b71 Reviewed-on: http://codereview.qt-project.org/6190 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Avoid using QSKIP in lieu of compile-time checksJason McDonald2011-10-051-7/+11
| | | | | | | | | | | | | | | | QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9 Reviewed-on: http://codereview.qt-project.org/5942 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Make all uses of QBasicAtomicInt and Pointer use load() and store()Thiago Macieira2011-10-031-40/+40
| | | | | | | | | | | | | | Most of these changes are search-and-replace of d->ref ==, d->ref != and d->ref =. The QBasicAtomicPointer in QObjectPrivate::Connection didn't need to be basic, so I made it QAtomicPointer. Change-Id: Ie3271abd1728af599f9ab17c6f4868e475f17bb6 Reviewed-on: http://codereview.qt-project.org/5030 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove Symbian-specific code from tests.Jason McDonald2011-09-294-11/+2
| | | | | | | | | Symbian is not a supported platform for Qt5, so this code is no longer required. Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa Reviewed-on: http://codereview.qt-project.org/5657 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix the test caseLars Knoll2011-09-172-2/+3
| | | | | | | | | | | | | If the MKSPEC we get is an absolute path, we should pass that one on to qmake. Otherwise it'll try to find the mkspec in the install location. This fails as 'make check' is being run before installation. Task-number: QTBUG-21402 Change-Id: Ie872546f2ee7c5d737e50a1779637e393538ccc2 Reviewed-on: http://codereview.qt-project.org/4999 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Disabled tests for refactor->master integrationJo Asplin2011-09-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | This change disables failing tests to increase the likelihood that 'make check' terminates with a zero exit status. This is done to prevent the CI system from blocking further commits once qtbase#refactor is merged into qtbase#master. Failing tests are marked as insignificant (by putting 'CONFIG += insignificant_test' in the .pro file). Note: This is a temporary measure that needs to be cleaned up once the refactor->master integration is complete. Ideally all disabled tests need to be enabled and passing. All changes will be marked by the string QTBUG-21402 in a comment for easy location. Task-number: QTBUG-21402 Change-Id: Ic4400671671f6d9b75b106a6aa4755b20e74378d Reviewed-on: http://codereview.qt-project.org/4678 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Moving relevant tests to corelib/toolsHolger Ihrig2011-09-0111-0/+3100
Task-number: QTBUG-21066 Change-Id: I650f8f7826b9feea7c1484f06e03e10c68ec2b65 Reviewed-on: http://codereview.qt.nokia.com/3712 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>