Commit Graph

1145 Commits

Author SHA1 Message Date
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
Mitch Curtis
b016597db8 Return invalid datetime when calling addMSecs with invalid QDateTime.
This is in line with what QTime::addMSecs and QDate::addDays do, for
example.

Change-Id: I902112486727f74f669a97bde6c42028e0838f8d
Reviewed-by: Jon Severinsson <jon@severinsson.net>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2012-10-24 01:38:58 +02:00
Mitch Curtis
8310533975 Improve QTime test coverage.
Change-Id: If47de3dc047ac4f8a4a1498cf225e03bbbf4110e
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Jon Severinsson <jon@severinsson.net>
2012-10-24 01:38:56 +02:00
Mitch Curtis
6a7a08b4a8 Improve QDate test coverage.
Some statements could not be tested, such as default cases of switches
where all possible cases are already handled and some statements where
the system locale is used.

I also removed some statements that would never be reached and hence
will never be able to be covered by tests.

Change-Id: I8ea3071f66d942d986e65708732af6751d36b5e3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2012-10-24 01:38:54 +02:00
Mitch Curtis
811bf4da67 Output leading zeroes for yyyy date formats in QLocale::toString().
Converting the date 1 January 0001 to a string in the format
"dd MMMM yyyy" currently results in the string "01 January 1", but it
should be "01 January 0001".

Task-number: QTBUG-27287
Change-Id: Ia025da7343d1c36aaee34c47c6db551a6e89595f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-24 01:38:49 +02:00
Mitch Curtis
13846e8013 Revert removal of commented out tests in tst_qdatetime.cpp.
Two lines were commented out but were removed with
Ib6ceb1cb7fb4c6eca672495f96d9cfd907853c85. They have been replaced
as expected fails.

Task-number: QTBUG-22833
Change-Id: Ib154a31bffcdc8e43c6ad236df193e99334652c6
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2012-10-22 03:21:33 +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
Sze Howe Koh
d7e8b57d0a Remove the QThread::terminated() signal
The signal is removed from the API; all references to it are removed
from documentation; the unit test that checks for its emission is
modified to listen for QThread::finished() instead.

The QThreadPrivate::terminated flag is also removed, as it served no
purpose other than to trigger the emission of QThread::terminated()

As discussed at http://lists.qt-project.org/pipermail/development/2012-October/007216.html
the signal is not guaranteed to be emitted after every termination,
rendering it useless.

Change-Id: I7b0c45d7889da0d33875545331606f2208ee56fc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-10-19 20:25:16 +02:00
Andreas Hartmetz
bdc115d969 detach() safely in QVector::erase(), and update callers to not detach.
remove() can use non-detaching iterators internally before calling
erase(), which hasn't been exploited so far, so that the detach() in
erase() never actually detached. When using erase() from outside,
you can't do it legally without calling begin() or end() that detach()
before erase() is called.
Now remove() doesn't detach anymore, and detaching in erase() works.
With new tests that fail after changing only the erase() callers
and pass again after fixing erase().

Change-Id: I47c0a9e362dce8628ec566f5437d951755de96c8
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2012-10-19 18:04:11 +02:00
Caroline Chao
f948294f5e Test: remove QSKIP from tst_QStringList::initializeList()
Instead omit the whole test when Q_COMPILER_INITIALIZER_LISTS
is not defined.

Change-Id: I34017484a027b95a2677e1c4cb9231fa2aeb5680
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-10-19 09:41:36 +02:00
Caroline Chao
33aea0cc1c Test: remove QSKIP in tst_QLocale::emptyCtor
Instead omit the whole test when appropriate.

Change-Id: Iebd569676cc7b2f8fe4a1d272107e092410d397b
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-10-19 09:41:36 +02:00
Thiago Macieira
320c4e31e1 Make QContiguousCache with zero capacity not crash
These containers don't make sense and will just result in no action
being taken (all items added will simply be discarded), but it
shouldn't crash due to a division by zero.

Update the documentation to explain the fact.

Task-number: QTBUG-27339
Change-Id: Ib9acf5c0a9a826e6853e7beaf5e56511fde98dc6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Ian Walters <ian@walters.id.au>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-19 07:50:29 +02:00
Caroline Chao
f7f9a28a26 Test: remove QSKIP from tst_QDateTime::fromString_LOCALE_ILDATE
Instead omit the whole test when Q_OS_WIN is not defined.

Change-Id: I311538ce839353d4d5e83edfd12c68968fe61215
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-19 02:44:52 +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
5c57d1eacb Test: remove QSKIP in tst_qarraydata
Instead omit the whole tests when appropriate.

Change-Id: Id4ec171528d4b4d6849b2478ac4f4a2332789b55
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-18 14:55:23 +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
a530c3381b Test: remove QSKIP in tst_QSharedPointer::lambdaCustomDeleter
Instead omit the whole test when Q_COMPILER_LAMBDA is not defined since
the test is not relevant in that case.

Change-Id: I541da96a881fa0c9be38ae5c0f86df047dd8fc6b
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 20:43:37 +02:00
Caroline Chao
c35c913916 Test: remove QSKIP from tst_QThread::stressTest
Instead omit the whole test when Q_OS_WINCE is defined.

Change-Id: Id6f4e65c994115b8bab45f9fbf21dd255d204ea6
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 20:43:37 +02:00
Caroline Chao
fdc9ce5908 Test: remove QSKIP from tst_QSocketNotifier::posixSockets
Instead omit the whole test when Q_OS_UNIX is not defined.

Change-Id: If0ee3345c25f6b1baa38845edfd08ec26a45d6f2
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 20:43:37 +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
782cae4104 Test: remove QSKIP in tst_QCoreApplication::argc
Instead omit the whole test when Q_OS_WIN is defined since
the test is invalid on this platform.

Change-Id: Idb77df96b0c2a223cddbfffb4e24c6d1f5d33dfb
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-16 15:29:15 +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
Konstantin Ritt
da7111be51 QTextBoundaryFinder: Fix handling of break opportunities
Add BoundaryReason::BreakOpportunity flag that will be returned by the
boundaryReasons() when the boundary finder is at the break opportunity
position that might be not an item boundary.
This is the same as (StartWord || EndWord) in Grapheme and Sentence modes;
in Word and Line modes, BreakOpportunity flag might occur between the words
or in between of Line boundaries (e.g. in conjunction with SoftHyphen flag).
In other words, the text boundaries are always break opportunities, but not vice versa.

StartWord and EndWord flags has been deprecated by new StartOfItem and EndOfItem
flags which are not about the word boundaries only. In line breaking,
StartOfItem and EndOfItem are set for the mandatory breaks only.

