Commit Graph

300 Commits

Author SHA1 Message Date
Friedemann Kleint
8fedf68369 Fix qfile:invalidFile() test.
The test expects 'fail:invalid' to be an invalid file,
which it no longer is on Windows 7. It also assumes that
f: is an invalid drive. Fix by picking a drive that does not exist.

Task-number: QTBUG-27306
Change-Id: I9d9b36c50fc31d2561d3c4eec66f65d96084f0d7
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-10-29 13:46:50 +01:00
Sergio Ahumada
048d28a674 test: Remove QSKIP from tst_QSettings::fileName()
Change-Id: I24ed2d182faff989f62f192246ebf95ca492c10d
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-24 01:39:06 +02:00
Sergio Ahumada
ead0e0029a test: Fix tst_QDir.equalityOperator()
On Fedora 17 /sbin/ is a symlink now, so this test fails there.
Using /usr/ instead.

Change-Id: Ie35902fc093101191bdbf33324e20835d1da1528
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-10-24 01:39:01 +02:00
Marc Mutz
a438267c84 normalise signal/slot signatures [QtCore tests]
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>
2012-10-22 03:21:01 +02:00
Sergio Ahumada
221bd941ff test: Moving tst_QProcess::echoTest_performance()
tst_QProcess::echoTest_performance() is not an unit test but a
performance test, so moving it from 'tests/auto/corelib/io/qprocess'
to 'tests/benchmarks/corelib/io/qprocess'

Change-Id: I796788534eafc5ca3b8d86c0ec46998285fd4b8f
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-10-19 02:43:05 +02:00
Caroline Chao
8506850cc8 Test: remove QSKIP from tst_QTextStream::stillOpenWhenAtEnd
Instead omit the whole test when Q_OS_WINCE is defined.

Change-Id: Ifd09048687db95913f39a64cffb42a743af8fa81
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-18 12:24:55 +02:00
Caroline Chao
0b23cd186c Test: remove QSKIP in tst_QDataStream::stream_QIcon
Instead omit the whole test when Q_OS_WINCE is defined.

Change-Id: Ic69accb138121d2b39f068cef181da13b18e46ee
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-18 12:23:44 +02:00
Caroline Chao
6dfeee624a Test: remove QSKIP in tst_file
Instead omit the whole tests when appropriate.

Change-Id: I5eae127a497e290c5e4ba1a81a8f325c300471c1
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-18 12:23:23 +02:00
Caroline Chao
1fef528d33 Test: remove QSKIP in tst_QDir::dotAndDotDot
Instead omit the omit the whole test when Q_OS_WINCE is defined.

Change-Id: I8c0f12c63bbc4567edb3a8626ab060d5ce38f3cd
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-18 12:22:51 +02:00
Caroline Chao
18a3ebe4e5 Test: remove QSKIP in tst_QDirIterator::hiddenDirs_hiddenFiles
Instead omit the whole test when Q_OS_WIN is defined.

Change-Id: I08060168edb2353f4960129b1c0654fea165ca6c
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 20:43:37 +02:00
Caroline Chao
c8c0bdffb7 Test: remove QSKIP in tst_QDataStream::stream_QPixmap
Instead omit the whole test when Q_OS_WINCE is defined.

Change-Id: I356af3ea145012142b3cf2af0b5d813d4be07a25
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 20:43:37 +02:00
Caroline Chao
4fc515de4e Test: remove QSKIP from tst_LargeFile::mapOffsetOverflow
Instead omit the whole test when Q_OS_MAC is defined.

Change-Id: I7d35c99ecd69b3c5bb8f8590342edd9665300709
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-10-16 20:43:37 +02:00
Caroline Chao
d81cf44a6b Test: remove QSKIP from tst_qstextstream
Instead omit the whole tests when Q_OS_WINCE is defined.

Change-Id: Idb15d622c9e1dbe4c8ec6a43c34a88e7fef2a384
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 15:29:15 +02:00
Caroline Chao
26dddabcaa Test: remove QSKIP from tst_QProcessEnvironment::putenv
Instead omit the whole test when Q_OS_WINCE is defined.

Change-Id: I19e35b837709c92e0202c6a96d113367bc6c92c2
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 15:29:15 +02:00
Sergey Hambardzumyan
21b5c1d4a9 tst_qfile: remove QSKIP's -> omit whole test cases instead
Change-Id: Ibc01790992e839e3afde4b52682cb155c7f3f5f8
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-10-15 20:57:58 +02:00
Thiago Macieira
24a231d7a3 Re-revert "Delay creation of the process manager"
This reverts commit daba2c507ad42c66dafa6a29cffa94e9641e0c58,
re-applying commit d9c06bf25210b3d0b31ee6126e57bcb82c292da1, because
the change was accidentally brought back in commit
eae8fb8599.

