Commit Graph

2416 Commits

Author SHA1 Message Date
Lars Knoll
087f279fff Don't use gcc extension for QByteArrayLiteral neither
This extension doesn't work for e.g. default arguments
in function declarations.

Change-Id: I32b7afa6e01b6af55fb2409179b4fd94cb04cd8d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-12 22:57:22 +02:00
Thiago Macieira
086d6e74d2 Now merge the QtShared::ExternalRefCount class into QSharedPointer
Completing the work of the previous commit: we don't need separate
classes. Merge into the main class's body.

Change-Id: I2f89b34cb6b7f5f9e8d8b809bebd86656f458644
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-06-12 20:09:26 +02:00
Thiago Macieira
55c6f09b3a Remove "delete value" from QSharedPointer
This allows a QSharedPointer to be used in contexts where the class in
question is still forward-declared. This produced a warning in Qt 4 due
to the expansion of the template, even if there was no chance of the
pointer being deleted there (because the reference count could not drop
to zero).

Now, not only is the warning removed, but you can actually have the
reference count drop to zero in a forward-declared class and it will
do the right thing. That's because the deleter function is always
recorded from the point of construction and we're sure that it wasn't
forward-declared.

The unit test for forward-declarations had to be rewritten. The
previous version was passing only because the QSharedPointer object
was created under the "tracking pointers" mode, which causes a custom
deleter to be used in all cases.

Task-number: QTBUG-25819
Change-Id: Ife37a4cea4551d94084b49ee03504dd39b8802c1
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-06-12 20:09:09 +02:00
Stephen Kelly
32bc019ac1 Fix automatic declaration of QSharedPointer<T> metatypes.
QSharedPointer doesn't work like the other automatic template metatype
declarations because in some cases T* is declared as a metatype, but we
are interested in QSharedPointer<T> (eg QObject*). In other cases, T is
declared as a metatype and we are interested
in QSharedPointer<T> (eg char).

In particular the macro used before this patch was attempting to get the
metatype id of the element_type using for example qMetaTypeId<QObject>()
instead of qMetaTypeId<QObject*>(), which did not work.

Similarly, the variadic macro driven test is no good, because it was
testing QSharedPointer<QObject*> instead of QSharedPointer<QObject>,
so that is removed.

In the end, the only thing we can sensibly automatically declare as
metatypes are QSharedPointers to QObject derived types. That is also
the type that makes the most sense in a QML context anyway.

Change-Id: I13dd40147e2e6bedf38661f898102abaaaa96208
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-12 11:16:45 +02:00
Mitch Curtis
7462033cc5 Clean up and consolidate QDateTime-related tests.
Some test functions that only test QDate and QTime were in
tst_qdatetime.cpp. Upon moving these into tst_qdate.cpp and
tst_qtime.cpp, there were already some similar tests so I
consolidated them.

Change-Id: I5f8758bf8b4804ae9d3a482f49d21de9f7a1dc03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-12 11:05:39 +02:00
Thiago Macieira
290655c8a2 Fix compilation of tests/auto/corelib/tools with QT_STRICT_ITERATORS
Most fixes are simple and quite obvious. The ones more involved are
the ones to QArrayData, which had probably not been compiled with
strict iterators thus far.

Change-Id: Ic4ff84c34fd9a04fd686fecaa98149b1c47c9346
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-12 04:30:20 +02:00
Stephen Kelly
c5665a182d Only quit if there are no visible widgets or windows.
We need to let the QGuiApplication determine whether quitting is appropriate
based on whether there are visible top level QWindows after the last top-level
QWidget was closed.

This solves the issue raised here: http://thread.gmane.org/gmane.comp.lib.qt.user/1880

The transientParent is the QWindow equivalent of parentWidget on QWidget, so the test
in QGuiApplication::shouldQuit is similar to the one in QApplication::shouldQuit.

Change-Id: I500eff8d5887f24415180134b3a4be3c630a896f
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-06-12 04:30:18 +02:00
Stephen Kelly
f9caf48bee Use a QVector<int> instead of a QSet<int> in itemviews/models.
The QSet<int> is a more expensive container to use and create, so
it should be avoided.