Change-Id: I79bf297e2b988f5976f30cff0c8ca616385f6552
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2012-10-12 07:44:51 +02:00
Konstantin Ritt
f0ee31dc93 QTextBoundaryFinder: Introduce BoundaryReason::MandatoryBreak flag
that will be returned by boundaryReasons() when the boundary finder
is at the line end position (CR, LF, NewLine Function, End of Text, etc.).
The MandatoryBreak flag, if set, means the text should be wrapped at a given position.

Change-Id: I32d4f570935d2e015bfc5f18915396a15f009fde
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-10 13:26:13 +02:00
Jon Severinsson
85c47eed6b Change QDateTime::addSecs() and QDateTime::secsTo() to use qint64.
addMSecs() / msecsTo() have always used qint64, and when QDate was changed
to use a 64-bit julian day, QDateTime::addDays() and QDateTime::daysTo() was
changed to use qint64 in order to support the full extended range, but
addSecs() and secsTo() seems to have been forgotten.

Change-Id: I3acc35ee2bcc9f353650eb42f97d428f706b2db6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-10 08:45:22 +02:00
Konstantin Ritt
2672c4fa91 Update the Unicode Data and Algorithms up to Unicode 6.2
Version 6.2 of the Unicode Standard is a special release
dedicated to the early publication of the newly encoded Turkish lira sign.
In addition, there are some significant changes to the Unicode algorithms
for text segmentation and line breaking to improve breaking for emoji symbols.

For more details, see http://www.unicode.org/versions/Unicode6.2.0/

Change-Id: I21cfd4f307e41b41a19d36cce87f7a44c2661bc2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-09 03:04:41 +02:00
Christian Strømme
0ed3cf2a1c Removed the "tst_QVector::outOfMemory" test.
The test is useless as we assert if the requested size exceeds
a certain limit. We could, as an alternative,
throw an exception, but in the end it's the caller's responsibility
to ensure that the requested size is a sane value.

Task-number: QTBUG-27285
Change-Id: I738950a6a2b51671a54e4d25c7e4c3ac0d7f63b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-08 17:38:20 +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
Sergio Ahumada
b4bf76fffc tst_QLocale: remove QSKIP, wrap Q_OS_MAC/Q_OS_WIN
Change-Id: I44755379561b98e43dd19c8c01b40349be203e14
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-10-04 09:09:15 +02:00
Leonard Lee
122b09c1d0 Remove #if 0 usage in QElapsedTimer autotest.
Given QElapsedTimer t1, t2 variable, the t1-t2,
t1+1000 (add 1 second) operations not supported.

Task-number: QTBUG-22446
Change-Id: Idd87f778c212831aa7f92242452538d113c9cfcf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-04 03:03:35 +02:00
Christian Strømme
403b15488b Fix for integer overflow in QString::replace
Task-number: QTBUG-22967

Change-Id: I604e6a725d46eab4c4369ebb54e8c9ea1350f492
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-03 17:30:30 +02:00
Konstantin Ritt
3d620088b4 Fix QTextBoundaryFinder assignment operator
for the case when the boundary finder is assigned to an invalid one.

Change-Id: I5b60984ff3fd99972fcae21895684bd83b012780
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-03 16:34:32 +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
Jędrzej Nowacki
abcdc7fd87 Make documentation of QVariant::isNull more explicit.
Task-number: QTBUG-22933
Change-Id: I1d8d3fc778ba00bcad11caaaf8af7d87186f18e8
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-09-29 02:31:35 +02:00
Marc Mutz
ac9be327f8 QFlags: use unsigned int when the enum's underlying is unsigned
Replace storage and operator int() return types with unsigned int
if the enum is unsigned.

This fixes a number of exisiting warnings, in particular with
Qt::MouseButton under GCC.

Change-Id: Ia12d36212329aec3e9d62a5fbd38809a6c2b36d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-28 23:50:10 +02:00
Marc Mutz
7d21abfca3 Move QFutureSynchronizer back to QtCore
This class, too, belongs with QFuture.

Change-Id: I41a532ca66c156f1631e4b22ffc1a5879c854488
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-28 23:50:10 +02:00
Marc Mutz
08c50599f1 Move QFutureWatcher back to QtCore
This belongs with QFuture.

Change-Id: I555cd01c1d3890fbbaca4fd8a9170292ea4eb0fb
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-28 23:50:10 +02:00
Marc Mutz
727f25214e Move QFuture from QtConcurrent to QtCore
This class belongs to QThreadPool/QRunnable more than to QtConcurrent, so
move to QtCore, where QThreadPool awaits it.

Change-Id: Ibf20288a986593bf779453427c2dae8db1e1423a
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-28 23:50:10 +02:00
Marc Mutz
a65a98399b Move QtConcurrent::ResultStore as QtPrivate::ResultStore to QtCore
No compatibility header needed. While this wasn't marked as private API,
it wasn't documented, either.

This is a prerequisite for moving QFuture to QtCore.

Change-Id: I8e986e6e2a22fbe5cf08d0600ec39ae9ae993e20
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-28 23:50:10 +02:00
Thiago Macieira
928fc8d939 Update the NaN tests to deal with non-conformance better
ICC apparently optimises 0 * anything directly to zero, even when it
should be doing a multiplication to conform to IEEE requirements. GCC in
fast-math mode does the same, but that also makes the rest of the
function unreliable, so we try to turn off fast-math mode if we can.

Task-number: QTBUG-22340

Change-Id: I0e3c5f4927b0a6bcb3189bb156c18843fc4b29b9
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-09-28 10:11:00 +02:00
Caroline Chao
47d635b011 Test: Split tst_QVarLengthArray::oldTests
The entire test is currently skipped while only the last part is
causing problems.

Move the out of memory test code to its own test function and skip
only this function with the appropriate bug number. By allocating too
much memory this test is causing a crash.

Task-number: QTBUG-27361
Task-number: QTBUG-22342

Change-Id: Ia308099b7f12cf2c567b62063a7bbcc6fb38515b
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-09-27 21:13:52 +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
Janne Anttila
bf05abddfd Fix qstringlist autotest build for WinCE.
WinCE does not have setlocale, used SetUserDefaultLCID correspondingly
as it is done in qstring autotest for WEC7.

