Commit Graph

3197 Commits

Author SHA1 Message Date
Liang Qi
555a6b5d5d Modernize the "filesystemwatcher" feature
Change-Id: If030b56ad97e047d89d442629262b4839df306d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-09-27 08:18:55 +00:00
Edward Welbourne
bd42e2f0ce Blacklist two tests on macOS that a planned CI change shall break
We have #if-ery on Q_OS_DARWIN controlling an expectation of gettign
"GMT+1" and "GMT+2" instead of "CET" and "CEST" in two tests; this
turns out to not be a deficiency of macOS so much as of how we
configure Coin's VMs.  While we fix that, we need to ignore failures
in these tests, so that we can pull the #if-ery out and clear the
blacklist once the VMs are set up properly.

Task-number: QTBUG-70149
Change-Id: If3577200cf980b3329161ab3eea7bd2e9d0124e0
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2018-08-24 17:30:01 +00:00
Edward Welbourne
dc7e775c9c Test for fractional part of Costa Rican currency
CLDR up to somewhere between v29 (used by 5.9) and v31.0.1 (used by
5.10 and later) claimed Costa Ricans don't include fractions in their
currency; now it claims they expec two digits.  Apparently one of them
does expect those digits, so this is the regression test I'll be
cherry-picking back to LTS, to accompany the CLDR updates they need.

Task-number: QTBUG-70093
Change-Id: I138772cc6013fa74de4f7c54b836cac83421eab2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-08-23 12:54:53 +00:00
Luca Beldi
02b3d43fd4 _q_interpolate<T> is unsafe with unsigned template arguments
_q_interpolate<T> subtracts 2 arguments of type T,
for unsigned types this can cause wrapping around

Task-number: QTBUG-57925
Change-Id: Iffa59f413579a3d5de8cb728fe71443d8e8a04aa
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2018-08-22 08:38:44 +00:00
Luca Beldi
70ba75519d QSortFilterProxyModel inserting at bottom of source model
Before this change, if you try to insert a row at the bottom of QSortFilterProxyModel
the row will be inserted in the source model at position proxy->rowCount rather
than at the bottom. This causes insert at apparently random positions in the source.

[ChangeLog][QtCore][QSortFilterProxyModel]
QSortFilterProxyModel::insertRows(row,count,parent) with
row == QSortFilterProxyModel::rowCount will insert at the bottom of the source model
rather than at the row QSortFilterProxyModel::rowCount of the source model

Task-number: QTBUG-58499
Task-number: QTBUG-69158
Change-Id: Ie78416c8fbc429303b8c9c98375630e3e4d85f6d
Reviewed-by: David Faure <david.faure@kdab.com>
2018-08-17 08:10:11 +00:00
Thiago Macieira
b0479aab29 QUrl: Make sure we do reject URLs for which IDNA nameprep failed
qt_nameprep() already reset the string to its original length to
indicate failure, but we didn't handle that in qt_ACE_do(). So make it
have a return value whcih makes it easier to handle that case and do
handle it.

[ChangeLog][QtCore][QUrl] Fixed a bug that caused URLs whose hostnames
contained unassigned or prohibited Unicode codepoints to report
isValid() = true, despite clearing the hostname.

Change-Id: I41e7b3bced5944239f41fffd1545b7274c4b419d
Reviewed-by: David Faure <david.faure@kdab.com>
2018-08-16 19:34:52 +00:00
Thiago Macieira
64a560d977 QObject: do allow setProperty() to change the type of the property
[ChangeLog][QtCore][QObject] Fixed a bug in setProperty() that caused a
property change not to take effect if the old value compared equal using
QVariant's equality operator, but the values were not strictly equal.

Task-number: QTBUG-69744
Change-Id: I00e04a465fcf4fc1a462fffd1547885861a07a64
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-08-04 15:46:02 +00:00
Joerg Bornemann
f0ff73f631 QProcess::startDetached: Fix behavior change on Windows
Do not overwrite stdout/stderr by default, but only if requested.
This restores the behavior of QProcess::startDetached of Qt 5.9.

