Commit Graph

2384 Commits

Author SHA1 Message Date
Kent Hansen
872b412bcc Make qprocess autotest build without widgets
Change-Id: I0a428852222accbea8446ba1c284f1c44b9d4bf3
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:39:01 +02:00
Kent Hansen
6f297d9dd4 Remove widgets dependency from qstringlistmodel autotest
Change-Id: I9678f9ee3fd8b01648cf2524452145568cf6fb4f
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:38:58 +02:00
Kent Hansen
bb10660bea Make itemmodels autotest build without widgets
Change-Id: I7ff1a575c111452397c3461842c15bb01105cf95
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:38:44 +02:00
Kent Hansen
6f1b118b4d Make qstatemachine autotest build without widgets
Change-Id: I3a58cb1cbe0c86aca6e533187e85c166bf0f8957
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:38:41 +02:00
Kent Hansen
fe6fe39415 Make qpixmap autotest build without widgets
Change-Id: Iabf1e6815a2af79d9da84c0e2bb9c2de52cb698f
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:38:41 +02:00
Kent Hansen
c6d3942ea7 Make qpicture autotest build without widgets
Change-Id: Id2047dace7b3087f1c7b83545f5e122ab936d33c
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:38:38 +02:00
Kent Hansen
17e233e7c3 Make qmovie autotest build without widgets
Change-Id: Ie53b183e99de08c3cc35f4932b7aabf4bf5b0940
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:38:36 +02:00
Kent Hansen
5e19363699 Make gui tests build when widgets aren't available
Change-Id: I5b75116d148f84ae2f96dd6b573d14952c4b601c
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-06-07 00:38:01 +02:00
Kent Hansen
3874022ec0 Make qpainter autotest build without widgets
Change-Id: I4e05871e44f7a69aaa9cd5d876c249c7dd9d86e8
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-06-07 00:37:58 +02:00
Kent Hansen
5951b61374 Make qtextdocumentlayout autotest build without widgets
Change-Id: Ib767f9cac5fc3274ed16e87f0c4da68102147645
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:37:55 +02:00
Kent Hansen
a9eb513019 Make qtextobject autotest build without widgets
Change-Id: I9ea79b62d22faeccc07d8c21a0d8f032b40abef0
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:37:52 +02:00
Mike FABIAN
897e19f95e Check LANGUAGE as well in QSystemLocale::fallbackLocale
Because QSystemLocale::fallbackLocale() is about UI languages,
it makes sense to check LANGUAGE as well if appropriate.
Adapt tst_qlocale.cpp accordingly.

Suggested by Oswald Buddenhagen.

Change-Id: Ib2c9674081809e3251be4e34456b05210eebc010
Reviewed-by: Oswald Buddenhagen
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-06 15:29:34 +02:00
Kent Hansen
302e6968f1 statemachine: Make delayed event posting work from secondary thread
postDelayedEvent() and cancelDelayedEvent() are marked as thread-safe
in the documentation. Unfortunately, they didn't actually work when
called from another thread; they just produced some warnings:

QObject::startTimer: timers cannot be started from another thread
QObject::killTimer: timers cannot be stopped from another thread

As the warnings indicate, the issue was that postDelayedEvent()
(cancelDelayedEvent()) unconditionally called QObject::startTimer()
(stopTimer()), i.e. without considering which thread the function
was called from.

If the function is called from a different thread, the actual
starting/stopping of the associated timer is now done from the
correct thread, by asynchronously calling a private slot on the
state machine.

This also means that the raw timer id can no longer be used as the
id of the delayed event, since a valid event id must be returned
before the timer has started. The state machine now manages those
ids itself (using a QFreeList, just like startTimer() and
killTimer() do), and also keeps a mapping from timer id to event
id once the timer has been started. This is inherently more complex
than before, but at least the API should work as advertised/intended
now.

Task-number: QTBUG-17975
Change-Id: I3a866d01dca23174c8841112af50b87141df0943
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-06-06 13:27:32 +02:00
Bradley T. Hughes
637ecd571f Remove insignificant_test for tst_qwindow on Mac OS X
tst_QWindow::positioning() still fails on Mac OS X, and it does so in
several places. Skip this test for now as it causes isActive() to fail
as well. With positioning() QSKIP()ed, all the other test functions
pass:

Totals: 19 passed, 0 failed, 1 skipped
********* Finished testing of tst_QWindow *********

Task-number: QTBUG-23059
Change-Id: I58d036120c0121f515813cd20955ab3b82f81fe1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-06-06 12:53:55 +02:00
Bradley T. Hughes
e8cd9a617d Cocoa: do not send multiple window activation events
When switching the active window within the same application, Cocoa
sends us an NSWindowDidResignKeyNotification for the old activated
window, then an NSWindowDidBecomeKeyNotificationfor the newly activated
window. Our handling of this would first set Qt's active window to zero,
then immediately reset it afterwards. Avoid this by checking the key
window when handling the deactivation event, and don't set the active
window to zero if a new window has become active.