Change-Id: I7866bf0f365c7c6efbf3b439cdd9a281c6a1b2e0
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-09-26 04:03:48 +02:00
Mitch Curtis
6b6fefad48 Remove duplicate words and punctuation from documentation.
Change-Id: I5550c62d412510bc2c5acceb2cae7d2f2ef6a8d3
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-09-26 04:03:20 +02:00
Konstantin Ritt
a798b956b9 QCharAttributes: add wordStart/wordEnd flags
A simple heuristic is used to detect the word beginning and ending by
looking at the word break property value of surrounding characters.
This behaves better than the white-spaces based implementation used before
and makes it possible to tailor the default algorithm for complex scripts.

BIG FAT WARNING: The QCharAttributes buffer now has to have a length
                 of string length + 1 for the flags at end of text.

Task-Id: QTBUG-6498

Change-Id: I5589b191ffde6a50d2af0c14a00430d3852c67b4
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2012-09-26 03:09:57 +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
Thiago Macieira
3827fd2a37 Add some tests for compatible and incompatible custom deleters
Change-Id: I2bb7f597aab0f00a250881602e6a6bb7bfe42e18
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-09-24 21:27:51 +02:00
Jędrzej Nowacki
c06106f28d Fix potential breakage in QString.
Negation operator ("!") have precedence over bitwise and ("&").

Change-Id: I39e2d99da6eaa4477bbe35a1259f745e05c9841a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-24 16:53:13 +02:00
Marc Mutz
c00bd8d677 Use QStringList::join(QChar) overload where applicable [QtCore]
This is an automated change performing the following replacements:
                    join\("(.)"\) -> join('\1')
  join\(QLatin1String\("(.)"\)\)  -> join(QLatin1Char('\1'))
  join\(QStringLiteral\("(.)"\)\) -> join(QLatin1Char('\1'))

Change-Id: I81c378ef6aeeada5e116f1394cc9fc67f901ffd6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2012-09-23 23:30:18 +02:00
Marc Mutz
15953e9503 QModelIndex: clean up integer size confusion in the API
QAIM::createIndex() took either int or quint32, but QMI::internalId()
returned qint64.

In the new interface, createIndex() takes, and internalId() provides,
integers of type quintptr.

This matches the storage size of the void* in the model index and
avoids truncation.

Remove the
  createIndex(int, int, quint32) and
  \obsolete createIndex(int,int,int)
overloads.

This makes a literal 0 in the third parameter ambiguous now.
The solutions have been noted in changes-5.0.0.

Change-Id: I0a0ecd8430eaf695129a4d09d14d4e30745485c4
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-09-22 20:45:12 +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
Caroline Chao
e3d334e7c3 Test: Update QSKIP message of tst_QVector::outOfMemory
This test is crashing. Specify the bug report number in the QSKIP
message.

Task-number: QTBUG-22343
Task-number: QTBUG-27285

Change-Id: I4d4ead4f54944a545103a3d01c5c9d302d7fb1df
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-22 00:47:40 +02:00
Caroline Chao
e7dccd9e03 Test: fix warning for tst_QPluginLoader::loadGarbage
Garbage libs (under elftest) are numbered from 1 to 5 and not from 0 to 4.

Change-Id: Ia0162372bf5cd1fb53a0442543c5a65716880611
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-22 00:47:40 +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
Kai Koehne
1dd4790aee Autotests: Use qInstallMessageHandler
qInstallMsgHandler got deprecated in Qt 5.

Change-Id: Ib36983e66b3a8090b99f14e3fd4e210602a3f018
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-14 15:23: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
Thiago Macieira
81b00670f2 Use QElapsedTimer instead of QTime to measure elapsed time
QElaspedTimer is a lot more efficient.

Change-Id: I66d9514108f800a45181d8960b01a5e7d3fa9e80
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-09-13 22:40:34 +02:00
Thiago Macieira
53a7778b90 Increase the fuzziness of the QSemaphore test to 50 ms
The test tries to acquire a semaphore that isn't ready, so it will
timeout. The test is working properly.

The only problem is that 10 ms is too strict. For a wide variety of
reasons, especially since the Qt CI system runs multiple tests in
parallel, the program may not run again in that 10 ms window.

Change-Id: Ic0f684895f73646db5f1cc783fe9ef75fb1ab02b
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-09-13 22:40:27 +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
Stephen Kelly
d7a15fbfd9 Fix crash when invalidating a QSortFilterProxyModel
Task-number: QTBUG-27122

Change-Id: Ibca46b88442f4f92422d9b3182e4bbf25716a07f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-09-13 16:20:11 +02:00
João Abecasis
975ebdc4ab Don't manipulate immutable data
QArrayData can point to data it does not own (cf. fromRawData()), which
shouldn't be modified. Not even upon destruction, as this data can live
in Read-Only memory or be otherwise shared outside the QArrayData realm.

Change-Id: I8bdf3050a17802fb003b77d5f543fe31769a7710
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andreas Hartmetz <ahartmetz@gmail.com>
2012-09-11 23:54:57 +02:00
Sergio Ahumada
6c3ee80589 test: Remove QSKIP from tst_QLocale::windowsDefaultLocale()
This test actually passes on Windows, so removing the QSKIP

Task-number: QTBUG-24543
Change-Id: Ic2666665f2882392aec92a665f51d6c5dd3355f8
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-09-10 19:20:52 +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
Marc Mutz
68e04c3ac1 QStringList::join: add an overload taking a single QChar
This overload avoids the needless heap allocation that the traditional
overload incurs due to the implicit QChar -> QString conversion
involved there.

In order to share the implementation between the two overloads,
QStringList_join now takes the separator as a (Char*,int) tuple
instead of as a QString.

Change-Id: I92961f13a3f19099de2a6e2df9f4789a12fc83a0
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-03 13:41:55 +02:00
Stephen Kelly
dcf4d152b5 Change SChar to metatype id 40.
This fills the gap left by QWidgetStar, making the sequence
between FirstCoreType and LastCoreType contiguous, which some
benchmarks assume to be true anyway.

Change-Id: I2d5d202b6246a9065fdf77f325a4a04279dbe4b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-03 11:05:49 +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
João Abecasis
ed4939eaac Improve performance of QArrayData::Grow autotest
Doing element-wise insertions for the full range of the test made
testing under valgrind extremely slow. When a reallocation is detected
we now resize() the container close to capacity(), while verifying this
doesn't unnecessarily re-allocate either.

Change-Id: Idf7015cf390e366fe444e7ca14c904a2d54ff48b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-30 13:51:22 +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
Marc Mutz
6276427438 QString::append: add (const QChar*, int len) overload
Both insert and replace have this overload, so one reason to add it
to append(), too, is consistency. But I can also make good use of
this overload in the the new QStringList::join(QChar) overload, so
it's actually useful in its own right.

