summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel
Commit message (Collapse)AuthorAgeFilesLines
* Enabled QSystemSemaphore autotestv5.0.0-beta2Oliver Wolff2012-11-081-0/+1
| | | | | | Change-Id: Id7133c46bbde554b2df69edacf9bfe808498a541 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* move QSharedMemory autotest from qtscript to qtbaseOliver Wolff2012-11-076-1/+1058
| | | | | | | | | | | As the script dependency for that autotest is not really needed it should be moved to qtbase. Task-number: QTBUG-27706 Change-Id: Ieda8b2182a20a77f53a0be9878e82e3236c79c2b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Fixed QSystemSemaphore autotest for "check" targetOliver Wolff2012-11-073-5/+21
| | | | | | | | | | As CI runs autotests using the "check" target the approach using DESTDIR = ../ does not work for the test. Instead the binaries are just moved one directory up and QFINDTESTDATA is used to find the path of the helper binary. Change-Id: If1ed2b60821f1de4ac62f238c8af5e09cf0f444a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Allow connect to functors with less parameters than the signalOlivier Goffart2012-11-061-0/+36
| | | | | | | | | | | | | | | | | | | | Before, the functor slot (or lambda expression) had to have the same amount of arguments as the signal. This shown to be a big problem to be able to connect to signals that had a QPrivateSlot. This implementation use the type of the operator() of the functor to know how many arguments we have. As a bonus, we also can check the arguments in a static assert. The test comes from https://codereview.qt-project.org/#change,38703 But this patch also works without variadic template If the compiler does not support decltype, we workaround the lack of it by using another level of indirection. Change-Id: I9850b43e8caf77356a2ec3f4c0b0ed532d96029e Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Fix connection to const slots (or from const signals)Olivier Goffart2012-11-061-0/+13
| | | | | | | | Pointer to const member function have a different signature, and hence need their own traits code. Change-Id: Ie4b2434a412f412444fb07ef1388a37cab105ecd Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* move QSystemSemaphore autotest from qtscript to qtbaseOliver Wolff2012-11-015-0/+411
| | | | | | | | | | As the script dependency for that autotest is not really needed it should be moved to qtbase. Task-number: QTBUG-27705 Change-Id: I4ce0d34aca97cadd79b157b0f7c90c406bed4295 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Test: remove QSKIP in tst_QEventLoop::throwInExec()Caroline Chao2012-10-291-10/+10
| | | | | | | | | Instead omit the whole test when appropriate. Change-Id: I60c34b020f6e25e865bbe0182395d4fc6419f65e Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Core/kernel: Make some signals private.Stephen Kelly2012-10-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | There are more opportunities in QtCore and the rest of Qt to make signals private instead of public. This is a test-dart to see if there is any reason not to do this. It would be nice to make QObject::destroyed private, but as it has a default argument it would be source incompatible to anyone connecting to the SIGNAL(destroyed()) instead of SIGNAL(destroyed(QObject*)). Currently the function-pointer-based connect syntax does not accept a functor (or lambda) with a different number of arguments than the signal. Olivier says a fix for that might come in 5.1, but for now the qfiledialog2 test is changed to not use that anymore. Also, the function pointer for a private signal can not be assigned to a local variable, so the qmetamethod test is changed to not do so anymore. Change-Id: Iaf776b822f9ba364f2c184df0c6b23811da56e44 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* normalise signal/slot signatures [QtCore tests]Marc Mutz2012-10-223-38/+38
| | | | | | | | | | Normalise all signal/slot signatures in tests/*/corelib, except in tst_QObject, where they might be test data. Change-Id: Id4e101f285b1676bb583b0afae06d235e599e24b Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Test: remove QSKIP from tst_QSocketNotifier::posixSocketsCaroline Chao2012-10-161-4/+5
| | | | | | | Instead omit the whole test when Q_OS_UNIX is not defined. Change-Id: If0ee3345c25f6b1baa38845edfd08ec26a45d6f2 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* Test: remove QSKIP in tst_QCoreApplication::argcCaroline Chao2012-10-161-3/+6
| | | | | | | | Instead omit the whole test when Q_OS_WIN is defined since the test is invalid on this platform. Change-Id: Idb77df96b0c2a223cddbfffb4e24c6d1f5d33dfb Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* Make documentation of QVariant::isNull more explicit.Jędrzej Nowacki2012-09-291-2/+1
| | | | | | Task-number: QTBUG-22933 Change-Id: I1d8d3fc778ba00bcad11caaaf8af7d87186f18e8 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2220-480/+480
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Autotests: Use qInstallMessageHandlerKai Koehne2012-09-141-2/+1
| | | | | | | | qInstallMsgHandler got deprecated in Qt 5. Change-Id: Ib36983e66b3a8090b99f14e3fd4e210602a3f018 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use true and false in preference to TRUE and FALSESergio Ahumada2012-09-051-1/+1
| | | | | | | | The TRUE and FALSE macros are obsolete and should be replaced with true and false (all lower case) respectively. Change-Id: Iee352e8173500683e6319be0abbf5bacf29016e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change SChar to metatype id 40.Stephen Kelly2012-09-031-0/+0
| | | | | | | | | This fills the gap left by QWidgetStar, making the sequence between FirstCoreType and LastCoreType contiguous, which some benchmarks assume to be true anyway. Change-Id: I2d5d202b6246a9065fdf77f325a4a04279dbe4b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QWidgetStar.Stephen Kelly2012-08-182-3/+0
| | | | | | | | | | | | This allows us to remove the odd hacks to get the static metaobject for the QWidget* metatype. The QWidget* is still an automatic metatype thanks to the QObject partial template specialization. It is registered as a metatype at runtime automatically in qwidgetsvariant.cpp. Change-Id: Ie01b69eadf2cbe87af1a86c3284550f60dcf9e94 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Set the Qt API level to compatibility mode in all tests.Thiago Macieira2012-08-0119-1/+20
| | | | | | | | | | | 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>
* tests: removed QtWidgets dependency from tst_qsignalmapperRohan McGovern2012-07-302-16/+25
| | | | | | | | This test was using some QSpinBox instances to generate signals for testing. Use our own QtTestObject to generate the signals instead. Change-Id: I3714955ae040d541c3b613a478945c38a18be18d Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Fix crash in QVariant::canConvert().Volker Krause2012-07-271-10/+18
| | | | | | | | | When containing a QObject (or sub-class) pointer and trying to convert to a QObject pointer canConvert() did dereference the pointer without checking for it being null. Change-Id: Ie274e54f2f817f2b6c5df64504f8af6359b8f38d Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Implement implicit constructors for built-in classes.Stephen Kelly2012-07-271-0/+50
| | | | | | Change-Id: I6b0b104bc1da3252d014615c50b81830de42e722 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QMetaTypeId2::IsBuiltIn: (new) template meta-function to check for built-in ↵Marc Mutz2012-07-261-0/+19
| | | | | | | | | | | | | | | types This allows to check whether QMetaTypeId2::MetaType exists, and can help turn run-time into compile-time expressions, even without constexpr support, or in situations where constexpr can't be used (because you can't overload on it). This was designed for the QMetaType::registerConversion feature, but it's much more widely applicable. Change-Id: Iafa04add04bcb531b3f7fe3e751c7e91ee6a3bc0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* tst_qmetatype: fix two more unused typedefs (GCC 4.8 warning)Marc Mutz2012-07-251-3/+1
| | | | | | | | | Also check the return value of DefaultValueFactory<QMetaType::Void>::create(), the same way it's done in testCreateHelper<QMetaType::Void>(). Change-Id: I3e6d7fca4ea74dbe65009f2eb2c64a1b3a370d68 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QObject: add a macro for conveniently setting the object nameMarc Mutz2012-07-251-8/+8
| | | | | | | | | | | | | | | | | | This is a simplified port of KDTools' KDAB_SET_OBJECT_NAME. It simply assigns the variable name as the objectName of a QObject, uic-style. It uses a small helper function so that it works on references as well as pointer variables. QLabel label; QLabel *pLabel = new QLabel(); Q_SET_OBJECT_NAME(label); Q_SET_OBJECT_NAME(pLabel); Change-Id: I25fec0c90f33249a3ea5d2dd622ab708019fd101 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Split the QGuiVariant test from the Core one.Stephen Kelly2012-07-2549-390/+2
| | | | | | | | | | | This makes development on the meta type system easier because only QtCore must be re-built to run most of the tests. The existing QGuiVariant test needs to be run before pushing anyway, but not so frequently. Change-Id: I1fa66edbd790c957e1a232226847dd550227a477 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Use a large core type for the QVariant::setValue test.Stephen Kelly2012-07-251-2/+4
| | | | | | | | | The type needs to be large enough that QVariantIntegrator<T>::CanUseInternalSpace is true. Change-Id: I311c44bedfebd946e41639975df206c27b6d55ca Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Make qRegisterMetaType constexpr for built-in types.Stephen Kelly2012-07-251-0/+30
| | | | | | | | For consistency with qMetaTypeId, and because we can. Change-Id: I6882a16ef3c0d84539048c9f2c201c4a2b2ca7ad Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Remove obsolete or commented use of Q_DECLARE_METATYPE.Stephen Kelly2012-07-241-5/+0
| | | | | Change-Id: I15bc845801b9f84a9252a0092fbd69f0e1b3f4ea Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Replace old typedefs with their built-in equivalents.Stephen Kelly2012-07-241-4/+2
| | | | | Change-Id: I3ecb75ace431b92a13de67aa6426cf570398587f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix typo pallete -> palette.Stephen Kelly2012-07-241-2/+2
| | | | | Change-Id: I17b71bfed22c3692b027556ef2e5d6ece4f3f77e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Split QWidgetsVariant tests into a separate testcase.Stephen Kelly2012-07-234-218/+16
| | | | | | | This allows building the QVariant tests without the QtWidgets module. Change-Id: I7cd7e78a60c7bc7614ec16df1abe1e93e45d4923 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Test QVariant copy with a user type instead of a QtNetwork type.Stephen Kelly2012-07-152-9/+19
| | | | | Change-Id: I78acc8a843eb12a2606f491d1a29e1bcd408d60f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Run QIcon related crash test with the other QtGui types.Stephen Kelly2012-07-141-2/+2
| | | | | Change-Id: I475cfc5a91a046951feecb425f8235ad37f1ba44 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Don't declare built-in metatypes as metatypes again.Stephen Kelly2012-07-141-23/+0
| | | | | Change-Id: Iba9804299e8f6e2db10965fdc719ee26f197758e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Test for QMetaType binary breakage.Jędrzej Nowacki2012-07-133-0/+46
| | | | | | | Type traits can not be changed durring Qt5 life time. Change-Id: If69f65ff2113c901580afee91b11ae1b11c13a4f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Enable modularization of translation files.Jan-Arve Saether2012-07-123-0/+47
| | | | | | | | | | | | | | | | | This is accomplished by introducing dependencies to catalogs. This requires one API change: QTranslator::load(const uchar *, int); changes to QTranslator::load(const uchar*, int len, const QString &directory = QString()); Since now, even the load from memory might need a directory if the memory block contains a qm file with dependencies. Change-Id: I781f333d07f53bb431d0a7b5fa1abe282dc4d338 Task-number: QTBUG-26138 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Avoid load(testcase) for installing test helper appsRohan McGovern2012-07-041-2/+1
| | | | | | | | | | | | Make test projects declare TEST_HELPER_INSTALLS rather than calling a function exported by testcase.prf. load(testcase) may be unsafe, as testcase.prf should be processed after default_post.prf. Fixes silent disabling of various autotests. Change-Id: I56b35ffd653a637ad5ab18d64dd1a1edadfac59f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
* Add constexpr template specializations for built in metatypes.Stephen Kelly2012-07-031-0/+41
| | | | | | | | | This will make it possible (in Qt 6) to remove the enums listing metatype ids. As it is constexpr, it can be used in switch statements just like enums, as enum values, and as template specialization values. Change-Id: I51293674c403714e34cb8a8b8953522fc97a740a Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Implement QVariant conversions for QObject derived pointer metatypes.Stephen Kelly2012-07-011-0/+13
| | | | | | | canConvert() and convert() use the metaobject to convert such types. Change-Id: Ic05e74c5c2423b4b9682b88adc856a16dcba4cff Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Store the QMetaObject with the QMetaType.Stephen Kelly2012-07-011-0/+14
| | | | | | | | This will allow conversion between pointers to compatible QObject derived types. Change-Id: I19e08934571fb3f1b91e594892214041fe5f6a11 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Call QObject::disconnectNotify() when receiver is destroyedKent Hansen2012-06-281-2/+20
| | | | | | | | | | | | | | | | | | | | | | | Store the signal index in QObjectPrivate::Connection, thereby making it available in "implicit" disconnect contexts (i.e., receiver deletion). This change does not cause the size of QObjectPrivate::Connection to grow (still 40 bytes on 32-bit Linux, 72 bytes on 64-bit Mac). Valgrinding the new benchmark indicates that the percentage of the time spent in the QObject destructor increased from 7.8% to 8.4% on ia32, for that particular stress test; the increase is the combined cost of calling metaObject(), QMetaObjectPrivate::signal(), and disconnectNotify() for one connection. In practice, the measured wallclock time increased by about 3ms for a 500ms run (which repeatedly constructs, connects, and destroys an object). Task-number: QTBUG-4844 Change-Id: I1beb01c753f31542fc0acb62edb4c6d165fcc5b4 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Record if a metatype is a smart pointer to a QObject derived.Stephen Kelly2012-06-201-14/+17
| | | | | | | | | | | | This allows QVariant/QMetaType software (such as QtDeclarative) to deal with smart pointers in a similar way to how they can deal with naked pointers (accessing properties etc). This also adds a requirement that T be fully defined when QSharedPointer<T> is inserted into a QVariant. Change-Id: I29e12b8a6aa5f4aadbd62f92b89bc238f64b5725 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add some internal API for extracting a QSharedPointer<T> from QVariant.Stephen Kelly2012-06-201-0/+37
| | | | | | | | | | | | | 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>
* Add test for queued call of method with unregistered parameter typeKent Hansen2012-06-201-0/+15
| | | | | | | | | Verify that this produces a warning containing the relevant typename. Change-Id: I046c02585e410a211e9175600b1027dda83bdd9c Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add automatic metatype declaration for QPointer and QWeakPointer.Stephen Kelly2012-06-151-8/+18
| | | | | Change-Id: Ic9a04fa68d0bb14ef07455a6559e59f4b887f38b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Fix automatic declaration of QSharedPointer<T> metatypes.Stephen Kelly2012-06-121-4/+27
| | | | | | | | | | | | | | | | | | | | | | | QSharedPointer doesn't work like the other automatic template metatype declarations because in some cases T* is declared as a metatype, but we are interested in QSharedPointer<T> (eg QObject*). In other cases, T is declared as a metatype and we are interested in QSharedPointer<T> (eg char). In particular the macro used before this patch was attempting to get the metatype id of the element_type using for example qMetaTypeId<QObject>() instead of qMetaTypeId<QObject*>(), which did not work. Similarly, the variadic macro driven test is no good, because it was testing QSharedPointer<QObject*> instead of QSharedPointer<QObject>, so that is removed. In the end, the only thing we can sensibly automatically declare as metatypes are QSharedPointers to QObject derived types. That is also the type that makes the most sense in a QML context anyway. Change-Id: I13dd40147e2e6bedf38661f898102abaaaa96208 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Avoid a type name normalization during auto-registration.Jędrzej Nowacki2012-06-121-1/+13
| | | | | | | Containers are auto-registered and use normalized names. Change-Id: Id65c3940401f69436929220e1f6a971135e147ed Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Make qmetaobject autotest independent of QtWidgetsDebao Zhang2012-06-112-9/+9
| | | | | Change-Id: I4340036a4e6024d9b8d0c7832ad7bfb28ec4bc99 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Make qpointer autotest build without widgetsKent Hansen2012-06-102-1/+12
| | | | | | | Change-Id: Ibd05a49174e7055faa89c48659130a11418b9616 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Debao Zhang <dbzhang800@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add private API for working with meta-methods in signal index rangeKent Hansen2012-06-012-1/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Internally, QObject and QMetaObject already leave out non-signal methods when working with signals. This is possible because the signals always come before other types of meta-method in the meta-object data. Ignoring irrelevant methods is faster and can save memory. QMetaObject provides internal indexed-based connect() and disconnect() functions. However, these functions currently take an absolute method index as the signal specifier, instead of an absolute _signal_ index. Hence, QMetaObject and friends must convert from the method index range to the signal index range. By providing an API that only considers signal indices, clients of the index-based QMetaObject::connect()/disconnect() can provide the proper signal index directly. Similarly, for the qtdeclarative integration (QDeclarativeData hooks) the signal index can be passed directly. This will eliminate most of the conversions back and forth between signal index and method index, and some other redundant work done by qtdeclarative's custom connection implementation. There are some places where the behavior can't be changed; for example, QObject::senderSignalIndex() will still need to return an index in the method range, since that function is public API. Changing QMetaObject::connect()/disconnect() to take an index in the signal range will be done in a separate commit; this commit is only an enabler for porting existing usage of those functions to the new behavior. Change-Id: Icb475b6bbdccc74b4e7ee5bf72b944b47159cebd Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>