Commit Graph

241 Commits

Author SHA1 Message Date
Jason McDonald
9f843918f2 Remove empty functions from itemmodels tests.
Change-Id: I23775a334812b096192c7f44c4a3cb06f4b08705
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-28 04:50:35 +01:00
Jason McDonald
ea415e2060 Cleanup corelib autotests.
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>
2011-12-28 04:48:11 +01:00
Jason McDonald
1e7296f3f2 Remove mention of Trolltech in qlibrary autotest.
Task-number: QTBUG-19653

Change-Id: I8cf21bac41b08187528ba7004a7a23b9baa64b17
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-28 04:48:06 +01:00
Jason McDonald
12392e222a Remove mentions of Trolltech from QRegExp autotest.
Task-number: QTBUG-19653

Change-Id: I55ae6bed6fb2177cdc842de34ef31ae98d0d3237
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-28 04:47:56 +01:00
Jason McDonald
087c4c6bc1 Remove mention of trolltech from QThreadStorage test.
Task-number: QTBUG-19653

Change-Id: I6c74a15b6c6db415a545328b73b6dd704d69bfee
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-28 02:56:08 +01:00
Konstantin Ritt
ebe43992f9 add tests and benchmarks for QString::toLower()/toUpper()/toCaseFolded()
Merge-request: 70
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>