Change-Id: Iccd48f9cb84831399e4db7e3e78eba25c0ced30d
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-30 02:28:30 +02:00
Sergio Ahumada
b6a4e66ffb test: Mark tst_qtextboundaryfinder::generateDataFromFile() with internal build
This function only makes sense on a developer build. In non
developer-builds you get:

  tst_qtextboundaryfinder.cpp:116:13:
    warning: ‘void generateDataFromFile(const QString&)’
    defined but not used [-Wunused-function]

Change-Id: Id1bda2d27b00048f7401606959b566a59c05b38d
Reviewed-by: Toby Tomkins <tjtomkins@gmail.com>
2012-08-29 14:12:03 +02:00
Giuseppe D'Angelo
20993adffd QSharedPointer: make QT_SHAREDPOINTER_TRACK_POINTERS work with QObjects
If setQObjectShared crashes because a QObject is tracked by two
different QSharedPointers, we lose the debug feature offered by #defining
QT_SHAREDPOINTER_TRACK_POINTERS, as the check done by this define
happens after the setQObjectShared call.

Therefore, move setQObjectShared after the internalSafetyCheckAdd call.

This is actually a noop change in 5.0, as setQObjectShared does nothing.
However it prevents a bug in case the Qt 4 behaviour is brought back
in some later version.

Change-Id: I71340d0f878828354537762d01c46d441efc918c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-28 21:18:17 +02:00
Mitch Curtis
f29896840c Handle invalid dates properly for QDataStream versions < 5.
In Qt 5, when streaming an invalid QDate using a QDataStream version
earlier than Qt_5_0, QDate.jd is written and read as 0, which is an
invalid julian day for Qt versions earlier than 5.0. For Qt 5.0
however, 0 is a valid julian day, so when comparing a deserialised
invalid date (read using a QDataStream version < Qt_5_0) against a
default-constructed invalid date, they won't compare equal when they
should.

Task-number: QTBUG-26989

Change-Id: Ia76df493471f3b068c7d7187be20e3178eff2cc7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-28 18:23:06 +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
Thiago Macieira
8e0bac89d4 tst_QMutex: add markers to the tryLock tests
Just to make it clear which two sections go together.

Change-Id: If3724d1c84172a61bdd7931cc567f4b7140d4f8a
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-08-23 11:20:37 +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
Kai Koehne
e177a35dfe ICU: Fix crash in codecForMib(2107)
availableMibs() unconditionally adds 2107 to the list of mibs. The patch
ensures that codecForMib() also knows about this special TSCII codec.

(Note that the autotest only really checks this code path if only this
test case is run. The other tests already fill the internal codec cache
otherwise).

Change-Id: Id987d7cecd5f5700cca75e9b85b37011f8e5c622
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-08-23 11:20:37 +02:00
Shawn Rutledge
41ca2b4453 A few more random documentation fixes
@p replaced by \a, \QD replaced by {Qt Designer}, couple of enums etc.

Change-Id: I315510690bf52e42db519292b4122fa24c73bbc9
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
2012-08-23 02:55:17 +02:00
Mitch Curtis
09dd19df5c Do not consider sign in qIsNull.
The current implementation of qIsNull only returns true if the value is
positive zero. This behaviour is not useful for use cases like
QPointF::isNull, where QPointF(-0, -0).isNull() will return false.
There doesn't seem to be a reason why the function exhibits this
behaviour (-0.0 is not accounted for in the unit tests), and for the
case of QSizeF::scale it causes a bug: qIsNull is used to check for
division by 0.0 before it proceeds, which fails in the case of -0.0.

Task-number: QTBUG-7303
Change-Id: I767e5280bd26614e8e78ae62b274eb9bc4ade385
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-08-22 04:04:57 +02:00
Mitch Curtis
3a7b6a74a8 Disregard milliseconds in QTime::secsTo().
"The documentation states that "secsTo() does not take into account any
milliseconds", however, this is not the case. Given times 12:30:01.500
and 12:30:02.400 secsTo returns 0. If milliseconds are not taken into
account, I would expect this to return 1 (i.e. interprets the times as
12:30:01 and 12:30:02 thus truncating the milliseconds)."

Note that tests were also written for QDateTime::secsTo(), as it uses
QTime::secsTo internally. This addresses Javier's issue in the
comments of QTBUG-9304.

Task-number: QTBUG-9304
Change-Id: I9efe0c8f710db859c1d086d67ba3e5b349a56c4e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-21 11:05:20 +02:00
Mitch Curtis
718a2251be Serialise QDateTime as UTC and timeSpec() instead of private spec.
QDateTime currently serialises its private Spec enum. If a user was to
deserialise the individual components of a QDateTime separately, the
resulting timeSpec may be invalid when cast to the Qt::TimeSpec enum.

E.g.:

QDateTime dateTime(QDate(2012, 8, 14), QTime(8, 0, 0), Qt::UTC);
// ... serialise
// ... deserialise date, time, spec separately.
// spec == 2, the value of QDateTimePrivate::UTC.
// spec != UTC, will be set to LocalUnknown.
QDateTime deserialised(date, time, spec);

This patch serialises QDateTime objects in UTC and the value of
timeSpec() as opposed to QDateTimePrivate's spec. This changes the
serialisation behaviour of QDateTime for version 13 of QDataStream.

Task-number: QTBUG-4057
Change-Id: If650e7960dca7b6ab44b8233410a6369c41df73a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-21 11:05:20 +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
Thiago Macieira
c9bfd34fa0 Enable QAtomicInteger for char16_t and char32_t
Those are regular, integer types, of 16- and 32-bit width,
respectively. C++11's std::atomic supports them, so we should too.

C++11 also supports wchar_t, but since that type's size can change, I
don't feel like support for it in Qt is pressing.

Change-Id: I945b641c91a8a98be82715f878c382dee58ac98b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-18 18:35:50 +02:00
Thiago Macieira
2b00f97ab0 Add Q_DECL_CONSTEXPR to the isXXX functions in the new atomics.
This allows one to write code that depends on these values at
compile-time.

Change-Id: I7d78524ed9c70d4141360496d1d764dcbfa92e62
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-18 18:35:36 +02:00
Stephen Kelly
4d9d88af6f Remove QWidgetStar.
This allows us to remove the odd hacks to get the static metaobject
for the QWidget* metatype.

The QWidget* is still an automatic metatype thanks to the QObject
partial template specialization. It is registered as a metatype
at runtime automatically in qwidgetsvariant.cpp.

