Commit Graph

6119 Commits

Author SHA1 Message Date
Clemens Sielaff
2a24c3c268 Fixed Bug in QVariant comparison when containing QStringLists
As it were, QStringLists were not handled explicitly when comparing
QVariants. If both QStringLists contained only a single entry, they
were treated as QStrings - if both QStringLists were empty, there were
equal (correctly so) - but if one of the QStringLists had more than
one entry, the compare function fell through to returning always 1.
As discussed here:  https://stackoverflow.com/a/38492467/3444217

Added rich comparison tests for all non-numerical, non-recursive
QVariants that support them (except QModelIndex and
QPersistentModelIndex)

Task-number: QTBUG-54893
Change-Id: Icc5480d9ba056ee5efe83da566c5829caa1509d7
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-08-03 11:16:35 +00:00
Marc Mutz
5dc83974f7 tst_QTreeView: Fix UB (invalid downcast, member call)
As reported by UBSan:

  tst_qtreeview.cpp:2187:36: runtime error: downcast of address 0x7ffc15749f20 which does not point to an object of type 'PublicView'
    0x7ffc15749f20: note: object is of type 'QTreeView'

Fix by making the test a friend of QTreeView (and, for
Clang, of QAbstractItemView) instead.

Change-Id: I5b748696ab441a91058f4d45a18bd5ed75a6e560
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-01 16:07:50 +00:00
Marc Mutz
08f38d2214 tst_QAbstractItemView: Fix UB (invalid downcast, member call)
As reported by UBSan:

  tst_qabstractitemview.cpp:336:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView'
   0x7ffe6fe96e10: note: object is of type 'QListView'
  tst_qabstractitemview.cpp:337:5: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView'
   0x7ffe6fe96e10: note: object is of type 'QListView'
  tst_qabstractitemview.cpp:338:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView'
   0x7ffe6fe96e10: note: object is of type 'QListView'
  [etc ...]

Fix by making the test a friend of QAbstractItemView instead.

Change-Id: I1a08977042296eb34e9dbdb5c0595662dbd2e5ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-01 16:07:40 +00:00
Olivier Goffart
49c8923282 QSortFilterProxyModel: Don't forward the hint from source's layoutChanged signal
We can't forward a VerticalSortHint or HorizontalSortHint hint, because we might
be filtering extra items.

The documentation of QAbstractItemModel::LayoutChangeHint states:

    Note that VerticalSortHint and HorizontalSortHint carry the meaning that
    items are being moved within the same parent, not moved to a different
    parent in the model, and not filtered out or in.

And some of the views rely on this assumption (QQmlDelegateModel for example)

What happens in the test is the following:
- 'model' emit the dataChanged signal when its data is changed.
- 'proxi1' QSortFilterProxyModelPrivate::_q_sourceDataChanged does not forward
  the dataChanged signal imediatly, it will instead first re-sort the model and
  call layoutAboutToBeChanged / layouChanged with the VerticalSortHint
- 'proxy2' would forward the layoutAboutToBeChanged with the hint, but in
  QSortFilterProxyModelPrivate::_q_sourceLayoutChanged, it will redo the mapping
  which will cause the changed data to be filtered.
So proxy2 can't forward the VerticalSortHint as it removed rows in the process.

Change-Id: I20b6983e9d18bf7509fe6144c74f37d24e4a18c2
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-08-01 14:08:15 +00:00
Marc Mutz
b55221cf50 Fix UB (invalid enum value) in tst_QTreeView
As reported by UBSan:

  tst_qtreeview.cpp:663:5: runtime error: load of value 4294967295, which is not a valid value for type 'DragDropMode'

Instead of abusing -1 to indicate to not set the dragDropMode,
use a separate boolean field in tha data.

Change-Id: I13e7539c858f3b2462d57d660062ef3cb7aec61b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-31 14:22:29 +00:00
David Faure
8a33077853 QUrl: fix resolved() for data URLs
They look relative because the path doesn't start with a '/' but they
have a scheme so they shouldn't be combined as if it was one absolute
and one relative URL.

[ChangeLog][QtCore][QUrl] QUrl::resolved() no longer treats a URL with
a scheme as a relative URL if it matches this URL's scheme. This special
casing was incompatible with RFC 3986 and broke resolving data: URLs,
for instance.