Task-number: QTBUG-67905
Change-Id: Idccf7b0da7bd80f88a0624286ddf2851bc974fb1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-08-03 08:09:30 +00:00
Jüri Valdmann
f43e947dc4 QJsonDocument: Make emptyObject an object
A default-constructed QJsonObject has no data payload, it is only a pair of null
pointers. So, when it becomes necessary to 'materialize' such an object, a
special global emptyObject constant is used as the substitute payload. There is
a small problem with this global constant though, namely that it's is_object
flag is unset. In other words, the emptyObject is not an object, but an array.

Fix by setting the is_object flag on emptyObject.

The example code in the bug report

    QJsonObject parent;
    QJsonObject child;
    parent["child"] = child;              // 1
    child = parent["child"].toObject();   // 2
    child["test"] = "test";               // 3

runs into this problem on line 1. Inserting the default-constructed child means
inserting a copy of emptyObject. On line 2 a pointer to this copy of emptyObject
is retrieved and cast to an object. But it's not an object, it's an array, so
things go wrong hereafter.

Specifically, on line 3, two inserts are performed, one from operator[] and one
from operator=. Each insert increments a compaction counter. The second insert
triggers compaction (QJsonObject::insert calls Value::requiredStorage calls
Data::compact) and compaction branches based on the is_object flag. Replacing
line 3 with

    child.insert("test", "test");

causes the example to appear to work since compaction is not triggered and the
JSON serializer does not look at the is_object flag. Still, any further insert()
calls would trigger compaction and memory corruption.

Task-number: QTBUG-69626
Change-Id: I8bd5174dce95998bac479c4b4ffea70bca1a4d04
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-07-31 09:33:42 +00:00
David Faure
ce4407c327 QSFPM unittest: check dataChanged and layoutChanged signals
I'm not sure why QSFPM purposefully emits dataChanged for a source
dataChanged that triggers a layoutChanged (i.e. due to sorting, multiple
rows are moving around). (This predates the git import in Qt 4.5.)
Surely whoever is listening will not gain much from the "small" dataChanged
after the "big" layoutChanged... anyhow, this documents the current behavior,
at least.
It also proves that the bug I saw long ago (changing a filtered-out
value used to emit dataChanged(invalid, invalid), IIRC) is no longer present.

Change-Id: I8975c549db88226b2b3393de9f8dca4f4109df15
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2018-07-28 12:26:41 +00:00
Oliver Wolff
2e88340ad2 tst_qpluginloader: Fix preprocessor condition
Change-Id: Icb7767cb6b0e091a21196518d3908a810970592a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-07-27 04:48:30 +00:00
Edward Welbourne
0b688e2955 Check against copying the husk left by a move
The copy-assign operator tests against other.d being NULL but the
copy-constructor didn't.  This can only matter if the value being
copied has been moved from, so we could probably replace with an
assertion in practice, but we should at least be consistent.

Amended test to check this case too; and verified new test crashes
without this fix.

Change-Id: I46872a677775944bbdf6a9112e719873e574ae60
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-07-26 16:35:59 +00:00
Oliver Wolff
a5d8f00b3b tst_qplugin: Re-enable loadReleasePlugin test case
Change-Id: I678a8748ac757ae2918dd80e4a6d802d7de7b0b0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-07-26 14:26:42 +00:00
Oliver Wolff
b6597c8b7b Skip qplugin auto test for static configurations
All test cases use QPluginLoader which will not work for static builds of
Qt.

Change-Id: I7dcddcd5213681bd3ae4cd85e49ee0bb5748f687
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-07-26 14:26:36 +00:00
Thiago Macieira
9a04453b50 Fix the fix for mmap() overflow check
The code I introduced in 4ee7425794 only
dealt with systems that reasonably used a 64-bit off_t parameter. Turns
out that we don't turn on largefile support on 32-bit Android, which
meant that the fix caused a regression.

[ChangeLog][QtCore][QFile] Fixed a regression that caused QFile::map()
to succeed or produce incorrect results when trying to map a file at an
offset beyond 4 GB on 32-bit Android systems and on some special Linux
configurations.

Task-number: QTBUG-69148
Change-Id: I2c133120577fa12a32d444488bac3e341966f8d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-07-25 12:40:04 +00:00
Edward Welbourne
27f1f84c1c Let QDir::absoluteFilePath() use isAbsolutePath() for resource paths
Using QFileSystemEntry::isAbsolute() broke handling of resource paths.
Extended QDir::absoluteFilePath() tests to cover absolute resource path
and some UNC variants also resolved in the same fix.
Amend existing filePath tests to use drives where needed.