Change-Id: Ie01b69eadf2cbe87af1a86c3284550f60dcf9e94
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-18 10:55:47 +02:00
Stephen Kelly
2ef3ac72fc Emit layoutChange signals when changing QPersistentModelIndexes.
This is necessary whenever QPersistentModelIndexes are changed. Omitting
it means that views are not able to react to the change, such as QTreeView
clearing its (manually held) QModelIndex cache, and the QItemSelectionModel
clearing the item from its storage.

It is necessary to change a QSortFilterProxyModel test which assumed setItem
does not have any such effect. That test is ported to setData instead.

Task-number: QTBUG-18539
Change-Id: Id7a602f18b9773ba4d11019418de886860d26d3e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-08-18 08:34:53 +02:00
Rafael Roquetto
555e4e05f4 Fix tst_qbytearray on QNX
qUncompressCorruptedData() no longer hangs on QNX 650 and Blackberry OS
sytems.

Change-Id: Id131f9f1c6dcd358c152675c7e29ab937052c1d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-15 15:19:55 +02:00
Stephen Kelly
da64a50792 Only emit headerDataChanged for valid proxy intervals.
Modeltest asserts before the patch, and passes afterward.

Task-number: QTBUG-26515

Change-Id: I08a89cd5c9c59613badcddbd056a3d0b8fbbca13
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-08-15 15:04:11 +02:00
Stephen Kelly
c1df856d6b Make rowIntersectsSelection take account of the parent argument.
Task-number: QTBUG-22370

Change-Id: I497194793eab624b760deea93dac0df767850330
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-10 22:02:11 +02:00
Marc Mutz
fa08b143f3 QtGlobal: (new) qEnvironmentVariableIs{Set,Empty}()
These functions are a faster version of {,!}qgetenv().is{Null,Empty}(),
a common pattern in Qt code.

Their main advantage is that they don't need to allocate memory, so
they can be used in noexcept functions, or dynamic initialisation of
namespace-scope statics, because throwing in these contexts invokes
std::terminate().

Change-Id: I651c5bd72f450b5d7df76590f8791572fe992af5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-09 21:27:09 +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
Kent Hansen
8efcfda41f statemachine: Really fix signal transition handling in multi-threaded setup
Commit f9a17d7f0f fixed it for the case
where the sender object is in a different thread at transition setup
time. However, it still didn't work if either the sender object or the
state machine was moved to a different thread at some later time,
before the machine was started.

Therefore: Bite the sour grape and traverse all the machine's
transitions when the machine is being started, registering those
signal transitions whose sender objects are in other threads.

This will increase the machine's startup time (proportional to the
number of transitions), but at least it works in all known scenarios,
meaning we don't have to document weird restrictions regarding the
order in which the user's operations have to be done.

Task-number: QTBUG-19789
Change-Id: I5f1dd1321994e49635f52be65cf56d2678ed1253
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-08-08 14:13:53 +02:00
Thiago Macieira
6820f1716e Remove more -Werror from any test other than headersclean.
As was done in dc56fb18a7, but which
didn't catch all cases.

Change-Id: I9417a8d13339dd8fc95030dd5bad70f2c6f69756
Reviewed-by: hjk <qthjk@ovi.com>
2012-08-07 23:27:17 +02:00
Stephen Kelly
b84e180263 Avoid crashes when invalidating a proxy model filter.
Task-number: QTBUG-26107
Change-Id: I2df7ae6402136570c8469d3251edae6ca8290f1f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-07 11:15:55 +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
Kent Hansen
3a2bc9530e statemachine: Make states exit order spec-compliant
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>
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
Thiago Macieira
4d1f0ccbf3 Fix handling of encoded NULs (%00) in QUrl::fromPercentEncoding
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>
2012-08-01 13:04:12 +02:00
Lars Knoll
47c48ea87a Fix reloading of plugins
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>
2012-08-01 00:14:41 +02:00
Lars Knoll
88d2e92b39 ICU code page conversion support
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>
2012-07-31 11:12:28 +02:00
Thiago Macieira
920dcb0158 Ensure that QAtomicPointer of forward-declared classes works
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>
2012-07-30 10:43:50 +02:00
Rohan McGovern
8b6f8d66ec tests: removed QtWidgets dependency from tst_qsignalmapper
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>
2012-07-30 06:06:05 +02:00
David Faure
8cf7cf0cb9 QDebug: Add getter/setter for auto-insert-spaces.
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>
2012-07-27 22:05:26 +02:00
Volker Krause
ef403ba46a Fix crash in QVariant::canConvert().
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>
2012-07-27 12:23:43 +02:00
Stephen Kelly
9784dd8d06 Implement implicit constructors for built-in classes.
Change-Id: I6b0b104bc1da3252d014615c50b81830de42e722
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-27 03:27:23 +02:00
Friedemann Kleint
db83f2d73d Base 'FileSystem' test helper class on QTemporaryDir.
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>
2012-07-26 15:12:50 +02:00
Marc Mutz
e083d25395 QMetaTypeId2::IsBuiltIn: (new) template meta-function to check for built-in 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>
2012-07-26 15:01:04 +02:00
Marc Mutz
ff453fa757 tst_qmetatype: fix two more unused typedefs (GCC 4.8 warning)
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>
2012-07-25 17:32:21 +02:00
Marc Mutz
0e8279b7bc QObject: add a macro for conveniently setting the object name
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>
2012-07-25 14:57:08 +02:00
Stephen Kelly
b3694d1295 Split the QGuiVariant test from the Core one.
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>
2012-07-25 00:48:33 +02:00
Stephen Kelly
80cd5d2017 Use a large core type for the QVariant::setValue test.
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>
2012-07-25 00:48:24 +02:00
Stephen Kelly
dec9666dd4 Make qRegisterMetaType constexpr for built-in types.
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>
2012-07-25 00:48:20 +02:00
Stephen Kelly
94c2745074 Remove obsolete or commented use of Q_DECLARE_METATYPE.
Change-Id: I15bc845801b9f84a9252a0092fbd69f0e1b3f4ea
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-24 10:46:24 +02:00
Stephen Kelly
349f16b03c Replace old typedefs with their built-in equivalents.
Change-Id: I3ecb75ace431b92a13de67aa6426cf570398587f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-07-24 10:46:24 +02:00
Stephen Kelly
86992d6adb Fix typo pallete -> palette.
Change-Id: I17b71bfed22c3692b027556ef2e5d6ece4f3f77e
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-07-24 10:46:24 +02:00
Marc Mutz
c76a641a27 QAbstractItemView: don't qRegisterMetaType<QModelIndex>
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>
2012-07-24 10:46:24 +02:00
Laszlo Papp
4eb6482751 Remove the unnecessary qdebug.h includes in the QPoint(F) tests
Change-Id: I5c45af9d498e20b46d6faf8c96de87586eca7b4a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-07-24 06:31:26 +02:00
Stephen Kelly
cb43dec31e Split QWidgetsVariant tests into a separate testcase.
This allows building the QVariant tests without the QtWidgets module.

