Commit Graph

820 Commits

Author SHA1 Message Date
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
Mitch Curtis
902638e379 Add leading zeros to years below 1000 in QDate::toString().
QDate::toString(Qt::ISODate) lacks prefixed 0's on years below 1000.
The ISO 8601 standard dictates that this should be the case.

Task-number: QTBUG-16476
Change-Id: I7e73152bba0f5894bcbaa3f4418732b74ce86bc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-20 12:38:32 +02:00
Kent Hansen
2bfdc2b540 Add test for queued call of method with unregistered parameter type
Verify that this produces a warning containing the relevant typename.

Change-Id: I046c02585e410a211e9175600b1027dda83bdd9c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-06-20 09:34:48 +02:00
Oswald Buddenhagen
8b822825c5 make use of $$[FOO/get] properties
this cleans up a lot of hacks supporting the build of qt, including the
last bits of $QTDIR.

Change-Id: Id119886ed8097967dad6cf86ebd4e71d90c42841
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-06-19 16:39:58 +02:00
Thiago Macieira
ba7f664a7f Fix tst_qfile opening of stdin/out/err: don't assume
The standard streams can be redirected to a file, so don't assume
anything, but try to get the actual size and position from the OS and
from the C library (stdout is usually buffered, so the result of lseek
might be different from ftell).

Change-Id: Ice4a0aa21726671928f56a13cc07cc0e4b52091d
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-06-18 13:45:28 +02:00
Konstantin Ritt
15db02cb11 tst_QChar: drop outdated testcase
Change-Id: I0c06643165b299c552c697f400608e29ae4e7f7a
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-16 21:15:08 +02:00
Konstantin Ritt
ff1aba7d92 Make QTBF autotest support SMP code points in the test data
I didn't do this earlier since the current test data doesn't contain any SMP code points,
the Unicode 6.2 test data does - so, I can confirm this code really works.

Change-Id: Ieae35e8480a89e22d846fd038e79592fefbbf2ee
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-16 21:14:35 +02:00
Stephen Kelly
e83c3a0d33 Add automatic metatype declaration for QPointer and QWeakPointer.
Change-Id: Ic9a04fa68d0bb14ef07455a6559e59f4b887f38b
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-15 19:33:41 +02:00
Konstantin Ritt
d8c04d60db Make QUnicodeTables::script() support SMP code points
Instead of expanding the scripts table with script values for the code points
>= 0x10000, it has been merged with the properties table in order to
increase perfomance of the script itemization code (not affected yet).
(Stats: the properties table grew up in 97428-89800 = 7628 bytes;
        the old scripts table was of size 7680 bytes)

The outdated ScriptsInitial.txt and ScriptsCorrections.txt file has been removed
(they were just empty, the "corrigendum" script corrections should be applied
to Scripts.txt directly, *no customization allowed*!).

More script testcases has been added - at least one per supported script.

Task-number: QTBUG-6530

Change-Id: I40a9e76f681e2dd552fd4c61af0808d043962e79
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-06-14 05:22:13 +02:00
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
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
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
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
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