Change-Id: I3758d3a2141cea7c6d13514243eb8dee5d510dd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-29 17:51:51 +00:00
Denis Kormalev
f24cc53cc2 Fix for race condition in signal activation
There was a race condition between QObject::disconnect() and
QMetaObject::activate() which can occur if there are multiple
BlockingQueued connections to one signal from different threads and
they connect/disconnect their connections often.

What can happen in this case is:
T1 is in activate() method and T2 is in disconnect() method

T1                          T2
locks sender mutex
selects next connection
unlocks sender mutex
                            locks sender mutex
                            sets isSlotObject to false
creates QMetaCallEvent      derefs connection
posts event

Two things can happen here:
1. Connection can still be valid, but it will have isSlotObject==false
and callFunction will be used instead of slotObj
2. Connection can already be invalid

To fix it mutex unlock should be moved after QMetaCallEvent creation.

Also there is another case, when we don't disconnect but delete the
receiver object. In this case it can already be invalid during
postEvent, so we need to move mutex unlock after postEvent.

Change-Id: I8103798324140ee11de5b4e10906562ba878ff8b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-29 06:09:22 +00:00
Alexander Volkov
695d85363e Item delegates: show localized detailed tooltips and "What's this?" texts
Extract the common part from QItemDelegate and QStyledItemDelegate
which uses QLocale to convert a value for Qt::DisplayRole to a string.
Use this code to get the text for tooltips and "What's this?".

[ChangeLog][QtWidgets][QAbstractItemDelegate] Show localized detailed
tooltips and "What's this?" texts.

Task-number: QTBUG-16469
Change-Id: I8618763d45b8cfddafc2f263d658ba256be60a15
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-07-28 23:42:56 +00:00
David Faure
f5af4428c3 QVector: fix crash on reserve(0)
It crashed when d was equal to Data::unsharableEmpty().

Task-number: QTBUG-51758
Change-Id: If9f2a7d11892507135f4dc0aeef909f59b7478fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-07-28 13:50:38 +00:00
Eirik Aavitsland
7bf002c3b3 Backwards compatibility fix: No default colormap for Mono QImages
This is a partial revert of a4e2f2e687.

That fix tried to avoid the risk of a crash in pixel() by ensuring
Mono QImages created with external data also got a default color
table. However, that broke usable behavior in existing code that was
painting in Mono QImages using color0/color1.

This commit reverts to the old behavior, and instead expands on the
checking in pixel() so that lacking color table is handled gracefully
for all indexed formats.

Task-number: QTBUG-54827
Change-Id: I9164198bed9d20c4b12cdba40a31c141bef3128d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-07-27 11:46:11 +00:00
Friedemann Kleint
c14c149b51 Fix QTemporaryDir to handle Unicode characters on Windows
For platforms not providing mkdtemp(), QTemporaryDir relied on an implementation
of q_mkdtemp() operating on char *, converting back and forth using
QFile::encodeName()/decodeName() when passing the name to QFileSystemEngine.
This caused failures on Windows (which uses "System"/Latin1 encoding)
for names containing characters outside the Latin1 space.

Reimplement q_mkdtemp() to operate on QString, which avoids the conversions
altogether and also enables the use of larger character spaces for the
pattern.

Add tests.

Task-number: QTBUG-54810
Change-Id: Ie4323ad73b5beb8a1b8ab81425f73d03c626d58a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-20 07:31:18 +00:00
Olivier Goffart
af055964f5 moc: fix infinite loop over malformed input
We should not call prev() if we had already reched the end.

Task-number: QTBUG-54815
Change-Id: I56bc86880a0dbfdce57fc4a08e5950f2ff3a5958
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-07-20 06:56:40 +00:00
Luca Bellonda
d4302ec693 QtCore: Fix QXmlStreamReader for invalid characters in XML 1.0
The XML parser uses fastScanLiteralContent() to read a block of
text. The routine was not checking the range of valid characters as
defined in the XML standard:
https://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char
A check has been added to stop reading the bad character.
Note that the characters are legal in XML 1.1, but QXmlStreamReader
is a well-formed XML 1.0 parser

[ChangeLog][QtCore][QXmlStreamReader]
Fixed a bug in the XML parser that prevented to load XML that
contained invalid characters for XML 1.0.