Task-number: QTBUG-68337
Change-Id: I4f02cf67828ad93e562857118f8442037f18bab7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-07-23 14:28:38 +00:00
Thiago Macieira
8a5267e4d9 Plugins: fix crash if the binary JSON data contains invalid size
Eight bytes into the Binary JSON header there's a 32-bit little-endian
size, which qJsonFromRawLibraryMetaData uses to determine the size of
the stored metadata. That value is passed as a size to QByteArray, which
means certain values could cause crashes due to being too big or via
sign-extension in 64-bit.

[ChangeLog][QtCore][QPluginLoader] Fixed an issue that could cause a
crash when certain damaged or corrupt plugin files were scanned.

Change-Id: I117816bf0f5e469b8d34fffd153dc5425cec39a7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-07-19 07:27:02 +00:00
Thiago Macieira
1f27c1161b QPluginLoader: limit the amount of memory used when scanning plugins
When using actual memory allocation, limit to 64 MB, not the full file
size. On most systems, the memory map technique will work, so this won't
even be tried. In any case, we don't need the fix for the OOM situation
that was applied in commit e211ab76d7.

As for the memory mapping technique, this commit limits the allocation
to reasonable values given the virtual memory addressing space. Half a
gigabyte is probably acceptable on 32-bit systems, where there should be
a contiguous space for the OS to allocate the file in. This commit also
fixes an overflow when converting from qint64 of the file size to ulong
(32-bit on 32-bit platforms and on Windows).

For 64-bit systems, we currently limit to 1 TB.

Change-Id: I117816bf0f5e469b8d34fffd153dc1705a8eedc4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-07-14 04:37:46 +00:00
Allan Sandfeld Jensen
ad8df72156 Fix regression in QPointF::operator==
Handle hard zero independently in each coordinate, otherwise hard zero
is never equal to anything but itself.

Task-number: QTBUG-69368
Change-Id: I8b1131472bb92efc706a04e0b067e2211a5ccb0c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-07-09 15:38:31 +00:00
Edward Welbourne
9fc6b021f9 Fix a mis-use of QSKIP() to use qDebug() instead
QSKIP() discards the whole test it appears in; so is not the right way
to announce that (and why) the test has just skipped a few sub-tests.
This was concealing a later failure on macOS, here fixed.

Change-Id: I9b07208413b9e101569a22505ad41f07ade4062b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-07-04 07:07:04 +00:00
Edward Welbourne
64d6b82bf7 Fix tst_QLocale's mis-use of QSKIP() to use qDebug() instead
QSKIP() discards the whole test it appears in; so is not the right way
to announce that (and why) the test has just skipped a few sub-tests.
This was concealing a later failure on macOS, here fixed.
This matches an earlier fix for tst_QDateTime.

Change-Id: Idaf34a9d60d84202fd41d15455209457cc281f60
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-07-04 07:06:53 +00:00
Mårten Nordheim
6501c04250 Android: Pass tst_QFactoryLoader
Similar to the changes made for tst_QLibrary:
0ac09c40f2
but even less intrusive.

Change-Id: I4bc0ba385e639f07f9b39cf8ba9542c27be8a3ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-30 19:32:51 +00:00
Daniel Vrátil
35e005bc4f Fix metatype trait for types that are both QObject and Q_GADGET
Fixes ambiguous template instantiation for types that derive from both
a QObject and Q_GADGET. For such types we treat them only as QObjects
as they extend the functionality of the gadget.

Task-number: QTBUG-68803
Change-Id: Ic42766034e14e5df43c4e6f7811e2c0be1dc7e74
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-06-30 13:23:03 +00:00
Mårten Nordheim
0ac09c40f2 Android: Pass tst_qlibrary
To make the minimum amount of changes:
- Extract the library files into the expected hierarchy.
- Introduce a variable with the path to the directory.
- Make the static function a member function so it can use the variable

Change-Id: Ibf3106c3606d198a8deb8cb2a5cbde57207221c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-29 19:02:09 +00:00
Mårten Nordheim
8757e6fee1 Android: Make tst_qfile pass
By disabling the "stdinprocess"-related tests/code...