Change-Id: I3929d4d8963c3cef6d2c6420d8ad1f7a45f7e042
Reviewed-by: Olivier
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-25 21:58:57 +01:00
Jason McDonald
bca775edaa Improve QSettings autotest
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>
2011-12-25 20:19:46 +01:00
Jason McDonald
f4c7bbba13 Remove empty functions from QSet autotest.
Change-Id: Id6fac3a83e3f4385ee1978a19e6dc92605f4abdb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-12-25 20:19:05 +01:00
Bradley T. Hughes
ae8c61db21 Finish removing Qt3 support
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>
2011-12-23 11:59:11 +01:00
Sune Vuorela
ef03396072 QCryptographicHash: allow to hash the content of a QIODevice
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>
2011-12-22 19:47:47 +01:00
Jędrzej Nowacki
ee0a997bcd Fix movablity of QVariant.
After 8fd64d22ac (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>
2011-12-22 16:09:34 +01:00
Jędrzej Nowacki
56f154c747 Allow QMetaType to register information about movability
We need that information to perform some optimizations in QVariant.

Change-Id: Id9a1716e49e4cedd17cd09a32fea4ff003ef61f2
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-22 13:20:40 +01:00
Harald Fernengel
d868c9945a Remove QT_NO_STL_WCHAR hack
We don't support gcc 2.95 any more.

Change-Id: I842f1f8ac64b9006516c104add0991830ac9a46a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-12-22 13:20:40 +01:00
Shane Kearns
d62228a77e Fix compile error when configured with -no-exceptions
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>
2011-12-22 02:28:09 +01:00
Bradley T. Hughes
58170cea15 Reimplement QAbstractFileEngine::open() properly
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>
2011-12-21 20:32:24 +01:00
Alan Alpert
cb9b7ceffb Revert "Revert "Add QObject::objectNameChanged(con... signal""
This reverts commit 9b17557f3b.

Justification: Temporary commit, see JIRA task.
Task-number: QTBUG-22985
Change-Id: I3df9eb5fdbdc133349dca5e192dcfcc9e758626c
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-20 11:15:21 +01:00
Jason McDonald
85a77cd5c8 Retire QTest::pixmapsAreEqual().
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>
2011-12-20 06:17:42 +01:00
David Faure
8707c09fcd Fix QDir::removeRecursively so it doesn't follow symlinks to directories.
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>
2011-12-19 20:48:16 +01:00
Olivier Goffart
87679491cb Do not call QueuedConnection slot on partialy destroyed object
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>
2011-12-19 14:06:12 +01:00
Stephen Kelly
211e434a05 Move proxy and selection models to QtCore.
Change-Id: I71097855cb9e28105238e496778f29f99f7fc84e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-12-16 13:00:57 +01:00
Giuseppe D'Angelo
be6b29f001 Fix typos in QObject::(dis)connect warnings
For some strange reason "Object::method ..." was printed, without
the leading Q.

Change-Id: I10b99e8aa8730e4020d15b3e04a01004bade76c3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-15 05:48:27 +01:00
Friedemann Kleint
f54916697a QThread-test: Fix test on Windows (timer inaccuracy).
- 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>
2011-12-14 23:26:15 +01:00
Friedemann Kleint
ab272fff56 QObject-test: Reorganize subprocess.
On Windows, the signalbug.exe could not be launched since it is
not next to tst_qobject.exe, which is in one of the
'release', 'debug' subfolders.

Introduce a subdirectory structure similar to that of
the QProcess test and use QFINDTESTDATA to locate it.

Change-Id: Ie8f2ede8cb76f22a908cb77517a74076be11fbb7
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-14 07:07:09 +01:00
Michael Brasser
a9ad8886fe Fix possible jump in animation timer.
When starting new animations with existing animations running, ensure
we force an update to the timer first, so that the new animations can't
mistakenly start with a very large delta.

This fixes tst_qdeclarativeanimations::alwaysRunToEndRestartBug failure
on slow machines.

Change-Id: Ida4e5dcf0ff792e6bfe0d244b6e969d04d0b20fa
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-12-14 02:16:40 +01:00
Kurt Korbatits
3c189d9b74 Fix qfile unit test failing on shadow build.
Updated three instances were not using QFINDTESTDATA.

Change-Id: Ibd0f6734791fc5d98ebeb65ac3bd80aa1c076414
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-12-13 07:41:27 +01:00
Michael Brasser
3bd3b82a2f Fix possible jump in animation timer.
If both a stop and start happen within an event loop, ensure they are
processed in order.

Based on a patch from Charles Yin.

Task-number: QTBUG-22865
Change-Id: I6131bd43a6ba5ad4fa37c863a9f4598bf2ac0e01
Reviewed-by: Leonardo Sobral Cunha <leo.cunha@nokia.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-12-13 02:23:42 +01:00
Stephen Kelly
309cdc358e Move QAbstractItemModel into a separate directory.
Change-Id: Ib505520dd5b52743634befbf3f148d7f8c21ec44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-12-13 02:23:42 +01:00
Robin Burchell
6802e3165e Add QVarLengthArray::length().
This also adds a unit test for length()/count()/size(), since there wasn't one
testing it explicitly.

Change-Id: Ifb7f113aa97beef5f76e5fb246eb38495344b0ad
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Marco Schmidt <Marco.Schmidt@Taugamma.de>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-12 17:27:19 +01:00
Bradley T. Hughes
55b432b24c Update .gitignore for tests/auto/corelib/io/qresourceengine
The test generates the runtime_resource.rcc data file at build time. Add
this to .gitignore.

Change-Id: Ief4057072b28499049147b86f166523b71afe269
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-12 12:51:02 +01:00
Bradley T. Hughes
6f0f9f6928 Remove QMetaObject guards and deprecate QPointer.
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>
2011-12-10 16:11:48 +01:00
João Abecasis
d8374aebc6 Fixes for tst_QTemporary(File|Dir)::nonWritableCurrentDir
- Check path/fileName is empty upon failure, variable was unused
- Use /home instead of /, as / is writable by admins on Mac

Change-Id: I705471fda8b73843e98b30eb52aa0a73634ec075
Reviewed-by: David Faure <faure@kde.org>
2011-12-09 14:15:37 +01:00
Friedemann Kleint
e8efad1b22 QProcess-test: Fix executable location on Windows.
The executable needs to be in the test directory
as it expects it sub-executables from there.

Breakage introduced by 3385fb91e1

Change-Id: Ic1f3db70851f65e2f12041c3a16cb8f0b7bdf35e
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-12-09 12:25:14 +01:00
João Abecasis
12dffdae75 Promote openStandardStreams sub-tests to top level
Commit a72468e820c2922540737c053eef27d033c2e77b split the test into two
functions, but kept them combined in a single slot for QTest to invoke.

That being the case, we might as well have them as test functions of
their own right. Should work nicer with test failures, skips and such.

Change-Id: I62c1fc7777c08b3e87a5903632d73dc1e1d97e1a
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-12-09 10:17:55 +01:00
Friedemann Kleint
2509a5b5a4 QFile-test: Do not fail when run with redirected stdout/stderr.
Check whether stdout/stderr is sequential.

Change-Id: Ia6311e265f0da03dce5b05d78a2058e0c2098bbf
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-09 08:23:53 +01:00
Friedemann Kleint
04cac41e58 QProcess-Test: Improve error handling.
In case a subprocess fails to start.

Change-Id: I1372c07de8f3580a8e7aadd6874da15bf273ac53
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-09 08:23:27 +01:00
Joerg Bornemann
f7d11b216a testProcessSpacesArgs fixed
Target names with spaces must be quoted.

Change-Id: I913ef386353fc75991c8db4e3205ab511fc1f1a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-09 01:01:01 +01:00
David Faure
5cb05091d2 Improve/cleanup qtemporarydir (and qtemporaryfile) unit tests
To follow the comments in the review by João Abecasis.

Change-Id: Ie566705d3b4071b8628d269246aadcde4866f34f
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-08 21:12:57 +01:00
David Faure
ca1af75fb2 Fix QTemporaryDir unittest on Mac OS X
mkdtemp(10*X) replaces all 10 chars on Mac, while on linux it only
replaces the last 6. Adjusted the too-strict tests to allow for
both possibilities.

Change-Id: Ie6d57bd4947254ad7a39e75ac0e8881cebeaa428
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-08 16:00:53 +01:00
David Faure
c44a67e6f3 Port externaltests.cpp to QTemporaryDir
Change-Id: I6097ea92dd4b300cb562510e0ea27cee3c01b466
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-07 18:58:43 +01:00
Bradley T. Hughes
b6e9ff22a3 Fix tst_QSharedPointer invalidConstructs:forward-declaration failure
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>
2011-12-06 18:37:54 +01:00
Jason McDonald
e3640d1bdd Remove TESTED_CLASS/TESTED_FILES comments from tests.
These comments were mostly empty or inaccurate.  Appropriate naming of
tests and appropriate placement of tests within the directory tree
provide more reliable indicators of what is being tested.

Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-06 02:19:25 +01:00
Jędrzej Nowacki
d242d78339 Make tst_QVariant::canConvertMetaTypeToInt more verbose.
Change-Id: If17cbd1154c4fd3c006648b28e91a009de5b373b
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-05 17:23:00 +01:00
David Faure
e999c543a0 New class QTemporaryDir.
As discussed on qt5-feedback / development lists.

Change-Id: If1733369d12daa29054776ec2cbd78e63679768e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-02 21:04:34 +01:00
Bradley T. Hughes
ad8edac53c Remove QInternal callbacks and internal functions
After commit 79f675a1e0, the connect and
disconnect callback API effectively becomes useless. Now that these
callbacks cannot/do not, it makes little sense to keep the backdoors
added for Qt Jambi support.

Remove them for now. Should the Qt Jambi team want/need to port to Qt 5,
we can re-add them, possibly designing a better API for doing so as
well.

Change-Id: I6209a1d647d683c979d5294b632b8c12c0f9f91c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-12-02 15:59:58 +01:00
David Faure
1bb51cb8b1 Implement QDir::removeRecursively
Task-number: QTBUG-4592
Change-Id: I363e2c24d1c0ada975b8b927d7c6e776b8aae579
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-02 15:59:58 +01:00
Bradley T. Hughes
409b3b42a2 Remove cast and assignment operators from QAtomicInt and QAtomicPointer
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>
2011-12-02 13:21:32 +01:00
Friedemann Kleint
b0b22e8d49 Windows: Stabilize qpauseanimation test.
Change-Id: I93b470d89009d4573cbe3ec5018cddc40f4a4623
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-12-02 08:24:57 +01:00
Martin Jones
9b17557f3b Revert "Add QObject::objectNameChanged(const QString &objectName) signal"
This reverts commit ba635d7e74.

Breaks tests in declarative:
tst_qdeclarativeecmascript::deleteLater
tst_qquickvisualdatamodel::objectListModel

Change-Id: I467b45109332e66fc62f3de00f376b1b88ab19ca
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2011-12-02 06:03:12 +01:00
Friedemann Kleint
f0942bd8cb Windows: Fix qabstractfilenengine-test.
The test fails if the repository is checked out with
Windows line endings. Try to work around.

Basically, ensure that common developers can conveniently
run the test.

Change-Id: I91f31b830ba7ba305deea782737d4e07a89420eb
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-12-01 22:37:31 +01:00
Bradley T. Hughes
ba635d7e74 Add QObject::objectNameChanged(const QString &objectName) signal
This is sent when the object's name changes.

tst_moc must be updated since the method count of QObject has changed.
The test assumed that there were 4 invokable methods in QObject. The
new signal is the 5th, which breaks the test's assumptions. Fix this
as well.

tst_QObject must be updated since the
QObjectPrivate::isSignalConnected() method only supports the first 64
signals. With the addition of this new signal, sig61() in the test
becomes the 65th signal, and will always appear connected now.

Task-number: QTBUG-13999 (related)
Change-Id: Ie87893c71a231fafa7ccf2f16102238a7be8327a
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-01 17:46:57 +01:00