Change-Id: I7cd7e78a60c7bc7614ec16df1abe1e93e45d4923
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-23 17:47:51 +02:00
Friedemann Kleint
fe4adec894 Windows: Do not return short path names for QDir::tempPath().
WinAPI GetTempPath() sometimes returns short names
for C:/Users/<user>/AppData/Local/Temp.

Change-Id: I33f991acc06e652ccd484d36a5a384eb776f8395
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-07-17 15:56:15 +02:00
Kent Hansen
cd1351401f statemachine: Move RestorePolicy enum to QState class
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>
2012-07-16 10:08:28 +02:00
Kent Hansen
0b66f723f0 Add QStateMachine constructor that takes a ChildMode
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 d281aa6936,
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>
2012-07-16 10:06:54 +02:00
Oswald Buddenhagen
4499a911c4 fix object file name clash
under extremely rare circumstances this would have actually failed

Change-Id: I4132d0f82e9f924e92e9e96f6d34451c94a67201
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-07-16 01:06:32 +02:00
Stephen Kelly
adfb66d02a Test QVariant copy with a user type instead of a QtNetwork type.
Change-Id: I78acc8a843eb12a2606f491d1a29e1bcd408d60f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-15 01:23:25 +02:00
Stephen Kelly
79dddcf089 Run QIcon related crash test with the other QtGui types.
Change-Id: I475cfc5a91a046951feecb425f8235ad37f1ba44
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-14 13:25:11 +02:00
Stephen Kelly
55d90b3240 Don't declare built-in metatypes as metatypes again.
Change-Id: Iba9804299e8f6e2db10965fdc719ee26f197758e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-14 13:25:03 +02:00
Kent Hansen
95b6826ed4 statemachine: Make signal transition registration thread-safe
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>
2012-07-13 12:09:42 +02:00
Kent Hansen
f9a17d7f0f statemachine: Fix signal transition handling in multi-threaded setup
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>
2012-07-13 12:09:42 +02:00
Kent Hansen
22c7a1fd9b statemachine: Fix dynamic transition registration edge cases
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>
2012-07-13 12:09:42 +02:00
Kent Hansen
0d56dac3bc statemachine: Set correct signal index when signal is non-normalized
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>
2012-07-13 12:09:42 +02:00
Stephen Kelly
f108fceb2c Make it possible to connect to QAbstract{State,Transtion} private signals.
Use the same trick as used for private signals in the models.

Change-Id: I4235788490cae0e3d554565621d145652dc5b0ca
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-13 01:51:47 +02:00
Stephen Kelly
536ec793b6 Make it possible to use new syntax to connect to model signals.
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>
2012-07-13 01:51:44 +02:00
Jędrzej Nowacki
197f34bcff Test for QMetaType binary breakage.
Type traits can not be changed durring Qt5 life time.

Change-Id: If69f65ff2113c901580afee91b11ae1b11c13a4f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-13 01:51:38 +02:00
Marc Mutz
ea6946318f tst_QMimeDatabase: use QFutureSynchronizer
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>
2012-07-13 01:51:33 +02:00
Kent Hansen
c4cef6fae9 statemachine: Fix state entry bug for parallel state groups
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>
2012-07-12 20:38:02 +02:00
Thiago Macieira
d693a8914c Fix small problems with tst_QProcess
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>
2012-07-12 18:34:56 +02:00
Jan-Arve Saether
f235ca4079 Enable modularization of translation files.
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>
2012-07-12 18:30:35 +02:00
Mitch Curtis
282d81e4e5 Write qHash functions for QDate, QTime and QDateTime.
These functions didn't exist - this patch implements them.

Task-number: QTBUG-23079
Change-Id: I9eb6e238531d5cda878f5f2cdd27bab30aa60669
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-07-12 01:46:38 +02:00
Mitch Curtis
623bfe2093 Add unary operator+ to QPoint and QPointF.
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>
2012-07-12 01:46:20 +02:00
Sergio Ahumada
59339941e0 Fix some spelling errors
Change-Id: I19d3b2e9a5180b13deb828b55195404ef20be295
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2012-07-11 14:52:37 +02:00
Mitch Curtis
376135c403 Improve QPoint and QPointF auto tests.
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>
2012-07-11 14:52:17 +02:00
Kent Hansen
d281aa6936 statemachine: Support parallel root state
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>
2012-07-11 08:42:45 +02:00
Kent Hansen
28e9a602cb statemachine: Emit finished() signal when the initial state is final
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>
2012-07-11 08:42:40 +02:00
Kent Hansen
035c933eaa statemachine: Revamp property assignments implementation
In the old implementation, property assignments
(QState::assignProperty()) were "second-class citizens".
Assignments were not really integrated into the state machine
algorithm, but rather done as a separate step
(QStateMachinePrivate::applyProperties()). While that was
convenient for SCXML spec transcription purposes, it resulted
in some pretty poor semantics on the user side:

* Properties were not assigned until _after_ both the
QAbstractState::onEntry() function had been called and the
QState::entered() signal had been emitted.

* Automatic property restoration (QStateMachine::RestoreProperties)
did not play nice with nested states (and parallel states, in
particular).

The proper fix is to refactor the implementation to make
property assignments first-class in the core state machine
algorithm (QStateMachinePrivate::microstep()).

In practice, this meant splitting some steps. Instead of calling
exitStates() straight away, we now first only compute the states
to exit (without actually exiting them), and use the resulting set
to compute which properties are candidates for restoration.
Similarly, instead of calling enterStates(), we first only compute
the states to enter (without actually entering them), and use the
resulting set to compute which properties are assigned by the
entered states.

With that in place, the rest was a matter of moving the various
chunks of the old applyProperties() logic to the place where they
belong in the per-state entry/exit.

All existing autotests pass. Added several tests that verify the
desired semantics in more detail.

Task-number: QTBUG-20362
Change-Id: I7d8c7253b66cae87bb0d09aa504303218e230c65
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-07-11 05:17:10 +02:00
Sergio Ahumada
c15e80f6ac test: subtract qurlinternal.pro when private_tests are not enabled
This test used requires(contains(QT_CONFIG,private_tests)) in its
.pro file, but did not subtract itself from its parent project
SUBDIRS when private_tests weren't enabled.