This is source incompatible compared to earlier Qt 5 for
QAbstractItemView subclasses which reimplement dataChanged, but this
patch changes nothing compared to already-present SiC compared
to Qt 4.

Change-Id: Id95391dfd62a0a7f487a8765790b007badefb937
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-06-12 04:30:07 +02:00
Jędrzej Nowacki
3df316e961 Avoid a type name normalization during auto-registration.
Containers are auto-registered and use normalized names.

Change-Id: Id65c3940401f69436929220e1f6a971135e147ed
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-06-12 04:30:05 +02:00
Thiago Macieira
9e1a9878aa Add a unit test to QSharedPointer being deleted by a C++11 lambda
This already worked, but let's have a test so we can be sure it doesn't
regress.

Change-Id: I358b436d216e3ec4310f05ccf4f70f9e7aad3281
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-12 04:29:29 +02:00
Debao Zhang
7616f31052 Make qmetaobject autotest independent of QtWidgets
Change-Id: I4340036a4e6024d9b8d0c7832ad7bfb28ec4bc99
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-06-11 00:37:01 +02:00
Konstantin Ritt
12e0319213 Line Breaking Algorithm: handle the Object Replacement Character
See http://www.unicode.org/reports/tr14/#CB
and http://www.unicode.org/reports/tr14/#LB20 for details

Change-Id: Ice0aa2b2ce81f6e39839a353240420436eddd754
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-10 15:58:13 +02:00
Konstantin Ritt
c8dd0de1a6 Line Breaking Algorithm: don't break inside numeric expressions
Change-Id: I8362663454e4c6604ecb6289ae8009d47c78aeb1
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-10 15:58:09 +02:00
Konstantin Ritt
48d99e74fc Update the Unicode Text Breaking Algorithm implementation tests
* The Line Breaking Algorithm implementation conformance tests has been added;
* The Grapheme, Word, and Sentence Breaking Algorithm implementation
  conformance tests has been updated.

Change-Id: Ia1a6eef6272d580964cb23788ddf30dfd5f4a5a3
Note: the Line Break test data contains some extended cases we don't currently support;
      just skip them for now.
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-10 15:58:06 +02:00
Konstantin Ritt
d64cb5f707 Update the Unicode Text Breaking Algorithm implementation
to make it conformant to the Unicode 6.1 specifications #14 and #29.

The most important changes are:
* The implementation has been reworked from scratch to fix all known bugs;
* Separate-out the grapheme and the line breaking implementation to eliminate
  an overhead due to calculating unnecessary breaks;
* Stop using deprecated SG class in favor of resolving pairs of surrogates;
* A proper support for SMP code points;
* Support for extended grapheme clusters (a drop-in replacement for the legacy
  grapheme clusters as of Unicode 5.1);
* The hardcoded tailoring of UBA has been eliminated which breaks the 7 years-old
  lineBreaking test. Some later, we'll investigate if such a tailoring is still needed.

Change-Id: I9f5867b3cec753b4fc120bc5a7e20f9a73d89370
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-10 15:58:02 +02:00
Konstantin Ritt
f32a7f1e21 Update the Unicode related autotests
Update NormalizationTest.txt data file with one from UCD 6.1;
Add few more QChar::unicodeVersion() testcases;
Add some line break class mapping testcases;
Add some exceptional case mapping testcases;
Add script class mapping test;

Change-Id: I164394984abb2b893c8db62fb77e7bd87aa0850b
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-10 15:57:57 +02:00
Kent Hansen
5e79415218 Make qpointer autotest build without widgets
Change-Id: Ibd05a49174e7055faa89c48659130a11418b9616
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Debao Zhang <dbzhang800@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-10 13:43:18 +02:00
Thiago Macieira
fbabbe63c5 Use UTF-8 in the QtTest data and benchmark tags
Future-proofing. Since Qt source code is now mandated to be in UTF-8,
it is entirely possible that someone will use non-ASCII in data tags.

Though it would be interesting to see how to access them from the
Windows command-line.

Change-Id: I880fc312432b62143888ff1e1d9abbd54f704601
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-06-09 10:45:01 +02:00
Konstantin Ritt
80ceba9a36 QZip: improve reading of zip files, fix some edge cases in writing
This supercede https://codereview.qt-project.org/#change,25111 and fixes
some more cases;
The autotest crash is fixed as well (but the test itself omitted due to
.pro file misconfiguration)