There's a potential deadlock when a QProcess is created while a
QCoreApplication is instantiated but never executed, or if the main
thread waits() for the child thread.

Task-number: QTBUG-27260
Change-Id: I9e0fdc0341b3063de90979377bac35f2a827b260
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-10-15 04:52:08 +02:00
J-P Nurmi
6b04ee10e6 Auto tests: revise cursor dependant tests
Cursor dependant auto tests are currently skipped in various ways.
Some are checking PlatformQuirks::haveMouseCursor() that tries to
detect if the desktop environment is MeeGo, using obsolete Q_WS_X11.
Some are skipped if QT_NO_CURSOR or Q_OS_WINCE is defined and
some are actually missing the approriate guards.

=> unify by defining QTEST_NO_CURSOR in qtest-config.h when
appropriate ie. for platforms that have no regular mouse cursor
support or when QT_NO_CURSOR is defined.

Task-number: QTBUG-22551
Change-Id: I9a1e0e3156617945ae46226c79268955454c8a9a
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-10-13 05:51:19 +02:00
Friedemann Kleint
0e8a2788d8 Fix Windows: QStandardPath::findExecutable() to check suffixes.
Append the Windows executables suffixes from the PATHEXT
environment variable.

The previous code had a bug since the 'break' statement
bailed out of the inner loop only.

Factor search code out into a separate functions, avoiding
repeated invocations of list.constEnd() and variable
assignments in the old code.

Add a static function that is called on Unix and on Windows
for executable names with a suffix.

Call another function applying a candidate list of suffixes
in case an executable name without a suffix is passed.

Lower case the extensions from PATHEXT, streamline code.

Split up the test, add a _data() slot for clarity.

Task-number: QTBUG-27457
Change-Id: I2bf34de52aeadddd3b937ad1e22191c3c850fd26
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-10-08 17:21:35 +02:00
Thiago Macieira
f89fd779fc Overhaul a little the QUrl error reporting.
Keep the original QString that triggered the parsing error, instead of
just one QChar. This provides more powerful error messages, like:

 Invalid IPv6 address; source was "http://[:::]";  scheme = "http", host = ""
 (QUrl cannot keep invalid hostnames)

 Invalid port or port number out of range; source was "http://example.com:abc";  scheme = "http", host = "example.com"
 (QUrl cannot keep a non-numeric port number)

 Invalid path (character '%' not permitted); source was "foo:/path%?";  scheme = "foo", path = "/path%25%1F"
 (the tolerant parser runs first, so the faulty component is fixed)

This stores the error state in a special structure which is not
allocated under normal conditions, keeping the memory consumption
down. On 32-bit systems, QUrlPrivate does not increase in size; on
64-bit systems, it grows by 8 bytes.

Change-Id: I93d798d43401dfeb9fca7b6eed7ea758da10136b
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
4f52a95099 Update some error messages in QUrl::errorString()
Make both invalid hostname messages start with "Invalid hostname". And
split the empty port error from the invalid port one.

Change-Id: I870d1ed6fb07ec494f553871a37ed167141ffc06
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-10-02 22:34:42 +02:00
Thiago Macieira
ceca141d0c Remove the annoying qWarning when QUrl::setPort is out of range
That's what we have QUrl::errorString() for. This will become evident
especially now that QUrl::toString() / toEncoded() return empty if
there are errors.

Change-Id: I64a84e9c6ee57c0fc38cc0c58f5286ddc1248d1f
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
adce435a0c Make QUrl::toString() / toEncoded() return empty for invalid URLs
Change-Id: I6ebb4ad2901a9bacb09fb81082202f37ebbc2e97
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
7d62f8ace5 Add two compound URL invalidity cases for isValid()
These two errors can only happen if one calls setPath() explicitly. They
cannot happen for parsed URLs, which is why they are only caught with
isValid(). It's not possible to set the error condition in setPath()
either because they depend on the presence / absence of the authority
and scheme.

Also update all the unit tests that set a path not starting with a slash
and were just "freeloaders" on the previous behaviour.

Change-Id: Ice58cd4589a850452d7573a5b19667bbab2fb43e
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thomas Hartmann
ad41111167 QProcess.tests: adding test for channel forwarding
This tests QProcess::setProcessChannelMode().