Task-number: QTBUG-24322
Change-Id: I8719fc501049eeaaebb75e9ea03261b2209458b6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-06-06 12:07:48 +02:00
Samuel Rødal
80653bf4ce Added QScreen::setOrientationUpdateMask().
It might be too expensive to always have an accelerometer sensor
running, so introduce API so that the application has to explictly ask
to get the orientation updates it's interested in.

Change-Id: Ib7dc5ad8807718409f744ebef53f4476aa05175d
Reviewed-by: Ian Monroe <ian.monroe@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com>
2012-06-06 07:41:17 +02:00
Denis Dzyubenko
944221001c Fixed QJsonObject::find()
The function returns mutable iterator on the object that can later be passed to
e.g. erase(), hence it should detach() to be consistent with
QJsonObject::begin() which also detaches.

Change-Id: Id79e8e012fd5469e06b68fbc9eecb7c6848ce9c1
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
2012-06-06 02:03:11 +02:00
Stephen Kelly
7d28f7772c Use QPointer instead of QWeakPointer.
The use of QWeakPointer for tracking QObject pointers is to be
deprecated.

Change-Id: If460ca7f515db77af24030152f4bd56e1a5fae7c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-05 18:42:26 +02:00
Mitch Curtis
24aad8d663 Write test to confirm QStateMachine calls connectNotify().
Task-number: QTBUG-16628
Change-Id: I77535fcb9a6ae306df8ccd670ee1bfc32721d66a
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-05 16:01:29 +02:00
Lars Knoll
143daa6ac2 Correctly locate files with relative paths
QUrl("relativefilename").toLocalFile() changed behavior
and now returns an empty string if the scheme is not set.
Setting the scheme to "file:" in setSource would however
break some other assumptions in the code about relative
url's.

Task-number: QTBUG-22416
Change-Id: I1b3fcbef81f6e356935ec426903989e783ce9a78
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-05 13:40:00 +02:00
Mitch Curtis
05d980664f Make QIODevice::seek() return false for sequential files.
Task-number: QTBUG-18173
Change-Id: Ie3a96d3a6f60995b8ba7823153778869d0c2dc58
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-05 13:12:58 +02:00
Rohan McGovern
4eecbf3b84 tst_qtoolbutton: stabilize and improve failure message
Allow for a little more leeway in timers.

Task-number: QTBUG-26004
Change-Id: I59936d0f675b7f734e04b3f5e63631c74ca4f163
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-06-05 09:21:36 +02:00
Mitch Curtis
f3f648f920 Fix QTemporaryFile::open() failing after remove().
If a QTemporaryFile is constructed using a template file path,
the path is generated in QTemporaryFileEngine::open() and then
filePathIsTemplate is set to false. If remove() and then open()
are called on the same QTemporaryFile, the path is not regenerated.
This change ensures that if the file path was generated, it will be
generated again in the scenario above.

Task-number: QTBUG-2557
Change-Id: I718ceb89daa9a9d46fdbe811fecc3d57d6dc08c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-05 06:15:06 +02:00
Mitch Curtis
872f0b94ac Make QString("inf").toFloat() return inf instead of zero.
Currently, QString::toFloat() returns 0 (and sets ok to false) if you
try to convert "inf". This is because inf is greater than QT_MAX_FLOAT
and there is currently no check to handle inf.

Task-number: QTBUG-8629
Change-Id: I498daf4a7a6f880f928461fca628fcaf7d1d6d08
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2012-06-05 06:14:57 +02:00
Konstantin Ritt
93ead35939 Improve the QTextBoundaryFinder autotests a lot
The existing tests has been retained, the new ones has been added.

Change-Id: I12ae1b4e63dde46f3b14a7c1423c13d5881d4507
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-05 06:14:41 +02:00
Bradley T. Hughes
9b07fd0d5c Add QDeferredDeleteEvent
Use this to store the loop-level counter needed by QCoreApplication
when determining when it is safe to delete an object.

This removes the hack to hijack the QEvent::d pointer (even though
the pointer is unused).

Change-Id: I91c0b1aa00235ec6e13feb30bf928e56d2f80026
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-05 06:14:16 +02:00
Mitch Curtis
d8e457323c Allow 24:00:00 for ISO dates in QDateTime::fromString().
ISO 8601 section 4.2.3 states that "The end of one calendar day [24:00]
coincides with [00:00] at the start of the next calendar day", so
fromString() was updated to account for this.