Change-Id: I4a3adde18b4f9a8ac9822f700eee71d2a12b9c2c
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
2012-06-08 21:49:58 +02:00
Markku Heikkila
9e75354aab Fix crash in QTreeWidgetItem::sortChildren when adding new item.
This is a cherry-pick of 4f388c383e39b598d997e21bd9a4f16d89bd0625
from February

Recursive call is caused if user code calls QtreeWidgetItem()::sortChildren and
sorting is enbled in QTreeWidget.

First call is from user code and second is caused by timer.
When timer expires second call is made.

This recursion is prevented with QTreeModel::SkipSorting skipSorting()
in QTreeWidgetItem::sortChildren();

Task-number: QTBUG-20345
Change-Id: Ibf73e69274423f31397a9e391bfba7d5c4103a3c
Reviewed-by: Markku Tapio Heikkilä <markku.heikkila@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-06-08 18:09:07 +02:00
Kent Hansen
5fc8cc830e Make qfont autotest build without widgets
Change-Id: I2ab344d44cb2aa8c59c1c28f7368784849d4b74d
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-08 08:31:14 +02:00
Kent Hansen
027cd4c1b9 Make qicon autotest build without widgets
Change-Id: Ic6176404076bac956d00d57c99e0bbf0ac78beca
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-08 08:23:24 +02:00
Friedemann Kleint
23994a364e Add Qt::WindowTransparentForInput to Window flags manual test.
Change-Id: If27567a93d5a2e910289c680643503d02831d742
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-06-08 08:02:46 +02:00
Mitch Curtis
168c583a78 Allow ISODate string without seconds in QTime::fromString().
According to ISO 8601 (section 4.2.2.3), seconds can be omitted
from a string representing time.

Task-number: QTBUG-2813
Change-Id: I2578f290845e46a8f49be489f1d7427984ae7f08
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-08 00:55:27 +02:00
Konstantin Ritt
88e735c9c9 Shift positions for lineBreakType
to keep them consistent with positions for all other flags.
This changes the internal behavior so that attributes[0].lineBreakType now means
"break opportunity at start of the text (before the first character in the string)"
and is always assigned with HB_NoBreak to conform rule LB2
(see http://www.unicode.org/reports/tr14/#LB2).

The current implementation is based on the sample implementation from tr14
that aimed to be as simple as possible rather than to be optimal.
From now, we can use pieces of the attributes array "as is"
without having to adjust some positions. Or we can analize some long text
by chunks (e.g. paragraph by paragraph) and consume less memory.

This introduces a minor overhead that will be eliminated shortly.

Change-Id: Ic873a05a9d5203b1c3d5aff2e4445a3f034c4bd2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 21:18:36 +02:00
Konstantin Ritt
8aac04f705 QTextBoundaryFinder: Consider soft hyphen as line breaking opportunity
SoftHyphen enum value was added to specify such a boundary reason

Change-Id: I4248909eed6ab8cbca419de4dcf9fe917620a158
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 21:18:36 +02:00
Kent Hansen
7d7cd17d38 Make qtexttable autotest build without widgets
Change-Id: Id5f93dee0c4b5978c473838559f586ced35a2981
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 07:26:05 +02:00
Kent Hansen
51aff5ba67 Make sql autotests build without widgets
Change-Id: Icd4d2ef39961e2e0ec5c9e910c74b3e8a35503bf
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 07:25:27 +02:00
Kent Hansen
2a62122682 Make "other" autotests build without widgets
Change-Id: I49e73c31b98e43259771c0e265cf13fc167c45f2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 07:24:31 +02:00
Kent Hansen
0f241b6f5e Don't build printsupport autotests when widgets aren't available
Change-Id: Ida376a75f376fc0d3696d715648c7229aec301e2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 07:24:01 +02:00
Kent Hansen
58db6e8822 Make animation autotests build without widgets
Change-Id: Icb0560a26973921611f697240fbce121fff518e9
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:39:05 +02:00
Kent Hansen
1b444d5748 Remove widgets dependency from qdatastream autotest
Change-Id: I30ce3ce2d5a0badc7a846256825b4deea8c0856a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-07 00:39:05 +02:00
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