Change-Id: I10aaf84fbf95ccdaf9f6d683ea7c31925efff36d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-17 14:54:36 +00:00
Olivier Goffart
34de4f6a15 moc: Fix a crash with malformed input
Do not increment 'data' past the buffer in case of invalid token.

Remove the left over qDebug so we can make a test.

Task-number: QTBUG-54609
Change-Id: I8f0dd3381fbdea3f07d3c05c9a44a16d92538117
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-07-15 09:37:45 +00:00
Oswald Buddenhagen
3c8134958c fix raw data leak in $$absolute_path()
when the file name is empty, the path will be returned verbatim. this
must be considered when constructing the return value.

Task-number: QTBUG-54550
Change-Id: Ie108ed52275e66a154ef63bd6f7193f55b3e0454
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:27:01 +00:00
Oswald Buddenhagen
d459a6b0e0 fix calculations of worst-case size requirements for token buffer
Change-Id: I3aa4c736acec44f95a0a33c7baae9276568f684f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 14:26:58 +00:00
Oswald Buddenhagen
dacf3994ba fix custom functions inheriting other functions' arguments
Task-number: QTBUG-41830
Change-Id: Iba3eee4975a1ee671b7190e52c0efc9a18147c62
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 14:26:54 +00:00
Oswald Buddenhagen
1b4ea11332 make error() propagate from requires() and REQUIRES=
that can make sense if a function which determines the availability of
a dependency fails to do so for unexpected reasons.

Change-Id: If6cd113df25aee66830c120a2fab067c822a4543
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:26:49 +00:00
Oswald Buddenhagen
339b9706cc make error() propagate from custom replace functions
it didn't, which is rather unexpected.

Change-Id: I8cdb7b1490a8c2207809812b93cc65fbe23a1b98
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:26:46 +00:00
Oswald Buddenhagen
b27d4835c2 fix error() not propagating through if()
if() would simply "downgrade" a fatal error to a false condition, which
is certainly not expected.

Change-Id: Ie9c54f2bddf588856498bf795007b341b7c9363a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:26:42 +00:00
Friedemann Kleint
9131f6e561 QCompleter::setModel(): Restore completion role
When setting a QFileSystemModel as model, the completion role
is set to QFileSystemModel::FileNameRole. This needs to be reset
to the default Qt::EditRole when setting another model.

Task-number: QTBUG-54642
Change-Id: Ie78d5d417e008ad05a2f995bdbc218b3ad1bc49c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2016-07-13 13:45:44 +00:00
Edward Welbourne
e21bf5e6b3 QString::replace(): protect sought text and replacement
When replacing each copy of one text with a copy of another, we do so
in batches of 1024; if we get more than one batch, we need to keep a
copy of the sought text and replacement if they're part of the string
we're modifying, for use in later batches.

Also do the replacements in full batches of 1024, not 1023 (which left
the last entry in an array unused); marked some related tests as
(un)likely; and move some repeated code out into a pair of little
local functions to save duplcation.

Those new functions can also serve replace_helper(); and it can shed a
const_cast and some conditioning of free() by using them the same way
replace() now does.  (There was also one place it still used the raw
after, rather than the replacement copy; which could have produced
errors if memcpy were to exercise its right to assume no overlap in
arrays.  This error is what prompted me to notice all of the above.)

Added tests.  The last error proved untestable as my memcpy is in fact
as fussy as memmove.  The first two tests added were attempts to get a
failure out of it.  The third did get a failure, but also tripped over
the problem in replace() itself.  Added to an existing test function
and renamed it to generally cover extra tests for replace.

Change-Id: I9ba6928c84ece266dbbe52b91e333ea54ab6d95e
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-12 10:22:25 +00:00
Marc Mutz
e6a5be1d81 QPair: add test for pair of references
std::pair explicitly supports this (cf. std::tie),
so check we do, too.

Change-Id: Idc3c1739a4bc64a0da120dcf953def7e432f6f71
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 20:02:41 +00:00
Marc Mutz
6a7bae9a26 QHashFunctions: test for hash equality of null and empty string types
In Qt, null QStrings compare equal to empty ones, so add an explicit
check that the corresponding hash values are identical, too.

