summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Set the Qt API level to compatibility mode in all tests.Thiago Macieira2012-08-01187-2/+188
| | | | | | | | | | | 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>
* statemachine: Make states exit order spec-compliantKent Hansen2012-08-011-6/+15
| | | | | | | | | | The SCXML spec states that entry order should be equivalent to "document order" and exit order should be "reverse document order". Since QStateMachine uses child order for the entry order, the exit order should be reverse child order. Change-Id: Ia7b05fdd5c9261ccf202f64f8d23f5c88b20a8c3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Make sure that the parsing mode reaches QUrlPrivate::setHostThiago Macieira2012-08-011-1/+26
| | | | | | | | | | | | Ensure that the parsing mode is cascaded down from setAuthority and setUrl so that the hostname parsing does not attempt to decode percent-encoded hostnames when it shouldn't. Take the opportunity to also remove the "Boolean Trap" from QUrlPrivate::setHost. Change-Id: Ia64754c4a4900182700b7af1382aea8410abc7e9 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make QUrl::setScheme only parse in strict mode (no decoding)Thiago Macieira2012-08-011-3/+11
| | | | | | | | | | The URI RFC defines schemes as containing only a very restricted set of characters, none of which require encoding, so don't even try. Testing this behaviour in some web browsers indicate that they do not accept percent-encoded schemes either. Change-Id: I692dd20e1aac7e8a1bcb276cb5113b5802393d38 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix QUrl support for empty usernames and passwordsThiago Macieira2012-08-011-3/+9
| | | | | | | | | | | | | | | If the password is empty (but present), the userinfo component of the URL should end in a colon (":"). QUrl already supported that and it was tested (case "password-empty"). If the username is *also* empty but present, the userinfo component is just the colon (":"). Fix support for that case by checking if we stored the presence flag instead of checking the size of the component. Change-Id: Ie224493a997dbf76b2e44dd6d55fd9674ac83c1c Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix handling of encoded NULs (%00) in QUrl::fromPercentEncodingThiago Macieira2012-08-011-1/+3
| | | | | | | | | | | | | QString::fromUtf8, without an explicit size, (currently) defaults to stopping at the first NUL. That means we need to pass an explicit size. Also take the opportunity to test that QUrl::toPercentEncoding also works with the same data. Change-Id: I79362d67afda624b01ca07b0315b611c4aa3fdda Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: David Faure <faure@kde.org>
* Fix reloading of pluginsLars Knoll2012-08-011-0/+24
| | | | | | | | | Unloading and reloading a plugin didn't work correctly, because we didn't reset instance to 0 on unload. Task-number: QTBUG-26098 Change-Id: Ic3e4497f359b1ca455be949dce9cafa9d67d8039 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* ICU code page conversion supportLars Knoll2012-07-311-12/+13
| | | | | | | | | | | | | Use ICU to do code page conversion instead of the builtin text codecs. With this QTextCodec simply becomes a wrapper around ICU's ucnv_* methods. We only keep our own codecs for UTF-*, ISO-8859-1, ISO-8859-15 for performance reasons, and for TSCII and iscii-* because they aren't supported by ICU. Change-Id: I4fc49eba55cf772b9772c6dac606a47a44346a60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Ensure that QAtomicPointer of forward-declared classes worksThiago Macieira2012-07-301-0/+17
| | | | | | | | This is working, but let's just be sure by adding a testcase. Change-Id: I8c6b5ded0c7b6c90645dbf70a7ce6c1ba447a284 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.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>
* QDebug: Add getter/setter for auto-insert-spaces.David Faure2012-07-271-0/+21
| | | | | | | | | | | | This is useful for inserting a string without space-handling, given that dbg.nospace() followed by dbg.space() inserts a space. It's also useful for QDebug operators for custom types, so that they can disable space handling and then restore to whatever it was before (rather than forcing it to space() mode). Change-Id: I9d72e9ffbcbc581ed093168752c29af924405b33 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Base 'FileSystem' test helper class on QTemporaryDir.Friedemann Kleint2012-07-262-19/+21
| | | | | | | | | This avoids test instabilities and prevents test directories from being cluttered with temporary files. Change tests accordingly. Remove unused createLink() method. Change-Id: I843c28ab81c8a476c71c5211a7479b22d3d9fc93 Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.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>
* QAbstractItemView: don't qRegisterMetaType<QModelIndex>Marc Mutz2012-07-243-22/+0
| | | | | | | | | | QModelIndex is a build-in type nowadays and doesn't need to be registered anymore. Also remove them from the tests. Change-Id: I47029972651c045c880cee86fb292116a29493d5 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Remove the unnecessary qdebug.h includes in the QPoint(F) testsLaszlo Papp2012-07-242-2/+0
| | | | | Change-Id: I5c45af9d498e20b46d6faf8c96de87586eca7b4a Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.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>
* Windows: Do not return short path names for QDir::tempPath().Friedemann Kleint2012-07-171-0/+2
| | | | | | | | WinAPI GetTempPath() sometimes returns short names for C:/Users/<user>/AppData/Local/Temp. Change-Id: I33f991acc06e652ccd484d36a5a384eb776f8395 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* statemachine: Move RestorePolicy enum to QState classKent Hansen2012-07-161-21/+21
| | | | | | | | | | This makes it possible to add API for setting the restore policy per state, or even per property assignment (QTBUG-17861). This change is fully source compatible with Qt4. Change-Id: I53628546b070f6fc84891f86e7ad7bd8ef5ba285 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Add QStateMachine constructor that takes a ChildModeKent Hansen2012-07-161-0/+42
| | | | | | | | | | | | Back when QStateMachine was changed to inherit QState, this constructor was conveniently left out because setting the state machine (root state) to be a parallel state group didn't actually work. But as of commit d281aa6936ad01e28dacabb41bd9eb59891f85a1, it does work, so add the missing constructor. Task-number: QTBUG-15430 Change-Id: I68c599baa0ef1bfc869195140cf5daf645e75b8b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* fix object file name clashOswald Buddenhagen2012-07-163-0/+3
| | | | | | | under extremely rare circumstances this would have actually failed Change-Id: I4132d0f82e9f924e92e9e96f6d34451c94a67201 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.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>
* statemachine: Make signal transition registration thread-safeKent Hansen2012-07-131-0/+50
| | | | | | | | Since Qt's connections are thread-safe, QStateMachine's plumbing around them should be thread-safe too. Change-Id: I8ae91c2edc2d32ca4ed4258b71e5da22de30ed91 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* statemachine: Fix signal transition handling in multi-threaded setupKent Hansen2012-07-131-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, QStateMachine lazily registers signal transitions (i.e., connects to the signal) when the transition's source state is entered. The connections are established in Qt::AutoConnection mode, which means that if the sender object lives in a different thread, the signal processing will be queued. But if a sender object's signal is used in an out-going transition of the target state of the queued transition, it's possible that a second signal emission on the sender object's thread will be "missed" by the state machine; before the machine gets around to processing the first queued emission (and registering the transitions of the new state), a sender object on the other thread could have emitted a new signal. The solution employed here is to eagerly register any signal transition whose sender object is on a different thread; that is, register it regardless of whether the transition's source state is active. Conversely, when a machine's transitions are unregistered (i.e., because the machine finished), signal transitions with sender objects on other threads should be left as-is, in case the machine will be run again. This doesn't solve the case where the sender object is moved to a different thread _after_ the transition has been initialized. Theoretically, we could catch that by installing an event filter on every sender object and handle the ThreadChange events, but that would be very expensive, and likely useless in most cases. So let's just say that that case isn't supported for now. Task-number: QTBUG-19789 Change-Id: Ibc87bfbf2ed83217ac61ae9401fe4f179ef26c24 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* statemachine: Fix dynamic transition registration edge casesKent Hansen2012-07-131-0/+86
| | | | | | | | | | | | Some of the transition constructors didn't call the maybeRegister() function, causing the transitions to be ignored if they were created when the state machine was running and the transition's source state was active. Added tests that cover all possible cases. Change-Id: If1b593b127bd719e3be4e5a2e6949a780c4e97c3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* statemachine: Set correct signal index when signal is non-normalizedKent Hansen2012-07-131-22/+77
| | | | | | | | | | | | The originalSignalIndex member was not set if the signature had to be normalized. This caused the SignalEvent passed to onTransition() to report a signal index of -1. Improve the signal transition tests so they check both the event passed to eventTest() and onTransition(). Change-Id: I5331fd1944d53310b6d11eb2fd8713b80faa53a1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Make it possible to connect to QAbstract{State,Transtion} private signals.Stephen Kelly2012-07-131-0/+121
| | | | | | | Use the same trick as used for private signals in the models. Change-Id: I4235788490cae0e3d554565621d145652dc5b0ca Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Make it possible to use new syntax to connect to model signals.Stephen Kelly2012-07-131-0/+107
| | | | | | | | | The private signals can not be used as function pointers, as required by the new syntax, so we introduce a parameter which can only be created privately. Change-Id: I3d7bb8a163e764d685e8007cba831fb77e3c6855 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>
* tst_QMimeDatabase: use QFutureSynchronizerMarc Mutz2012-07-131-12/+11
| | | | | | | | Replace a list of QFuture<void>s and a loop that calls waitForFinished() on each of them with a QFutureSynchronizer<void>, which does exactly that. Change-Id: I1f2e90169a5b2949bd8cb9d1009a5a7af1500139 Reviewed-by: David Faure <faure@kde.org>
* statemachine: Fix state entry bug for parallel state groupsKent Hansen2012-07-121-0/+39
| | | | | | | | | | | | | | | | | | The SCXML spec had a bug that would cause the initial state of a compound state within a parallel state group to be entered even if the transition specified another (non-initial) state of the compound state as its target. This only happened if the transition had multiple target states. The bug has been fixed in recent revisions of the SCXML spec. This commit implements the fix, which is to walk the ancestors of the transition's target states only after all the target states themselves have been added, so that the default initial states are correctly overridden/ignored. Task-number: QTBUG-25958 Change-Id: Iac532047678c483a4a3996e24dacf30e00f6bbe0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Fix small problems with tst_QProcessThiago Macieira2012-07-121-3/+4
| | | | | | | | | | | | | | Remember to register the metatype where we use it, so we don't depend on another test being run previously. And skip the setWorkingDirectory test completely on Unix. I don't know why it needs to be skipped, but if we're not going to verify anything, don't even try to do anything. This saves us one memory leak at least. Change-Id: I22e151cc3fa7b4e976972aca8978b88b263d9bee Reviewed-by: Mitch Curtis <mitch.curtis@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.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>
* Write qHash functions for QDate, QTime and QDateTime.Mitch Curtis2012-07-123-1/+8
| | | | | | | | These functions didn't exist - this patch implements them. Task-number: QTBUG-23079 Change-Id: I9eb6e238531d5cda878f5f2cdd27bab30aa60669 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add unary operator+ to QPoint and QPointF.Mitch Curtis2012-07-122-0/+30
| | | | | | | | | | | | | As requested by Winfried Schenke: "QPoint should have an unary operator+ (the unary operator- exists). Classes with arithmetic operators should provide a complete set of operators, because some template code relies on it." Task-number: QTBUG-22913 Change-Id: Ib0c5105975f56c15f00bb48d83c8d911f5a204ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix some spelling errorsSergio Ahumada2012-07-111-2/+2
| | | | | | Change-Id: I19d3b2e9a5180b13deb828b55195404ef20be295 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Improve QPoint and QPointF auto tests.Mitch Curtis2012-07-114-72/+679
| | | | | | | | Improve test coverage for QPoint and QPointF. Separate QPointF tests into their own project. Change-Id: Id28dc5b85aba9fc179d87b2bca1d99854f27a5ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* statemachine: Support parallel root stateKent Hansen2012-07-111-4/+9
| | | | | | | | | | | QStateMachine inherits from QState, so it should be possible to set its childMode to ParallelStates, and it should behave as expected (the machine should emit the finished() signal when all its child states are in final states). Task-number: QTBUG-22931 Change-Id: Ic436351be0be69e3b01ae9984561132cd9839fa7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* statemachine: Emit finished() signal when the initial state is finalKent Hansen2012-07-111-0/+12
| | | | | | | | | | It's legal to set a QFinalState as the initial state. The state machine should correctly emit the finished() signal upon entering such a state in the initial transition, and don't do any further processing. Change-Id: Ica8d3fadbbde604512ea1136624af54eb3b13b11 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>