Change-Id: Idcd0893c4804a8217e4dd33ba9838ff67e996f58
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-07-10 14:16:13 +02:00
Kent Hansen
d219ea1ebc statemachine: Don't assign properties for transitions with no targets
If the transition has no target states, that means the current state
won't change; hence, property assignments should not be performed.
In particular, properties should not be restored to the values they
had before the state was entered.

Change-Id: I237bbb541f939c272777e70c5f26c886ec457a17
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-07-10 06:21:01 +02:00
Kent Hansen
2f18e72762 statemachine: Purge restorable properties when they are restored
Previously, a registered restorable property would only be
unregistered if the property was animated (see
QStateMachinePrivate::_q_animationFinished()).
But if a property is set directly, it should also be unregistered;
otherwise, the state machine would use the previously saved (stale)
value the next time that property should be restored.

Change-Id: I5d246aa5355ddd0ba5f81b0186a9f0e4f3bbaa3f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-07-10 06:20:31 +02:00
Kent Hansen
bc5a4d28af Set compound state's initial state to 0 if it is removed/deleted
Change-Id: I45b7c15a9b3d5a1860cb9a7da8836f9eaaa0326d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-07-10 06:20:23 +02:00
Kent Hansen
ba87568655 statemachine: Don't crash if property assignment target is deleted
Do like QPropertyAnimation and store the QObject in a QPointer.
Purge the assignments list upon state entry and property restore.

Change-Id: I54a56885a2905178ab6aa5cf292b3d25c86b7a97
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-07-10 06:20:07 +02:00
Marc Mutz
7e0562c5ff fix compilation with conforming compilers (e.g. GCC >= 4.7)
In qdbus_cast(), qMetaTypeId<QDBusArgument> as well as
qvariant_cast<QDBusArgument> are used. They don't depend
on any template argument of qdbus_cast(), so their
definitions need to be available at function template
definition instead of instantiation time.

But the necessary Q_DECLARE_METATYPE(QDBusArgument)
was at the end of the header, after the defintion of
qdbus_cast(), which is too late for conformin compilers.

Fixed by moving it up just after the QDBusArgument
definition.

Similarly, in tst_qdatetime and tst_qvector, the
Q_DECLARE_METATYPE() for Qt::DateFormat and QVector<int>,
and with it the specialisation of QMetaTypeId<>, were
issued after the first use of meta typing; too late for
conforming compilers.

Change-Id: I25ca0b06e68d5184597a22708404a8f2040b2de1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-07-10 03:24:15 +02:00
David Faure
2c55847e9e QMimeType: document preferredSuffix()/suffixes() better
Change-Id: Icf4aab3516cd622d9932e32cb0bd819bef22ce9b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com>
2012-07-08 10:37:24 +02:00
David Faure
b069158ed3 Fix QMimeType::operator== to only compare mimetype names.
The name is the unique identifier. Code such as
if (oldItem.mimeType() == newItem.mimeType())
really wants to detect whether the item has a new mimetype (name),
not compare static mimetype data such as comments and icons.

Change-Id: I5fe56443295c91e1024c066ad6e7f93d842ae507
Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com>
2012-07-08 10:36:51 +02:00
Mitch Curtis
b6e26b5b19 Improve QDate, QTime, QDateTime auto tests.
Add more test data, merging operator!= tests in with operator==
to take advantage of added data.

Change-Id: If0426a3d01b8800cb7363385dbf3bcb21af5ed8f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-07-06 13:10:24 +02:00
Stephen Kelly
648d5964ee Add a Q_PROPERTY for the sourceModel of a proxy model.
Now that Q_PROPERTY with a QObject derived type is more powerful.

This property can be used in QML so that wrappers for proxy models
do not need to be created, such as in the example
at https://codereview.qt-project.org/#change,13007

Change-Id: I6ba676549d2135585d429a28e214fef0b2a6b1f9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-04 15:51:50 +02:00
Rohan McGovern
bcf20e122a Avoid load(testcase) for installing test helper apps
Make test projects declare TEST_HELPER_INSTALLS rather than calling a
function exported by testcase.prf.  load(testcase) may be unsafe, as
testcase.prf should be processed after default_post.prf.

Fixes silent disabling of various autotests.

Change-Id: I56b35ffd653a637ad5ab18d64dd1a1edadfac59f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Kurt Korbatits  <kurt.korbatits@nokia.com>
2012-07-04 02:46:27 +02:00
Konstantin Ritt
ee4f50b2e7 Add QChar::SoftHyphen enum value
Just like for the QChar::ByteOrderMark, `ch == QChar::SoftHyphen`
is much more readable than `ch == 0x00ad // (soft-hyphen)`, etc.

Change-Id: I9c85f14cfd979037d35103c3259a435fd729b869
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-07-03 14:39:02 +02:00
João Abecasis
deb8d178fe Add erase operation to QArrayDataOps
Change-Id: I37d3ac465f5beddb5038e22e9cda32acb16c78fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-07-03 01:55:39 +02:00
Stephen Kelly
13e1e30ec3 Add constexpr template specializations for built in metatypes.
This will make it possible (in Qt 6) to remove the enums listing
metatype ids. As it is constexpr, it can be used in switch statements
just like enums, as enum values, and as template specialization values.

Change-Id: I51293674c403714e34cb8a8b8953522fc97a740a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-03 01:08:05 +02:00
Stephen Kelly
edfc0f89a9 Implement QVariant conversions for QObject derived pointer metatypes.
canConvert() and convert() use the metaobject to convert such types.

Change-Id: Ic05e74c5c2423b4b9682b88adc856a16dcba4cff
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-07-01 18:25:01 +02:00
Stephen Kelly
14c7bb72b9 Store the QMetaObject with the QMetaType.
This will allow conversion between pointers to compatible QObject
derived types.

Change-Id: I19e08934571fb3f1b91e594892214041fe5f6a11
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-07-01 15:07:10 +02:00
Giuseppe D'Angelo
985292b0a3 QAbstractProxyModel autotest doesn't need widgets
After the QStandardItemModel move to QtGui.

Change-Id: I2be82d89518ff97cf164026ee8b13a41f9c93d4a
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-06-29 22:42:23 +02:00
Giuseppe D'Angelo
dba22bc036 Move QStandardItem/QStandardItemModel to QtGui
The dependencies on QFont, QBrush, QIcon are all in QtGui, so there's
little sense to still have these classes in QtWidgets.

This also copies and pastes a version of QWidgetItemData as
QStandardItemData inside qstandarditemmodel_p.h.

Change-Id: Ibafc5a30748e7ce0b54753309ae6dc4a797fc20e
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-06-29 22:42:19 +02:00
Kurt Korbatits
551e1e63d9 Fixed several unit tests to work in shadow builds
- qlogging, qthreadstorage, qnetworkreply, qapplication, qfile, qprocess
  Added app_bundle and debug_and_release_target to CONFIG