Task-number: QTBUG-25387
Change-Id: I391db0da755dbc822ba0820c302a2c10391e1f3b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-05 06:12:37 +02:00
Rohan McGovern
1668c47608 Replace QTEST_APPLESS_MAIN with QTEST_MAIN in tests using QProcess
QProcess requires an application object to be created in order to work
correctly on Windows.

Task-number: QTBUG-26023
Task-number: QTBUG-26024
Change-Id: Ifa90946262bc7e2a7df6b6aad54e10b54473fc97
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-06-05 06:12:20 +02:00
Kent Hansen
f7c2ba9bbe Enter initial state before QStateMachine::started() is emitted
The documentation says that started() "is emitted when the state
machine has entered its initial state", but the implementation
didn't adhere to that.

The consequence is that if you e.g. emitted a signal from a slot
connected to started(), and that signal was used by a transition
from the initial state, the signal would effectively get ignored and
the state machine would remain in the initial state.

Task-number: QTBUG-24307
Change-Id: Ibbeb627d517eaff821d88e256a949eacf6aae350
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-06-04 16:53:42 +02:00
Kent Hansen
2682165708 Fix typos in QState sorting functions
A QObject can't be a child of itself, so the comparison always
returned false. In practice, this was causing the entry/exit order
of parallel states to be random.

QObject::children() is documented to contain the children in the
order in which they were added, so this fix actually achieves
deterministic behavior.

Task-number: QTBUG-25959
Change-Id: Id3f12d6bfbc249f1d4fed0bafb7d0217093e458e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-06-04 16:50:24 +02:00
Rohan McGovern
2268be8040 tst_languagechange: increased timeout on Windows
This test's runtime significantly varies on separate runs on Windows;
runtimes from 10 to 830 seconds have been observed in CI.

Increase the timeout to restore CI stability.

Task-number: QTBUG-26006
Change-Id: Iba153e65264a177d146b2f3647ec6ba529af7135
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-06-04 03:07:48 +02:00
Oswald Buddenhagen
98c7afb8d6 avoid redundant tests
tryRun() already implies tryLink() and tryCompile(), so there is no
point in executing the stages separately ...

Change-Id: Id7321efaca474e8c5db2bc246ac26323d8a99e58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-01 20:34:31 +02:00
Rohan McGovern
79a025b88a Marked expected failures in tst_qtextlayout on Windows
Task-number: QTBUG-25924
Change-Id: I24a8ab6a695bf76f19e9082e1d8b11d8ec03fc4f
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-06-01 16:12:03 +02:00
Kent Hansen
37db43f1c2 Add private API for working with meta-methods in signal index range
Internally, QObject and QMetaObject already leave out non-signal
methods when working with signals. This is possible because the
signals always come before other types of meta-method in the
meta-object data. Ignoring irrelevant methods is faster and can
save memory.

QMetaObject provides internal indexed-based connect() and
disconnect() functions. However, these functions currently take an
absolute method index as the signal specifier, instead of an
absolute _signal_ index. Hence, QMetaObject and friends must convert
from the method index range to the signal index range.

By providing an API that only considers signal indices, clients of
the index-based QMetaObject::connect()/disconnect() can provide the
proper signal index directly. Similarly, for the qtdeclarative
integration (QDeclarativeData hooks) the signal index can be passed
directly. This will eliminate most of the conversions back and forth
between signal index and method index, and some other redundant work
done by qtdeclarative's custom connection implementation.

There are some places where the behavior can't be changed; for
example,  QObject::senderSignalIndex() will still need to return an
index in the method range, since that function is public API.

Changing QMetaObject::connect()/disconnect() to take an index in
the signal range will be done in a separate commit; this commit is
only an enabler for porting existing usage of those functions to
the new behavior.

Change-Id: Icb475b6bbdccc74b4e7ee5bf72b944b47159cebd
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-01 16:04:04 +02:00
Lars Knoll
79194978cd Fix a bug in the case conversion code
Chars that have a case conversion that converts
them into several characters can't be handled
by QChar::toUpper() etc and should get ignored. The code
didn't do that correctly.

Change-Id: I281d122e90bf49187b6449088d2fccef2ef75e86
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-01 13:11:50 +02:00
Thiago Macieira
5a447502b5 Fix the QVector build with C++11 initialiser lists
Initialiser lists were not tested before in the QVector rewrite, so
the older malloc call was left behind.

Also, std::initializer_list has const iterators returning const data
and broke the build in a few places where const qualifiers were
missing.

Change-Id: I3c04e58361989aa7438621cda63c7df457d7dad8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-01 12:27:37 +02:00
Thiago Macieira
9c5a77f0ef Make QVector compile with QT_STRICT_ITERATORS again
Move the iterator classes into QArrayTypedData and add constBegin()
and constEnd() to that class.

I also had to add an operator T*() to the strict iterators, since
there are many places that expect the iterator to behave like a
pointer (including in QVector itself).