... but differently. After fixing my earlier mistakes I'm getting
segmentation faults when it executes a couple different library calls
after the QProcess object has started.

Task-number: QTBUG-68596
Change-Id: Id42a1f939c000754a187dee90c4a4cdfec816232
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-06-28 07:31:27 +00:00
Mårten Nordheim
d420987d54 Android: fix tst_qlogging
The "app" subfolder was already excluded in the .pro-file but Android
supports QProcess, so lets include it in the build. Unfortunately it
currently has trouble and crashes (the child process or both processes).
So we skip those tests.

Task-number: QTBUG-68596
Change-Id: I2e6d0869c408bf08b22c02145db8ce522c64c617
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-06-28 07:29:30 +00:00
Mårten Nordheim
568ee7da5a Android: Pass tst_qlocale
To make it run we make sure it finds the syslocaleapp, however since it
causes a crash we skip the test that uses it...

"formatTimeZone" was failing, but it is the exact same issue as in
e08ba34f26, so we solve it the exact same
way.

Change-Id: Ifd5c796735775dad94acf55210cf18c0f4d375ca
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-06-28 07:27:22 +00:00
Mårten Nordheim
6ee26c543e Android: Pass tst_QUuid
Same issue as has been seen a few other places: path to executable being
wrong, and then a crash when the paths are fixed.

Change-Id: I77a596c6e52d2a02a69a6b9dfe91f878b3ffe07c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-28 07:12:47 +00:00
David Faure
8a73085a0d QSortFilterProxyModel unittest: add test for filtered-out-after-setData
The row names for this test were very unspecific.
After reverse-engineering what they are testing, I gave them proper
descriptive names, which allowed me to notice that there were tests
for "filtered in after sourceModel->setData" but not for
"filtered out after sourceModel->setData".

Change-Id: Ib79108db803ae77fb65d29cf0c0ef96c26655980
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2018-06-28 07:00:00 +00:00
Mårten Nordheim
7995540292 tst_qthreadpool: Skip "stackSize" if unsupported
If you're on a Unix platform which don't have the necessary defines then
the thread will never be launched due to an error. Skip the test
instead.

Change-Id: I83159988b8f330a750c7aa328a8805e4fa478070
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-06-27 17:40:28 +00:00
David Faure
27ea5a65dd QAbstractItemModelTester: fix out-of-bounds index() calls
When removing rows, the tester is looking at the data of the row
"just before" and the row "just after" the removed rows, to see if
they are still the same at the end of the removal operation.
Guard this with bounds check, in case there is no row just before
or just after.

This is the opportunity to use modeltester in tst_qidentityproxymodel,
which was already a testcase for removing the only row in a given parent.

Change-Id: Iec8228c16b9c670b794e2665356d153679178494
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2018-06-27 10:11:35 +00:00
Mårten Nordheim
3079b3433d Android: tst_qtimezone: Blacklist a bunch
Task-number: QTBUG-69122
Task-number: QTBUG-69128
Task-number: QTBUG-69129
Task-number: QTBUG-69131
Change-Id: Ida626a6675764e9554785b5e56cfba3ab7206f17
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2018-06-27 07:52:26 +00:00
Mårten Nordheim
da82bfd823 Android: tst_QTimeZone::transitionEachZone: skip 2 zones
When testing zones "America/Mazatlan" and "Mexico/BajaSur" the test
crashes from an assert. Skip testing the zones for now.

Task-number: QTBUG-69132
Change-Id: I595089647792e9a2c094d63cb837584b8cdc9cb9
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2018-06-27 07:52:10 +00:00
Edward Welbourne
cffa010d42 Kludge round Android's ignorance of some esoteric time-zone transitions
Skip a few tests that Android's time-zone information doesn't suffice
to get right.

Task-number: QTBUG-68835
Change-Id: Ibf8d213c96b29d74fc478a0ede686ae52b5200fb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-26 08:05:17 +00:00
Kari Oikarinen
1049d3f9db tst_QTimer: Replace unconditional qWait()s with QSignalSpy
Where possible. Sometimes the replacement is QTRY_COMPARE instead.

Also don't use QTestEventLoop directly when it can also be replaced with
QSignalSpy use.

Remove the TimerHelper class, since its uses can be done with QSignalSpy (and a
lambda when remainingTime is checked). Although checking static single-shot
timers still needs a target object, so use a stripped down version in those
tests.

