summaryrefslogtreecommitdiffstats
path: root/tests/auto
Commit message (Collapse)AuthorAgeFilesLines
* Remove usage of deprecated qWaitForWindowShown(QWidget *) method.Friedemann Kleint2012-07-2516-119/+107
| | | | | | | | Remove usages from autotests with the exception of widgets/kernel, widgets/widgets and widgets/graphicsview. Change-Id: I917b2857ed0cd07a6b3dbcd69244f558086c6586 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.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>
* QtWidgets: use nullary version of qRegisterMetaType<T>("T")Marc Mutz2012-07-251-1/+0
| | | | | | | | | | | | | | | | | | | Using qRegisterMetaType<T>() has the advantage that multiple calls during a program run are much more efficient, since an inlined atomic is used to store the result. It also ensures that Q_DECLARE_METATYPE(T) has been used, whereas qRegisterMetaType<T>("T") will happily register anything. Had to add Q_DECLARE_METATYPE to QFileInfo, for QList<QPair<QString,QFileInfo>> of QFileSystemModel to work with the partial specialisations of Q_DECLARE_METATYPE for QList, QPair. In order to synchronize this change with other modules that did their own Q_DECLARE_METATYPE(QFileInfo), a sync macro is defined that can be tested in other modules, and will later be removed again. Change-Id: I3004664e07e64cd885d5a03a57ff4e4379804aec Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add QSignalSpy::wait() method.David Faure2012-07-251-1/+54
| | | | | | Change-Id: I1f3b49e3dee19bf0b1d2933c6e6ad7972186e0d0 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Deprecate the qWaitForWindowShown(QWindow *) method.Friedemann Kleint2012-07-256-42/+40
| | | | | | | | | | | | | | While the qWaitForWindowShown(QWidget *) is inherited from Qt 4.8, the qWaitForWindowShown(QWindow *) was introduced in Qt 5. As it is identical to qWaitForWindowExposed() and removed already, it can be deprecated in Qt 5. Remove its usages in qtbase. Change-Id: I28788d120ad687a49f02b2b44de6b38a2832fe5c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Split the QGuiVariant test from the Core one.Stephen Kelly2012-07-2554-402/+667
| | | | | | | | | | | 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>
* Propagate synthesized mouse events in parallel (lock-step) with touchKevin Ottens2012-07-242-13/+173
| | | | | | | | | | | | | | | | | | | | This patch implement the equivalent of 468626e99a90d6ac21cb311cde05c658ccb3b781 in qtdeclarative but for QtWidgets. If a widget doesn't accept a touch event, then QApplication gives it another try by synthesizing a corresponding mouse event. This way QtQuick and QtWidget behave in a similar way, removing the need for platform backends to try to emulate a mouse event from a touch event unconditionally. Also add relevant unit tests and adjust old QApplication ones. Change-Id: Iddbf6d756c4b52931a9d1c314b50d7a31dbcdee9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.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>
* Add tests of the various testlib definition possibilities.Stephen Kelly2012-07-248-0/+206
| | | | | | | | | | | The behavior of QTEST_MAIN depends on whether QT_GUI_LIB or QT_WIDGETS_LIB is defined. It could create a QGuiApplication or QApplication which could cause linking issues if the corresponding library is not linked to. The failure cases are also tested. Change-Id: I61ed0bc760564ef42ce1dbd86c83c06348c860ff Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.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>
* Remove usage of deprecated qWaitForWindowShown in dialog tests.Friedemann Kleint2012-07-245-32/+34
| | | | | Change-Id: Id3ebe202d65ee682e8e2e3ae107808e9abb6cc15 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* WindowSystemInterface::sendWindowSystemEvents(): Remove unused parameter.Friedemann Kleint2012-07-231-3/+3
| | | | | | | | No need to pass the dispatcher. Get rid of Windows logic to maintain a stack of dispatcher associated with flags. Change-Id: Ic2daad4b6762a46fac3274937effc188af436c9a Reviewed-by: David Faure <faure@kde.org>
* Split QWidgetsVariant tests into a separate testcase.Stephen Kelly2012-07-238-218/+514
| | | | | | | This allows building the QVariant tests without the QtWidgets module. Change-Id: I7cd7e78a60c7bc7614ec16df1abe1e93e45d4923 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Exclude the delayed resource file test on Windows.Stephen Kelly2012-07-231-1/+5
| | | | | | | The feature does not work there. Change-Id: I4c19577d3882b5ea01d20f4a67a512c1e6bc803e Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Add a test for all QtBase modules.Stephen Kelly2012-07-233-0/+123
| | | | | Change-Id: Ib87e56f063603d474e232a137246ab6a60f63a23 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix typo: delyed -> delayedStephen Kelly2012-07-204-9/+9
| | | | | Change-Id: I1e9c17a85a52f15f252392426fa0b30c101c7c30 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
* Provide public API for native event filtering, moved up from QPA.David Faure2012-07-203-10/+28
| | | | | | | | | | | | | | | | | | The previous API was hard to use (global function, no type safety, manual chaining), and confusing (app vs dispatcher split only made sense on Windows). Installing and removing out of order would have the risk of setting back a dangling pointer (crash). Meanwhile QPA added type safety, and this new API models the QObject::installEventFilter API for ease of use. The virtual method is in a new interface, QAbstractNativeEventFilter. QPA was even calling the dispatcher event filter with QPA-private event classes, which made no sense (refactoring leftover from when the code was in the dispatcher). Now the QPA plugins trigger the qcoreapp event filters with the actual native events directly. Change-Id: Ie35e47c59c862383bcaf857b28d54f7c72547882 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
* Tests: Replace deprecated QPixmap::grabWidget() by QWidget::grab().Friedemann Kleint2012-07-205-23/+23
| | | | | Change-Id: I5018cf5dd51c1781e7f17c7d205f3f60de7945be Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
* Activate native window tests of QMdiArea.Friedemann Kleint2012-07-201-5/+6
| | | | | Change-Id: Ic272b5e28256e454a3186d4407d009c9331b292b Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
* Implement waitForWindowExposed and friends for widget windows.Friedemann Kleint2012-07-2040-526/+278
| | | | | | | | | | | | | | - Implement waitForWindowExposed() for toplevel windows. - Implement waitForWindowShown(QWidget *) and mark as deprecated in line with waitForWindowShown(QWindow*). - Use in tests. - Simplify tests (collapse waitForExposed, setActive into setActiveWindow, waitForActive), remove most hard-coded timeouts. - Stabilize graphicsview tests by using waitForWindowActive. Change-Id: Ic7c061e2745b36f71a715ee4e47c0346b11a91e8 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* QWidget/Win: fix restoreGeometry() from fullscreen modeJoerg Bornemann2012-07-191-3/+0
| | | | | | | | | | | | | | | When turning off fullscreen mode and restoring the widget's geometry we must inform the QWindow about the geometry change synchronously. Otherwise QWidget::geometry() will return the old value. Using the same technique for the state transition to fullscreen mode without sending a separate resize event. Autotest: tst_QWidget::saveRestoreGeometry Task-number: QTBUG-26421 Change-Id: I869e36cd302d9a94e398f48949ab3cb7ee9cdf51 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove the test tst_qdialog::throwInExec().Friedemann Kleint2012-07-191-54/+0
| | | | | | | | QtWidgets and QtGui are currently compiled without exceptions, which causes a crash with gcc 4.6.3. Change-Id: I8f872f3bec6266444adf08d51a6678150c5fae8e Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add another directory to the private INCLUDE_DIRS list.Stephen Kelly2012-07-191-0/+5
| | | | | | | | | | It should be possible to include both: * <QtGui/private/qfoo.h> * <private/qfoo.h> Change-Id: I83ed5bba633b4a6b9bd38e315c987d78beecfb1b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Dereference so we can be sure the type is not forward declared.Stephen Kelly2012-07-191-1/+3
| | | | | Change-Id: I4d67a08dc645649e767153f3aa0dc57b15d50a84 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fix rendering glitches when using native widgets in MDI subwindowsMiikka Heikkinen2012-07-181-6/+0
| | | | | | | | | | | | | | | | | | | | When mixing native and regular widgets in same QMdiArea, some subwindows didn't properly get set native. This was because when a native parentless widget was given a parent, it wouldn't enforce native window on the new parent and its ancestors. This happened because window flags were adjusted too late in relation to createWinId() call in setParent_sys(). Fixed by moving the createWinId() call to its proper place. Also removed some old Q_WS_* ifdeffing in QWidget::setParent() that masked some native enforcement code. Additionally removed few QEXPECT_FAILs from QWidget autotest now that those cases work correctly. Task-number: QTBUG-26424 Change-Id: Ib6f9d0531e5c7299e2c307734d49c81f1ffa9713 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.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>
* Fix error when inserting to tables with datetime fields with QODBCThiago A. Correa2012-07-161-1/+27
| | | | | | | | | | | | | SQL Server 10 introduced stricter rules for TIMESTAMP validation, making it necessary to specify the decimal digits. Other databases might do the same as well, so this patch introduces a check for the TIMESTAMP column size and adjusts the decimal digits parameter as needed. Task-number: QTBUG-2192 Change-Id: If6d798c6c928ebda75bc474e49a07fbbfbe5816c Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Replace Q_WS_ in tests by Q_OS_ or check platform names.Friedemann Kleint2012-07-1610-30/+25
| | | | | Change-Id: Ica445cf1e83bfaab870ac344d6c02766f047a5cc Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* tst_qwidget: check widget geometry in fullscreen modeJoerg Bornemann2012-07-161-0/+10
| | | | | Change-Id: Idc45c6d18decf3c71c6736742434ad9d0cccd2d2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove #ifdef Q_WS_ / include / #endif conditionals.Friedemann Kleint2012-07-166-22/+0
| | | | | Change-Id: I734490ddcb5501e620370e50ef06180ab5e23393 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Fix applicationName() being empty in QApplication.David Faure2012-07-162-15/+26
| | | | | | | | | | | | | | | A virtual method was reimplemented to return an always-empty string, probably a leftover from a refactoring. This fix showed that tst_qwidget_window was buggy: between Qt4 and Qt5, a "Before" became "After", which made "Before" unused, and was masking the fact that the app name was empty by default. In addition, the earlier Qt5 change that made the app name default to argv[0] now requires updating this test, now that it's actually working. Change-Id: I5360026821a9b95bedd0ff09dba3d51a22e542b7 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Paul Olav Tvete <paul.tvete@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>
* Add some tests to note that private signals can't be overloads.Stephen Kelly2012-07-131-0/+88
| | | | | | | | | This is just for completeness of the understanding of the limitations of private signals. There are no private signals in Qt which have overloads. Change-Id: Ic34c555aea360ee34beec796e597657888573da9 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Relax the reqirement in which order events are delivered.Jan-Arve Saether2012-07-131-7/+11
| | | | | | | | | | | | | | | | | When the pushbutton is shown, it will generate both a ShowEvent and a StateChange with active=1 (because it is a top level window). This patch relaxes the reqirement in which order events are delivered. Ideally the order should also relied on, but I'm not sure if that is feasible due to differences among window managers across all platforms. This got provoked by codereview.qt-project.org/#change,26014 Change-Id: I96159fbb1b64f0ca8d13833d8a4c6799c655afc2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.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>