Change-Id: Icc5ed56ad47b013664a48eef9d31b5273aecb4e3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-01 12:27:32 +02:00
Rohan McGovern
9469e9fdeb Make tst_qabstractnetworkcache parallel-safe
Use a unique QTemporaryDir instead of a fixed path for the test cache.

Change-Id: Ib664033a509a6cefd7c323708f80ef595b202178
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-06-01 03:16:11 +02:00
Rohan McGovern
8eed0ce930 Mark tst_qfreelist as parallel-safe
This autotest appears to be parallel-safe.

Change-Id: I12f9202633941e9339de0709353efb2b41df4fa1
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-06-01 03:16:04 +02:00
Chris Adams
fbee9834dc Fix crash in QStringBuilder when concatenating data-less QLatin1String
Previously, the append functions in QConcatenable in the QStringBuilder
dereferenced the data() pointer of the argument QLatin1String without
performing null check.

Change-Id: I629f19fbce3113f1f80f4272fa7ae34e1dbc6bee
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-06-01 01:22:06 +02:00
Miikka Heikkinen
32fa7a5410 Fix tst_qlistwidget::fastScroll test case
tst_qlistwidget::fastScroll fails if the mouse cursor happens to be
over the tested widget, because that causes an item to highlight,
resulting in unexpected region of widget to be painted. Fixed by
forcing the mouse cursor off the widget before the test.

Task-number: QTBUG-24299
Change-Id: I8f45541feda44681179d43eda67d970d5fea4e40
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-06-01 01:21:17 +02:00
Laszlo Agocs
b551d5e4f7 QPA tablet event support
Should be sufficient to allow implementing the actual functionality in
xcb/cocoa/windows to match the Qt 4 level of tablet event support.

Task-number: QTBUG-25864
Change-Id: Iebcca256dfba841d8976b58fda1b76026d3133a3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-05-31 09:13:01 +02:00
Rohan McGovern
b63e101a90 Make tst_qnetworkdiskcache parallel-safe
Use a QTemporaryDir for a unique test cache directory for each process,
rather than a fixed path.

Change-Id: I64df8422d01282bbc108e942947c1b55368bd941
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-05-31 05:37:28 +02:00
Rohan McGovern
c09b5f5ad8 Improved stability of tst_qstatemachine, mark as parallel-safe
tst_QStateMachine::postEventFromOtherThread() assumed that 10,000
iterations of the event loop in a separate thread could always be
completed successfully within the default QTRY_COMPARE timeout.
This may be false if the CPU load is already high - such as when running
other tests concurrently.

Decrease the iteration count.

Change-Id: I780523f73c0c16fa0b2ab3201b2b0affdebc198d
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-05-31 05:37:25 +02:00
Rohan McGovern
af8fa2794b Make tst_qtextstream parallel-safe.
Write to a QTemporaryDir instead of the test's build directory.

Change-Id: Ib65a0d58fbdf8caf8f2cb7002aeed1ce34742183
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-05-31 05:37:25 +02:00
Rohan McGovern
26631bec9f Marked tst_qtemporaryfile as parallel-safe
This test failed a parallel stress test, but seemingly only because it
writes to its own build directory.  This should not interfere with other
running autotests.

Change-Id: I27a2f31e32a5b8157ef1082cf0e939bcc0c61c70
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-05-31 05:37:22 +02:00
Rohan McGovern
489dd2804b Marked tst_qfile as parallel-safe
This test failed a parallel stress test, but seemingly only because it
writes to its own build directory.  This should not interfere with other
running autotests.

Change-Id: I80e548fdb0e915ebe86dcd2205537cb6fee09cff
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-05-31 05:37:19 +02:00
Jędrzej Nowacki
d17cf14185 Implement QVector with QArrayData interface.
Change-Id: I109f46892aed2f6024459812d24922b12358814d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-05-30 17:07:27 +02:00
Rohan McGovern
46ae50a5d0 Marked tst_qprocess as parallel-safe
This autotest appears to be parallel-safe.  It fails our parallel stress
test, but only because it writes to its own build directory.  This
should not interfere with other autotests.

Change-Id: Ie99dde24edc0fda0c8ec4352a6e44abb7cbc54f8
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-05-30 06:29:10 +02:00
Jan-Arve Saether
7cdcc26722 Fix Qt 5 todo issues for QSizePolicy.
* Merge the two public ctors.
* Use bitflags instead of shifting bits (more readable).
* Add autotest
* Use int datatype for the "stretch setters". (values out of bounds are clamped)

Streaming to QDataStream will still use the Qt 4 format.

Task-number: QTBUG-25100

Change-Id: Iecb1e78cb12717e4d84448484c3ad8ca469d571a
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
2012-05-30 01:54:45 +02:00