remainingTimeDuringActivation() was not actually testing the repeating case, but
single-shot case twice, so fix that. In the repeating case the remaining time is
exactly 20 ms on my machine, but QEMU emulation seems to be slow enough for time
to advance before the lambda is executed, so relax the conditions.

Task-number: QTBUG-63992
Change-Id: Iae92ff7862a13d36e695eec63b54403ec872f2b4
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-06-26 05:51:15 +00:00
Liang Qi
c3059391fe Make tests compile for Android
This only enables compilation, it doesn't fix any test.

Qt on Android supports process, but not TEST_HELPER_INSTALLS. See also
acdd57cb for winrt.

android-ndk-r10e is used to compile, see
http://doc-snapshots.qt.io/qt5-5.11/androidgs.html .

corelib/io/{qdir,qresourceengine} need to be fixed later.

Done-with: Frederik Gladhorn <frederik.gladhorn@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Change-Id: I34b924c8ae5d46d6835b8f0a6606450920f4423b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-06-25 08:01:19 +00:00
Mårten Nordheim
06996e1d0e Android: fix qdiriterator test
... by adding a prefix to the resource.

On android there is a resource ("qpdf") which gets included in the root
in all applications, included from "src/gui/painting/painting.pri".
So we move the test data to a sub-folder.

Task-number: QTBUG-68596
Change-Id: I67f2ed79a32c68d9a76cafba8ef23fe0da7c0fe8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-21 14:14:45 +00:00
Mårten Nordheim
06044df0e3 Android: tst_qthread: terminate is not supported
"terminate" and "terminated" both fail on Android since
QThread::terminate not supported on Android. So we should skip them.

Task-number: QTBUG-68596
Change-Id: Id0d1dde2cfa02bb2978e5dd16087bf8f3bf112b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-21 14:14:27 +00:00
Edward Welbourne
9f8938b89a Cope if mktime() deems times in a spring forward gap to be invalid
In tst_QDateTime::springForward(), we test correct handling of times
in the gap; these are formally invalid and a mktime() implementation
may reasonably reject them causing our date-time code to produce an
invalid result.  So handle that case gracefully in the tests, only
insisting on consistency between the two ways of preparing the date.
In one test, package the repeated code I was going to adapt into a
macro to save repeitition.

Task-number: QTBUG-68832
Task-number: QTBUG-68839
Change-Id: Ib8a16ff007f4e75ab2ccff05b1ccf00a45e50dc8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-06-21 10:40:43 +00:00
Edward Welbourne
b248a35a09 Add Android to exceptions in tst_QDateTime::toString_textDate_extra()
Android doesn't use the proper zone-abbreviation, so just check it
starts with the right date-time.  Revised the way the #if-ery for that
is handled, to avoid repetition of the (now more complex) condition in
the two tests affected.

Task-number: QTBUG-68833
Change-Id: Iceb5469f46c69ba5cdbaf7ca050ad70f2bb74f44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-21 10:40:36 +00:00
Edward Welbourne
e08ba34f26 Cope with Android's lack of time-zone abbreviations
Have a test expect what it does produce rather than fail what we can't
fix.

Task-number: QTBUG-68837
Change-Id: Icda7bd9968682daf97d46d597f8bb0433560cde2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-21 10:38:09 +00:00
Edward Welbourne
67bbe59a37 Make some QEXPECT_FAIL()s consistent in form and content
They used different messages for the same excuse, which weren't well
worded in any case; and their #if-ery was differently decorated.

Change-Id: I28f5032693aff1036cb086ac4032c669110a5cb5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-06-21 10:37:56 +00:00
Edward Welbourne
91f3687ee5 Make QString's formatting of doubles be consistent with other places
QString::sprintf(), like the C printf-family, always includes two
digits in any exponent it outputs.  Up to 5.6, number() and arg()
taking a double did the same; but changes at 5.7 to enable opting out
of the leading zero this implies for a single-digit exponent
accidentally opted out of it in args() and number().  This commit
fixes number() and arg() to include QLocaleData::ZeroPadExponent in
the flags they pass down to the C locale's doubleToString(), restoring
the prior behavior, including consistency with sprintf().