Ditto for QByteArray.

Change-Id: I190fc95a765305928d9b6b0e4955433865b6b247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 20:02:15 +00:00
Anton Kudryavtsev
e27c07389b QString: adapt chop() auto test as data-driven test
Thiago Macieira asked to do that.

Change-Id: I9a07dad7ff2bfebc2f863e0e9f151aab66450bcf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 13:22:46 +00:00
Anton Kudryavtsev
b36c6bab8d QString: add auto test for chop()
Change-Id: I8fc65c65776a64cc92e8cba3993d17746be81ba1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-07 15:03:30 +00:00
Marc Mutz
631b143b3f QComboBox: fix crash on setEditable(false) called from editTextChanged()
QLineEdit::setText() emits QLineEdit::textChanged(), which is
connected to QComboBox::editTextChanged(). When a user slot
connected to editTextChanged() sets QComboBox::editable to
false, the line edit will be deleted in setEditable() and
when control returns to QComboBoxPrivate::setCurrentIndex(),
the formerly non-null 'lineEdit' has changed to nullptr,
leading to a nullptr dereference when attempting to set the
completionPrefix on lineEdit->completer().

Fix by re-checking 'lineEdit' after returning from the
QLineEdit::setText() call.

Add a test.

Task-number: QTBUG-54191
Change-Id: I94154796cfde73fb490f8471c48b9d6f62825a92
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-06 10:34:43 +00:00
Marc Mutz
a91d0dd369 Q_(U)INT64_C is not a type, so don't use it as if it was
These expressions only work because they contain no non-parenthesized
commas and an int literal is last.

Fix by wrapping only the integer literal in Q_(U)INT64_C.

Change-Id: I6b8e508b6c7c022f4b3342f65c26aab89ce17702
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-06 10:34:38 +00:00
Friedemann Kleint
a9613ba3f1 Testlib: generate_expected_output.py: Run in C locale
Otherwise, float numbers are formatted using a decimal comma
in German, causing huge diffs and failures.

Change-Id: Icd85a293d0564cac6be244eb0793611920d0c89c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-05 15:00:58 +00:00
Thiago Macieira
4f3eb66173 QUrl: Test that we do correctly accept valid schemes
... and reject invalid ones. There was one error: we accepted schemes
starting with pluses, dashes and dots.

Change-Id: Ie585843cfb684bc3b6e3fffd145cfe12227ec4ad
Reviewed-by: David Faure <david.faure@kdab.com>
2016-07-02 16:36:50 +00:00
David Faure
1af4916e11 QTime: restore Qt3 compatibility in the QDataStream operators
A Qt5 program writing a null QTime() using setVersion(QDataStream::Qt_3_3),
and then a Qt3 program reading that, would lead to a weird QTime,
with isNull=false, isValid=false, hour=1193, minute=2, second=47, ms=295.

This commit restores interoperability, by writing out the expected value
(0) for a null QTime rather than the -1 value used by Qt4 and Qt5.

Change-Id: Icde468a8f6fc9434ef7018296725819b44d672af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-02 08:13:44 +00:00
Friedemann Kleint
2714d94ff4 Fix tst_QNetworkReply::qtbug45581WrongReplyStatusCode() on Windows
The file is read using CRLF line convention on Windows.

Task-number: QTBUG-24226
Change-Id: Ie08fa603e29c80a42de4bfbfd1f4237f53c22b98
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-30 07:07:11 +00:00
Eirik Aavitsland
c2b7841843 Finally fix crash in inplace-modified data-constructed images
Avoid all inplace modification of images using external data
buffers. Since the QImage methods are documented to create a
(modified) copy, there is afterwards no API requirement on the
lifetime of the data buffer.

This patch supersedes 509bc7e59c

Task-number: QTBUG-53721
Change-Id: I3ccc01619eb61d8630104449394e0b76df0af695
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-06-15 12:55:16 +00:00
Timur Pocheptsov
17143bf47c tst_QUdpSocket - remove insignificance
This is the second attempt to remove 'insignificant' from UDP socket test to:
- make changes ending up in regressions more difficult (hopefully impossible)  to merge
- switch to BLACKLIST if needed
- make flaky tests more visible.

