summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Fix memory leak in QAbstractItemModel autotest.Jason McDonald2012-01-051-0/+6
| | | | | | | | The test was allocating a new model on the heap each time init() was invoked, but none of these models were deleted. Change-Id: Ibe107b2dbc949a5f72940f67c08f4b0f46256c09 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Prevent QFileInfo test from leaving temporary files behind.Jason McDonald2012-01-051-20/+33
| | | | | | | | | | Use a small helper class to ensure that the files created during the test are removed afterwards, even if the test fails. Also, verify creation of the files in the body of the test function, not in the helper, as verifying in the helper won't terminate the test on failure. Change-Id: I76eff20e54ef6a1ed71d9bbb31e00f41f3d14c38 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Registered QUuid in the metatype system as a builtin type.Denis Dzyubenko2012-01-052-0/+34
| | | | | | | Change-Id: I6be6129d9f6bf468ba8a5805cfa0f6f79199afb3 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
* Pass notification of failure of watches onto the caller.Robin Burchell2012-01-041-30/+41
| | | | | | | | | | | | | | This is particularly useful for situations where the user might really want to be notified about a failure, for instance, in a backup application. Empty paths are not treated as an error in calling, as the user code cannot really do anything sensible to handle this error, but empty paths should not be used. Change-Id: Iddb44fd39f4e3fac5c3f9f60fb7999e1833280a8 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Refactor QVariant handlers.Jędrzej Nowacki2012-01-041-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | QVariant implementation is based on delegation to a handler. The handler has rather simple construction, it is a set of function that implements a switch statement over known types and redirects calls to a right method of an encapsulated types instance. Unfortunately after qt modularization project, it is not easy to use types directly from different modules, as they can be undefined or completely unaccessible. Which means that each module has to implement own handler to cooperate correctly with QVariant. We can suspect that list of modules known to QVariant will grow and it is not limited to GUI, Widgets and Core, therefore it would be nice to have an unified, from performance and source code point of view, way of working with handlers. This patch is an attempt to cleanup handlers. Keynotes: - Each handler is working only on types defined in the same module - Core handler implements handling of primitive types too - Custom types have an own handler - Each handler is independent which means that dispatch between handlers is done on QVariant level - Handlers might be registered / unregistered using same interface Change-Id: Ib096df65e2c4ce464bc7a684aade5af7d1264c24 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* fix invalid connection in tst_QProcess::lockupsInStartDetachedJoerg Bornemann2012-01-041-1/+2
| | | | | | Change-Id: I06f2d56f5c45c13bbe08707e6baad4f2aece39b8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Avoid QCOMPARE outside test function in QSettings test.Jason McDonald2012-01-041-1/+9
| | | | | | | | | QCOMPARE and friends should only be called in a test function. Instead of calling QCOMPARE elsewhere, keep a count of the number of errors and QCOMPARE that count with zero in the test function. Change-Id: I9a264e91169a98c30980fdc04a3e45bfb0ca8063 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove redundant debug code from QFileSystemWatcher test.Jason McDonald2012-01-041-4/+2
| | | | | | | | | | There is no need to print out the name of the backend used by each test run of a test function as every message output by the test function will have the name of the current data row included. Change-Id: Ie69881d2ecedce728ea67b5aae1c1196776552a5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Make sure tst_QThreadStorage finds its subprocessBradley T. Hughes2012-01-031-0/+4
| | | | | | | | | On Mac, the application's dir is in the bundle, so we need to "escape" the bundle when looking for the an executable relative to the application's dir path. Change-Id: I5c01f7d816ec8cc30f5277202f4eefb0c49a2bc3 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Use true and false in preference to TRUE and FALSE in tests.Jason McDonald2012-01-035-136/+136
| | | | | | | | | Use the C++ boolean constants true and false instead of the C macros TRUE and FALSE (which are actually integers), and use QVERIFY instead of QCOMPARE for verifying simple boolean expressions. Change-Id: Ie76dfcab6722df6b93b3fa62b0f3437901482932 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove support for dnotify QFileSystemWatcher.Robin Burchell2012-01-021-32/+1
| | | | | | | | | | Inotify has been available in Linux for some ~6 years now, 7 when Qt 5 will actually be released, so I'd say it's safe to remove this fallback path now, particularly as the autotest notes that it's broken. Change-Id: I49dbb161d4765d63e92f512a6375323c7d37ccbe Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Change the default value of QSortFilterProxyModel::dynamicSortFilterStephen Kelly2012-01-022-2/+2
| | | | | | | | | | The value is changed to true. It is a common bug that developers expect this proxy model to reflect the source model when the source changes. That requires setDynamicSortFilter(true), so we change the default to optimize for the common case. Change-Id: I9bf7efdbda10309fa77aed9391c33054aaae4a29 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Implement (and unit test) simple QVarLengthArray::first()/last().Robin Burchell2012-01-021-0/+46
| | | | | | | | | Pure syntactical sugar, to match up with what the other container classes offer. Change-Id: I0f97de011923d9d204cca0fa906b059dc5054a89 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Add Qt::TimerType argument to QAbstractEventDispatcher::registerTimer()Bradley T. Hughes2012-01-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | ... and deprecate the old registerTimer() functions. The new pure- virtual registerTimer() breaks source-compatibility. Subclasses cannot be instantiated anymore, since the pure virtual function signature has changed. QAbstractEventDispatcher::TimerInfo is no longer a QPair. It is now a struct with timerId, interval, and timerType members. This is a source incompatibility that should only affect subclasses of QAbstractEventDispatcher, which will need to pass 3 arguments to the TimerInfo constructor instead of 2. If the subclass used QPair<int,int> instead of the TimerInfo typedef, the QPair<int,int> declarations will need to be replaced with TimerInfo. Call the new registerTimer() function with the type from QObject::startTimer(). Change all subclasses of QAbstractEventDispatcher to reimplement the new virtual function. The type argument is unused at the momemnt, except to ensure that registeredTimers() returns the type each timer was registered with. Implementations for the various dispatchers will be done in separate commits. Author: Thiago Macieira <thiago.macieira@nokia.com> Change-Id: Ia22697e0ab0847810c5d162ef473e0e5a17a904b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Prevent qDebug test bypassing the testlib message handler.Jason McDonald2011-12-301-12/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Several of the test functions in the QDebug autotest call qInstallMsgHandler() to temporarily use a custom message handler. Unfortunately, these test functions were then resetting the message handler back to Qt's default handler at the end of the test. QTestLib also calls qInstallMsgHandler() to set a message handler that redirects debug/warning/fatal messages into the test log. When the test resets the message handler back to Qt's default handler, testlib's message handler is bypassed for the rest of the test, preventing any subsequent debug/warning/fatal messages from being visible in the test log or subject to testlib's ignoreMessage() function. This error also caused several of the test functions to fail if they were run manually. The "defaultMessagehandler" test would fail if it was run before any other test function and the "assignment" test would fail if it was run after any other test function. This commit fixes these failures by using a helper class to ensure that the previously active message handler is restored at the end of each test function, even if the test function fails or throws an exception. Change-Id: I51376724d164c8ad126e5b9be76890bf3e6a9fb0 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Use QVERIFY2 to output verbose failure messages.Jason McDonald2011-12-301-16/+6
| | | | | Change-Id: I2ce96d9d9f582e99c1d9f6dd6e6e80ce42d6e61d Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Correct misspelt function names in QFutureWatcher test.Jason McDonald2011-12-301-4/+4
| | | | | Change-Id: I60965f3475f83a7c42d2efc6ed8adf9a1403e144 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Correct misspelt function name in qtconcurrentmap test.Jason McDonald2011-12-301-2/+2
| | | | | Change-Id: I79b54b4e0de6319add89d220d3c3306556ab4ccc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Correct misspelt function name in qtconcurrentfilter test.Jason McDonald2011-12-301-2/+2
| | | | | Change-Id: Ie7ea2defac407d099d7bb27cccfb34911b832626 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Change test to use new QTRY_COMPARE/QTRY_VERIFY macros.Robin Burchell2011-12-301-26/+10
| | | | | | | | | | | When verifying nonzero results (i.e. that something expected *did* happen), using these macros allows bailing out of the timer much earlier than the potential 5 seconds. My running this on Linux goes from ~147 seconds to ~91 seconds. Change-Id: Ie1e41252eb4eb295b5c8e795ded02f00eb7f9387 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Improve QTextCodec::codecForLocale() test.Jason McDonald2011-12-291-9/+10
| | | | | | | | Don't call QSKIP when omitting the optional part of the test, as doing so hides the fact that the rest of the test passed. Change-Id: I9c102e8daeaf9586b2e510c4c9ce697ead290795 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't allow QThreadPool test to hang on failure.Jason McDonald2011-12-291-5/+2
| | | | | | | | Use QTRY_VERIFY() to fail after a reasonable timeout rather than putting the test into an infinite loop. Change-Id: Ie0917556e15999a94cc0587f3f4c11c0d743a228 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Avoid repeatedly registering the same meta-typeJason McDonald2011-12-281-2/+2
| | | | | | | | Register the meta-type in initTestCase(), which is run once, rather than in init(), which is run before every test function is run. Change-Id: Ic62a2469da6a2a85254ffc7c4d893395202c50d8 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Improve qtconcurrentthreadengine autotest.Jason McDonald2011-12-281-2/+3
| | | | | | | | | | The threadCount() test function is unstable and had been disabled by making it not be a slot. It is better to disable it with QSKIP so that the test output shows that the test function exists and is in need of repair. Change-Id: Iccdc8da31e0d15d922f7e9606835d1ff1a3a4966 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup itemmodel autotests.Jason McDonald2011-12-282-96/+96
| | | | | | | | Avoid using bug tracker identifiers in test function names. These identifiers lose their meaning when the bug tracker is replaced. Change-Id: Ia867f7c2ec2ab9ed546588843d532ac615a34031 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove old debug code from itemmodel tests.Jason McDonald2011-12-282-7/+0
| | | | | Change-Id: I7c6aeed2d3b593a4dac89e54ef22743d5f736d42 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Reinstate commented test data in QItemSelectionModel test.Jason McDonald2011-12-281-2/+0
| | | | | | | | The restored test data was marked as failing, but appears to pass, and the available history does not explain why it was commented out. Change-Id: I7e9e3ba72fc8fef42c91ee882efa98d25b3d8317 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup itemmodel autotests.Jason McDonald2011-12-289-650/+530
| | | | | | | | Bring the code closer to compliance with Qt's coding style guidelines and eliminate excessive vertical whitespace. Change-Id: Iaa29f8edf326ddb80cbadb6c18cca4fea88fd9b2 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove empty functions from itemmodels tests.Jason McDonald2011-12-285-138/+0
| | | | | Change-Id: I23775a334812b096192c7f44c4a3cb06f4b08705 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup corelib autotests.Jason McDonald2011-12-2819-8/+386
| | | | | | | | | | | | | When using QSignalSpy, always verify that the signal spy is valid. This will cause the test to give a meaningful failure when spying on a non-existant signal. Without this change, tests that spy on a signal to ensure that it is not emitted (i.e. by comparing the spy count to zero) could pass erroneously if something went wrong when creating the signal spy, as an invalid QSignalSpy will always return a count of zero. Change-Id: I41f4a63d9f0de9190a86de237662dc96be802446 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove mention of Trolltech in qlibrary autotest.Jason McDonald2011-12-283-8/+8
| | | | | | | Task-number: QTBUG-19653 Change-Id: I8cf21bac41b08187528ba7004a7a23b9baa64b17 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove mentions of Trolltech from QRegExp autotest.Jason McDonald2011-12-281-2/+2
| | | | | | | Task-number: QTBUG-19653 Change-Id: I55ae6bed6fb2177cdc842de34ef31ae98d0d3237 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove mention of trolltech from QThreadStorage test.Jason McDonald2011-12-281-1/+1
| | | | | | | Task-number: QTBUG-19653 Change-Id: I6c74a15b6c6db415a545328b73b6dd704d69bfee Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* add tests and benchmarks for QString::toLower()/toUpper()/toCaseFolded()Konstantin Ritt2011-12-251-5/+87
| | | | | | | | | Merge-request: 70 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Change-Id: I3929d4d8963c3cef6d2c6420d8ad1f7a45f7e042 Reviewed-by: Olivier Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Improve QSettings autotestJason McDonald2011-12-251-4/+2
| | | | | | | | QTestLib-based autotests cannot perform verification steps in the test class constructor. This needs to be done in initTestCase() instead. Change-Id: Ib1f7f838f052fa0fc5104603bdac01ffd8313aef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove empty functions from QSet autotest.Jason McDonald2011-12-251-4/+0
| | | | | Change-Id: Id6fac3a83e3f4385ee1978a19e6dc92605f4abdb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Finish removing Qt3 supportBradley T. Hughes2011-12-231-4/+4
| | | | | | | | | | | | | | | | Remove the (-no)-qt3support options from configure, and remove the last remaining references to Qt3Support, QT3_SUPPORT, and QEvent::ChildInserted. The compatibilityChildInsertEvents() tests in tst_QObject and tst_QWidget have been renamed to childEvents(), which is a more appropriate name. Change-Id: Id0b45e9b177efcc8dceee8c9ed8afafedeeace2f Reviewed-by: Kai Koehne <kai.koehne@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QCryptographicHash: allow to hash the content of a QIODeviceSune Vuorela2011-12-224-0/+44
| | | | | | | | | | | This adds a new function (and tests) to give the possibility of doing a QCryptographicHash of a QIODevice, like a QFile or whatever people needs. It is a quite handy overload in many cases. Change-Id: I22fd272f05571844641b3daefcc6746be4e5c7c3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix movablity of QVariant.Jędrzej Nowacki2011-12-221-2/+24
| | | | | | | | | | | | | | | | After 8fd64d22ac7892b061a09c42c72aacf033b80876 (Make usage of internal QVariant space.) change QVariant started to "inherit" movablity from interned type. This change fix it by interning only movable type in QVariant and by using external allocation for not movable ones. Obviously, this change has negative impact on QVariant it self, but after it, QVariant will behave a lot nicer with our containers. Change-Id: Ibffc95833918f65be737f52d694ee81a2036c412 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Allow QMetaType to register information about movabilityJędrzej Nowacki2011-12-221-0/+40
| | | | | | | We need that information to perform some optimizations in QVariant. Change-Id: Id9a1716e49e4cedd17cd09a32fea4ff003ef61f2 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Remove QT_NO_STL_WCHAR hackHarald Fernengel2011-12-221-7/+1
| | | | | | | We don't support gcc 2.95 any more. Change-Id: I842f1f8ac64b9006516c104add0991830ac9a46a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix compile error when configured with -no-exceptionsShane Kearns2011-12-221-1/+4
| | | | | | | | | | The test was skipped, but still tried to compile code that uses exceptions. The throwing class it uses was conditionally compiled out earlier in the file, causing an error for undefined class. Task-number: QTBUG-23028 Change-Id: Ia2e05a8a0abbf0e913f6c41e85bfee8b85cbc8a5 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Reimplement QAbstractFileEngine::open() properlyBradley T. Hughes2011-12-211-1/+1
| | | | | | | | | | | | | | | | | | The virtual function takes a QIODevice::OpenMode argument, not an int. tests/auto/corelib/io/qfile/test/../tst_qfile.cpp:1942: warning: 'MyEngine::open' hides overloaded virtual function [-Woverloaded- virtual] bool open(int ) { return false; } ^ src/corelib/io/qabstractfileengine.h:118: hidden overloaded virtual function 'QAbstractFileEngine::open' declared here virtual bool open(QIODevice::OpenMode openMode); ^ Change-Id: I92338dacb89c05d8c5cfbf8ce094dc519b84d3ba Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Revert "Revert "Add QObject::objectNameChanged(con... signal""Alan Alpert2011-12-201-2/+0
| | | | | | | | | This reverts commit 9b17557f3bbd5135651bcedf9f10e61d7e078ae2. Justification: Temporary commit, see JIRA task. Task-number: QTBUG-22985 Change-Id: I3df9eb5fdbdc133349dca5e192dcfcc9e758626c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Retire QTest::pixmapsAreEqual().Jason McDonald2011-12-201-4/+10
| | | | | | | | | | | | | QTest::pixmapsAreEqual() was left in the Qt4 API for compatibility with some old tests written for Qt3. QCOMPARE() is the preferred way to compare QPixmaps and provides superior diagnostic output when a comparison fails. This commit removes QTest::pixmapsAreEqual() from the testlib API and replaces the last few remaining calls with QCOMPARE. Change-Id: I051c0e7d3bda072855fcd262d82e8e540619233b Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix QDir::removeRecursively so it doesn't follow symlinks to directories.David Faure2011-12-191-0/+26
| | | | | | | | Critical bug... Good thing I had backups of my $HOME. Change-Id: I43b3a80786c946b0aec797036c1164d436d521f8 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Do not call QueuedConnection slot on partialy destroyed objectOlivier Goffart2011-12-191-4/+17
| | | | | | | | | | | | This is a regression introduced in Qt 4.8 When QApplication::processEvents is called from a destructor, it is possible that pending events would still be called on the already destroyed subclass. Prevent that by using the same pattern as in QMetaObject::activate Change-Id: Ida50db07ae089264402dafcde7a41a066479d08b Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Move proxy and selection models to QtCore.Stephen Kelly2011-12-1617-3/+7400
| | | | | | Change-Id: I71097855cb9e28105238e496778f29f99f7fc84e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix typos in QObject::(dis)connect warningsGiuseppe D'Angelo2011-12-151-1/+1
| | | | | | | | For some strange reason "Object::method ..." was printed, without the leading Q. Change-Id: I10b99e8aa8730e4020d15b3e04a01004bade76c3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QThread-test: Fix test on Windows (timer inaccuracy).Friedemann Kleint2011-12-141-9/+4
| | | | | | | | | | - Tolerate WaitTime - 1 (799ms when expecting 800ms). - Remove commented-out code. Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Change-Id: Ibe246d47ab7667692386b0f9333150c195948282 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>