The tests verifies if testForwarding really forwards
the output of testProcessEcho (spawned by testForwarding).

Change-Id: Ifc4164569256aeaeab0edef42116986272362c01
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-10-02 13:22:49 +02:00
Andy Shaw
ef3a544436 Rename createLocalFile to createNativeFile & deprecate createLocalFile
As it was confusing to use the term local file when referring
to a file that was accessible using native APIs and not just
a file that was on a hard disk somewhere already the function
name has been changed.

By renaming it to createNativeFile we keep it consistant with QFileInfo
which has an isNativeFile() function too.

Test also added.

Task-number: QTBUG-3169

Change-Id: I410e7ed28133d68fd312c6c0faf3f7191460d7ce
Reviewed-by: João Abecasis <joao@abecasis.name>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-02 10:43:48 +02:00
Joerg Bornemann
618c5f854f QWinOverlappedIoNotifier test for multiple I/O operations added
tst_QWinOverlappedIoNotifier::multipleOperations starts asynchronous
read and write operations on the same named pipe handle.
The received notifications must contain the right byte count and
OVERLAPPED pointer corresponding to the I/O operation.

Change-Id: I6f3fa5cf3ca6d62fcb9bc7073d28611fcfa7d98a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2012-10-02 08:05:58 +02:00
Joerg Bornemann
94dc0c6594 QWinOverlappedIoNotifier: multiple I/O operations on the same handle
When doing multiple I/O operations on the same handle, we get notified
for every operations. These must be distinguished by comparing the
pointer to the OVERLAPPED struct.

We now pass the OVERLAPPED pointer via the notified signal and let the
receiver decide if it wants to handle this notification.

Change-Id: I4efe70f39c6ae5282b949f2f4b21f6e7dd3df785
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-10-02 08:05:55 +02:00
Joerg Bornemann
52e6a908bd remove no-op test from tst_qfile
According to the repo history the tailFile was introduced with the
S60 port but the functionality it's testing was never implemented.

Task-number: QTBUG-22341

Change-Id: I16e8e43bbd799f05f8b136925cb0add0b918289e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-09-27 15:50:17 +02:00
Caroline Chao
371c21b9a8 Test: tst_QFile::writeLargeDataBlock() unstable failure as XFAIL
While the large data block can be written to a file, the test is
also showing instability while reading back the written block.

Adding another expected failure to address this instability.

Task-number: QTBUG-26906

Change-Id: I9704d441cf2bd6d7ef0f9023240ea61bb89561b6
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-09-26 10:08:59 +02:00
Caroline Chao
9f98fe04c1 Test: tst_QFile::writeLargeDataBlock() unstable failure as XFAIL
The current check is not enough to catch the unstable failure.
Update the test to catch the failure in all cases.

Task-number: QTBUG-26906

Change-Id: I2e37a1f6513df768cd410df7c91a9fd843150e57
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-25 18:36:09 +02:00
João Abecasis
0c2b7b1020 Fix default-constructed QFileSystemEntry
Member variables for lastSeparator, first and lastDotInFileName are now
initialized to -1 (non-existing), where the previous value of zero would
mean a separator/dot at that position and resulted in path() returning
'/', instead of '.'.

Tests were expanded for better coverage of empty state and
default-constructed instances.

Change-Id: Ie27547886b52224d38b5be0b4f920c9927fd440f
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-09-25 00:08:16 +02:00
Caroline Chao
99f2bdd28f Test: Enabled tst_QFile::invalidFile
The test is not hanging on Windows anymore.

On Windows, add an expected failure for the failing case.

Task-number: QTBUG-22801
Task-number: QTBUG-27306

Change-Id: Iede95766504f3e8a278a4554a5967ca333aae3bf
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-24 21:27:51 +02:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
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>
2012-09-22 19:20:11 +02:00
Oswald Buddenhagen
33e0d5c939 remove mentions of borland from project files
Change-Id: I3049b24ae287bee50aca1de06664a2309df69edf
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-09-19 19:54:44 +02:00
Rafael Roquetto
31f94e0285 Blackberry: fix tst_QFileInfo::fileTimes()
The Blackberry OS uses a filesystem with the noatime option,
which returns a "wrong" access time.

Change-Id: I04cdb899699e819a36e0917e30d750067b33388d
Reviewed-by: Tobias Koenig
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Peter Hartmann <phartmann@rim.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2012-09-14 19:07:15 +02:00
Sergio Ahumada
34cd8fd566 tests: Don't omit the body of a test function with QT_BUILD_INTERNAL
Changing it outside of the test function definition to avoid running
empty/inapplicable test functions.