[ChangeLog][QtCore][QString] Formatting of doubles with single-digit
exponent, by number() or args(), now includes a leading zero in that
exponent, consistently with sprintf(), as it did up to 5.6.

Task-number: QTBUG-63620
Change-Id: I10c491902b8556e9f19e605177ead8d9fd32abd9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-06-14 09:13:36 +00:00
Allan Sandfeld Jensen
d517d5428c Use qFuzzyCompare instead of qFuzzyIsNull in QPointF ==
qFuzzyIsNull has a fixed range, where qFuzzyCompare can tell if numbers
are different in a more relative range. Without it QPointFs that are
heavily scaled will be interpreted as identical, when they are quite
different at their own scale.

Task-number: QTBUG-60359
Task-number: QTBUG-62161
Change-Id: Ic4ba90e9e994aedff5548d690f053eb309b0a60b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-30 08:28:11 +00:00
Mikhail Svetkin
6b98d97670 macOS: Fix QFileSystemWatcher to watch paths with the same prefix
It happens because our filesystemwatcher thinks it is subdirectory and not
two different paths

Task-number: QTBUG-60676
Change-Id: Ic753e9481cb26303a030044e0a5ab4d703bc529f
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2018-05-29 06:32:46 +00:00
Christian Ehrlicher
e15fc26e9f QSortFilterProxyModel: don't assert when old model gets destroyed
When a new model was set with setSourceModel() and the mapping was
built up, the destruction of the old model caused a reset in the
QSortFilterProxyModel which lead to an empty view or an assertion.
Now we properly disconnect the old model again and also clean up the old
mapping/persistent indexes when a new source model is set.

Task-number: QTBUG-44962
Task-number: QTBUG-67948
Task-number: QTBUG-68427
Change-Id: I2e0612899c210bde3ac0cfa59aefd78269deee5b
Reviewed-by: David Faure <david.faure@kdab.com>
2018-05-26 11:24:53 +00:00
Thiago Macieira
c359df5ca6 Add support for QSharedPointer<cv qualified>::create()
[ChangeLog][QtCore][QSharedPointer] Fixed a problem that made create()
on a type with const qualification fail to compile.

Task-number: QTBUG-68300
Change-Id: I0825ff5b5f6f4c85939ffffd152f3e55e5b9caae
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-05-17 15:08:04 +00:00
Kari Oikarinen
2fc274ddb5 Skip tst_QProcess::processesInMultipleThreads under QEMU
tst_QProcess hangs sometimes in QEMU. Based on my experiments in a debug VM the
offending test seems to be processesInMultipleThreads(), since that was were I
was able to reproduce the hanging in.

Since the whole test executable hangs, blacklisting is not enough, so skip the
test.

Task-number: QTBUG-67760
Change-Id: I34f8852be955a8612deac22b369f68d79a139d11
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-05-14 12:36:33 +00:00
Jüri Valdmann
8e47474baf QJsonDocument: Avoid overflow of string lengths
The added test case contains the binary JSON equivalent of

    ["ž"]

with the modification that the string's length has been set to INT_MAX. In
Value::usedStorage this length is used through the pointer d like so

    s = sizeof(int) + sizeof(ushort) * qFromLittleEndian(*(int *)d);

Because 2 * INT_MAX is UINT_MAX-1, the expression as a whole evaluates to 2,
which is considered a valid storage size. However, when converting this binary
JSON into ordinary JSON we will attempt to construct a QString of length
INT_MAX.

Fixed by using String::isValid instead of Value::usedStorage. This method
already takes care to avoid the overflow problem. Additionally, I've tried in
this patch to clarify the behavior of Value::isValid a bit by writing it in a
style that is hopefully more amenable to structural induction.

Finally, the test case added in my previous patch had the wrong file extension
and is renamed in this one.

Task-number: QTBUG-61969
Change-Id: I45d891f2467a71d8d105822ef7eb1a73c3efa67a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-14 10:52:47 +00:00
Oliver Wolff
da97dcec3e tst_qresourceengine: Fix test for static MSVC builds
The test relies on the existence of qt-project.org in resources. It
contains mimetype data and is automatically added. For static builds on
MSVC it is only added if it is actually needed though.

Change-Id: Icd1d74466607196f9b635205f7cb4d9b300ec4b8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-05-07 07:59:15 +00:00