For now this 'back to significant' will be accompanied by extended BLACKLIST.
New in BLACKLIST:
* OS X - datagram size-related problems (fixed in 5.7)
* OS X - multicastLeaveAfterClose - will probably stay BLACKLISTED,
  seems to be a Darwin's quirk, can be fixed in OS X >=  10.10.
* windows ...

tst_QUdpSocket::echo seems to fail randomly on OS X/linux and
it looks like it fails at the same time on different machines,
should be something server-related (a guess only).

Change-Id: Ib344348ffab03fab1b9309b80449a04d8ce247c6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-06-14 11:13:50 +00:00
Jesus Fernandez
8e88937811 Fix UNSIGNED values in QMYSQL
The unsigned flag in columns was ignored when creating the list of
bound values in a mysql table. So the result iteration with
QSqlQuery::next stops after the first wrong truncated value.

[ChangeLog][QtSql] Fixed QSqlQuery::prepare value truncation error when
using UNSIGNED values in a MySQL database.

Task-number: QTBUG-53969
Task-number: QTBUG-53237
Change-Id: I10d977993445f2794f1dd8c88b2e83517ef524f3
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-06-14 11:13:11 +00:00
Timur Pocheptsov
23173c725c QSslSocket (OpenSSL) - handle abort/close on sslErrors emitted
If a user's code, attached to sslErrors signal, calls abort/close
or disconnectFromHost but our SSL socket was configured not to verify a peer,
no need to continue handshake after calling checkSslErrors
(and finally crashing on invalid 'ssl' pointer).

Task-number: QTBUG-53906
Change-Id: I7f185511d278f9d6f16e7d6c5ba424707141459c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-14 07:29:01 +00:00
Friedemann Kleint
caa4e44937 tst_QTcpSocket: Replace insignification on Windows by BLACKLIST.
Partially reverts f3939d943e.

Task-number: QTBUG-52714
Task-number: QTBUG-49332
Task-number: QTBUG-49333
Change-Id: I1f1b3278134b1e6156c0cb7006d396154c776a46
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-10 21:48:54 +00:00
Joerg Bornemann
bd4344a0bd Fix qplugin autotest on Windows
Since Qt 5.0.0 we never built the test plugins on Windows, because we
checked for the existence of QtCore[d]4.dll, and the actual test does
not complain if it cannot find any plugins.
Use the right conditions to check for debug/release Qt builds on
Windows. Use subdirs dependencies on every platform and then actually
pass the right variable to SUBDIRS. Clean up the pro file while we're at
it.

Change-Id: I099f30afd445fbf43dc5677d256ffe55b27639b3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-08 19:40:29 +00:00
Friedemann Kleint
6c0783d107 Revert "Insignifify qfileinfo on Windows, like QDir".
This reverts commit 55655abfaf.

The crashes in release mode cannot be locally reproduced.

Change-Id: I4e7b1defbeac5d5512b2fa82a367d2e04e3c37a4
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-06-08 19:05:46 +00:00
Friedemann Kleint
19def3d8f1 Revert "Insignifify qdiriterator test"
This reverts commit b373d183de.

The crashes in release mode cannot be locally reproduced.

Change-Id: I38ff5e9e045cff0e94e24ca07fb6e18e88b677c7
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-06-08 19:05:38 +00:00
Friedemann Kleint
36ffe18f05 Re-enable tst_QDir on Windows.
Partially revert f3939d943e.

Change-Id: I67e4d8973bc18d9cd77750c6379221d34e9484b3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-06-08 19:04:36 +00:00
Luca Bellonda
767319a5aa Add support for 8bit encodings not ASCII compatible in QXMLStreamWriter.
When using a 8 bit encoding to write a file, a test discovers if the
encoding is really ASCII compatible by examining a letter and one of the
XML reserved characters. EBCDIC, in the current base, was not well
handled.

[ChangeLog][QtCore][QXmlStreamWriter] Fixed a bug that prevented the
generation of valid XML files when using encoding with 8 bit per
character but not ASCII compatible. QXMLStreamWriter generated XML
markup using always ASCII in this case.