Change-Id: I713560cde7f715696984ed082d682900f5f1bcdd
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Caroline Chao <caroline.chao@nokia.com>
2012-09-14 06:24:38 +02:00
Markku Heikkila
d1d4647b74 Fixed: QFileInfo::lastModified() returning wrong value.
Fixed so that empty QDateTime is returned for non existing file.
Fixed also created() and lastRead() to return empty QDateTime for
non existing file.

QFileSystemEngine::fillMetaData() returned true for non existing
files. This was also corrected.

Task-number: QTBUG-25811

Change-Id: I523eb99e4405b4b813b2950f85cc646239181d07
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Christian Stromme <christian.stromme@nokia.com>
2012-09-13 19:33:08 +02:00
Rafael Roquetto
4a588c27e8 Blackberry: fix tst_QFileInfo::isWritable()
This test checks the access permissions for '/etc/passwd', however the
filesystem on Blackberry is always read-only

Change-Id: I9299531397d4467287541b04184540ad6e2eae72
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2012-09-13 16:52:51 +02:00
Sergio Ahumada
56d5c909af Use true and false in preference to TRUE and FALSE
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>
2012-09-05 03:03:05 +02:00
Sergio Ahumada
531b96f42e test: Mark tst_QFile::writeLargeDataBlock() unstable failure as XFAIL
The test has one unstable failure on Windows, so mark this with QEXPECT_FAIL

Task-number: QTBUG-26906
Change-Id: I2f6c63ddefecacd224d93f83e6951e961a02a051
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-08-31 18:56:35 +02:00
Kevin Funk
7cea395d1f Make tests/auto/corelib compile on Windows CE
Change-Id: I71987d40ae69d95f645c4c7d26d50add4c799327
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-08-30 06:22:34 +02:00
David Faure
ac2b452616 QUrl: port thread-safety autotest from Qt4.
This detected the same missing detach()s in QUrl::resolve.
Everything else works, no need for a mutex in Qt5's QUrl.

Change-Id: I0da51b7b0c6b810d314a26d4b638383cd17de12b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-26 11:08:42 +02:00
Thomas McGuire
b6f92043e0 Remove unused inotify includes in the filesystem watcher test
Change-Id: I346ef6ccf7b09390bef6d35c82ecee6dee1711fc
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-08-23 11:20:37 +02:00
Thiago Macieira
ce9b010ec6 Fix decoding of QByteArray in the deprecated "encoded" setters in QUrl
The asymmetry is intentional: the getters can use toLatin1() because the
called functions, with a QUrl::FullyEncoded parameter, return ASCII
only. This gives a small performance improvement over the need to run
the UTF-8 encoder.

However, the data passed to setters could contain non-ASCII binary data,
in addition to the percent-encoded data. We can't use fromUtf8 because
it's binary and we can't use toPercentEncoded because it already encoded.

Change-Id: I5ecdb49be5af51ac86fd9764eb3a6aa96385f512
Reviewed-by: David Faure <faure@kde.org>
2012-08-20 21:59:32 +02:00
Thiago Macieira
60818231d8 tst_qurlinternal: use qurl_p.h instead of declaring the functions
Just in case someone (like me) changes the function signatures or adds
new functions.

Change-Id: I1025fea012d95ffe89acaf799aa58fd2b0babc80
Reviewed-by: David Faure <faure@kde.org>
2012-08-20 21:59:28 +02:00
David Faure
a23da5fd6b Add bool QStandardPaths::isTestModeEnabled()
Library code might need to know this, e.g. when calling an external
process, to give it the right configuration. (For instance when
ksycoca code calls kbuildsycoca to recreate the DB at the right place).

Change-Id: I343ddefff816586f9d391973c08ff1e1ad86bf0e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-09 13:48:13 +02:00
Thiago Macieira
672b5b7ab6 Set the Qt API level to compatibility mode in all tests.
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>
2012-08-01 15:37:46 +02:00
Thiago Macieira
0838ac541d Make sure that the parsing mode reaches QUrlPrivate::setHost
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>
2012-08-01 13:04:21 +02:00
Thiago Macieira
e1038794b1 Make QUrl::setScheme only parse in strict mode (no decoding)
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>
2012-08-01 13:04:18 +02:00
Thiago Macieira
f893d9ec41 Fix QUrl support for empty usernames and passwords
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>
2012-08-01 13:04:15 +02:00