Change-Id: I6212902c449520dc016da9590149a423069cc38c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-06-29 04:57:04 +02:00
Kent Hansen
d359b0af2b Call QObject::disconnectNotify() when receiver is destroyed
Store the signal index in QObjectPrivate::Connection, thereby making
it available in "implicit" disconnect contexts (i.e., receiver
deletion).

This change does not cause the size of QObjectPrivate::Connection
to grow (still 40 bytes on 32-bit Linux, 72 bytes on 64-bit Mac).

Valgrinding the new benchmark indicates that the percentage of the
time spent in the QObject destructor increased from 7.8% to 8.4%
on ia32, for that particular stress test; the increase is the
combined cost of calling metaObject(), QMetaObjectPrivate::signal(),
and disconnectNotify() for one connection. In practice, the measured
wallclock time increased by about 3ms for a 500ms run (which
repeatedly constructs, connects, and destroys an object).

Task-number: QTBUG-4844

Change-Id: I1beb01c753f31542fc0acb62edb4c6d165fcc5b4
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-06-28 14:44:20 +02:00
Thiago Macieira
dc56fb18a7 Remove the extra warnings and -Werror from tst_qmimetype
Those belong in headersclean and nowhere else.

Change-Id: Ib7078ef3071266e4c03e3580068f978a9418cbf1
Reviewed-by: David Faure <faure@kde.org>
2012-06-27 12:39:53 +02:00
Mitch Curtis
98803a76b3 Fix QIODevice warning when running rcc.
When opening a QFile on stdout, for example,
we must not call seek as it is a sequential device.
This has been flagged as a warning since commit Ie3a96d3a
and has resulted in spurious warnings being emitted.

In the case of opening a QFile in Append mode, QIODevice::open
already sets the position marker, so calling seek is redundant.
This is also true for the file engine's open function (called
through openExternalFile()), which also ensures the handle or
descriptor is repositioned appropriately.

Task-number: QTBUG-26104
Change-Id: I71040c399efe54e7538f54433368b432e959e08d
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-06-26 19:30:00 +02:00
David Faure
61162c6e87 Add missing subdirs (the new QUrl unit tests were not compiled and run)
Change-Id: I1b39d92b8a14d5aeca957180858e1980a534894b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2012-06-26 14:53:46 +02:00
Tarja Sundqvist
0a6dc44f24 QTBUG-26035: Remove positive sign from start of string
Updated removeGroupSeparators(QLocalePrivate::CharBuff *num) so that it
removes also positive sign ('+') at the start of the string. Auto test
included.

Task-number: QTBUG-26035

Change-Id: I8e0e071d6c682d9192a8c6bb2f282510e21b3c48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
2012-06-26 08:14:17 +02:00
João Abecasis
796f85b611 Don't operate on bogus data, assert on preconditions instead
QVector::erase shouldn't try to make sense of iterators it doesn't own,
so the validation being done here is bogus and dangerous. Instead, it's
preferrable to assert, the user needs to ensure proper ownership.

The case of erasing an empty sequence is not checked for preconditions
to allow

    QVector v;
    v.erase(v.begin(), v.end());

, while being stricter on other uses.

Autotests were using ill-formed calls to the single argument erase()
function on an empty vector and were fixed. This function erases exactly
one element, the one pointed to by abegin and require the element exist
and be valid.

Change-Id: I5f1a6d0d8da072eae0c73a3012620c4ce1065cf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-23 14:16:33 +02:00
David Faure
86ae3809a9 Skip 3 test methods if the test server isn't set up.
This makes things easier for developers touching QtCore and running
all QtCore unit tests.

Change-Id: I7aa832a6a1be07d90cacad2eecb2364285ff3818
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-06-23 14:16:29 +02:00
Janne Anttila
db7bdcd976 Fix qdiriterator autotest build for WEC7.
Change-Id: I18b1bdd79905761eff7a5ddbe1c6538c33624a1f
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
2012-06-21 00:58:26 +02:00
Janne Anttila
d527f2b933 Fix qfile autotest build for WEC7
Change-Id: I6c4b4c91ea841ccb91ad685510caaecaf51baced
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-06-21 00:58:16 +02:00
Stephen Kelly
579ea489a4 Record if a metatype is a smart pointer to a QObject derived.
This allows QVariant/QMetaType software (such as QtDeclarative) to
deal with smart pointers in a similar way to how they can deal with
naked pointers (accessing properties etc).

This also adds a requirement that T be fully defined when
QSharedPointer<T> is inserted into a QVariant.

Change-Id: I29e12b8a6aa5f4aadbd62f92b89bc238f64b5725
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-20 15:45:07 +02:00
Stephen Kelly
668efc29fd Add some internal API for extracting a QSharedPointer<T> from QVariant.
The T must be derived from QObject, or it will fail to compile.

This will allow scripting or other 'wrapping' and runtime environments like
QtDeclarative to handle QSharedPointers to types derived from QObject
properly. A QSharedPointer<T> can be inserted into a QVariant, and
where T derives from QObject, a QSharedPointer<QObject> can be
extracted from the QVariant, and its properties are then accessible.

Change-Id: I68d6d89aceceb019267bd7301baa2047f9c09b90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-20 15:45:07 +02:00
Oswald Buddenhagen
6d9c545d2b Merge "Merge branch 'buildsystem'" into refs/staging/master 2012-06-20 12:38:32 +02:00
Mitch Curtis
86f953a6d4 Make QDateTime::fromString()/Time::fromString() adhere to ISO 8601.
Currently QDateTime::fromString and QTime::fromString do not correctly
handle fractional minutes and, in some cases, fractional seconds.

In the case of reading fractional minutes, it has been decided to
ignore invalid characters outside of the 5 character portion that
we're interested in (see code comments in fromStringImpl() for
info on why we read 5 digits). The motive is that there is a
performance penalty for calling mid to get the portion of surplus
string and also for converting to it to a float. This is also in
line with what QDate does with surplus characters, for example.

Task-number: QTBUG-14418
Task-number: QTBUG-25387
Change-Id: Ib742fe80686aff3c3770b995678cf838fb4e3bb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-20 12:38:32 +02:00
Mitch Curtis
223ed436b5 Clean up QDateTime tests.
Clean up and consolidate different tests in tst_qdatetime.cpp
(that seem to be doing the same thing) into single tests.

Change-Id: Ib6ceb1cb7fb4c6eca672495f96d9cfd907853c85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-20 12:38:32 +02:00