Change-Id: I9c86a122dd91b2290d50c358638442f99777d4ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 18:50:25 +00:00
Marc Mutz
5a15545ee2 QDebug: fix streaming of QChars
Commit 9ef3ff30 introduced a new function, putUcs4(), to
output QChar, char16_t, char32_t as a, possibly escaped,
character literal, but got the order of stream modifiers
wrong. Instead of applying the field width to the 'ucs'
streaming, it applied it to the prefix '\u'. The same
problem exists for the pad char, leading to the result
   '00\ue4'
for a QChar containing
  ä (LATIN SMALL LETTER A WITH DIAERESIS)

Fix by reordering the elements streamed so that the
prefixes come last.

Added a test.

Change-Id: I6eaa0586501b9e780aaa3bb5dcec0e5c2f86a219
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 18:29:38 +00:00
Friedemann Kleint
df3f685826 tst_QFileSystemModel: Remove Win32LongFileName().
Modern SSD drives no longer have short file names enabled, causing
the test to fail.

Task-number: QTBUG-29403
Change-Id: I2e9866d8f8a6ed3df9d2dc6630b8cfa47ade0728
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-06-08 04:09:48 +00:00
Friedemann Kleint
ae0a2fe041 Rewrite test tst_QDir::cdBelowRoot() to be data-driven.
Limit the macro #ifdefery and allow for more test cases.

Task-number: QTBUG-53712
Change-Id: I2c185efc7c3b8fcd0217d2021bd98ab6044b5aee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-06-08 04:08:34 +00:00
Hannah von Reth
ca434d0c20 Enable testStyleOptionInit for all styles and fix affected styles.
Change-Id: I7cb759445342ecb58d5187ddd4a22e41fdea084a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-06-06 13:12:14 +00:00
Thiago Macieira
f8b5142e30 Fix race condition in tst_QDBusConnection::pendingCallWhenDisconnected
The test sent a message and hoped that the "delete server" would cause
the server object in the QDBusConnectionManager thread be deleted before
it could receive and process the message. That's racy, because on some
CI machines, it did and then sent back an error reply indicating the
object sought was not found.

Instead, let's use a child process that we can kill to make it exit at
the right time.

I've chosen to use dbus-daemon itself, because that lets us test the
actual conditions that triggered the original bug: the daemon getting
killed during a desktop session shutdown on Linux.

Change-Id: I87e17314d8b24ae983b1fffd1454483aea87c921
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2016-06-06 11:39:53 +00:00
Friedemann Kleint
95f1f6f719 tst_QTemporaryFile: Run in temporary directory.
The test leaks a file (named qt_...xxx) in QDir::tempPath(). Moreover,
when tests fail, it can happen that more files are leaked and subsequent
runs do not recover since the check for non-existence of those files fails.

Change-Id: Iaea6d09ee7c271903a1b9c63e263c19f9e90bba9
Reviewed-by: David Faure <david.faure@kdab.com>
2016-06-04 18:48:52 +00:00
Friedemann Kleint
23bed9f820 Remove tst_QWidget::immediateRepaintAfterShow().
It tested whether a paint event was received when calling QWidget::repaint()
right after QWidget::show() without waiting for the window to be exposed.

This caused a QEvent::UpdateRequest to be sent, which ended up in
QWidgetBackingStore::sync() which returns after checking
QWidgetBackingStore::discardSyncRequest(), since Qt::WA_Mapped is not set
on the non-exposed widget.

The test passed on Windows since it contains one call to
QCoreApplication::processEvents() which causes the the initial WM_PAINT
message to be processed in QWindowsWindow::handleWmPaint() which calls
QWindowSystemInterface::flushWindowSystemEvents() and causes Qt::WA_Mapped
to be set. This seems counter to the intention of the test.

Remove the test since it won't pass anymore in Qt 5 unless Qt::WA_Mapped is set.

Task-number: QTBUG-26424
Task-number: QTBUG-38327
Task-number: QTBUG-39842
Change-Id: Iede026d52825dcf1f2e9014a316d26d260309214
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-06-04 18:47:54 +00:00
Morten Johan Sørvig
22667483e1 Blacklist modalDialogClosingOneOfTwoModal on OS X
Passes locally (on 10.10), but seems to have become
unstable on the CI system.

Task-number: QTBUG-53790
Change-Id: I0432fca4121b97bcdd6cec529fc4e148dfb8c1ab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-04 18:36:04 +00:00