Commit Graph

7215 Commits

Author SHA1 Message Date
Friedemann Kleint
737383875e Blacklist tst_QTimer::remainingTime() on Windows and macOS
Task-number: QTBUG-58519
Change-Id: Ib03aa0bdeaa9ed0dc2f0d92aa11d07ffcdc2bc26
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-14 13:30:12 +00:00
Milla Pohjanheimo
c6792bcb95 Binary compatibility files for QtBase (5.8.0)
Added BC files for QtBase for Qt 5.8.0

Change-Id: I36d5453b8cfb5d34511a9b6196d4dc83d5c9f9f6
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2017-02-14 12:42:20 +00:00
Marc Mutz
10ecbc4041 Blacklist tst_QWaitCondition::wakeOne() on Windows
This test was determined to be flaky on the CI.

Task-number: QTBUG-58741
Change-Id: I43196d3a27f726fb96b427f5071e726b571a0404
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-14 06:51:52 +00:00
Filipe Azevedo
9db8c171e7 Fix QLibrary::isLibrary on Apple platforms
Add proper support for 'so' and 'bundle' suffixes.  Qt wrongly assumes
.so libraries are not versioned on Apple platforms, which is
wrong. Also, the shared library .bundle which is what Apple recommends
instead of .so, are also versioned (not to be confound with the
different Core Foundation bundles, which are directory hierarchy).

For more info, see http://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm.
Especially the part that reads:

"Loadable modules, called bundles in Mac OS X, have the file type
MH_BUNDLE. Most Unix-based software ports usually produce bundles with a
.so extension, for the sake of consistency across platforms. Although
Apple recommends giving bundles a .bundle extension, it isn't
mandatory."

Task-number: QTBUG-50446
Change-Id: Iacd5136397a12d65d83821434f332eb602550b4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-12 18:25:42 +00:00
Thiago Macieira
b1b53b7101 Revert "Add tests for QCollatorSortKey"
This reverts commit b0c1e07d64.
The unit tests it introduced trigger errors with the macOS and
Win32 implementations, which means the there's something seriously
wrong with either the API, our implementation or the tests.

Revert for now until this gets fixed. Blacklisting was also the
wrong tool to use. The tests should have used QEXPECT_FAIL.

Change-Id: Ida20c6bbe0c019835a22464535029585e8e1e367
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-12 08:15:48 +00:00
Marc Mutz
b0c1e07d64 Add tests for QCollatorSortKey
There weren't any, at all.

Testing on the CI showed that the implementation is broken on
macOS, and, to a lesser extent, on Windows, so blacklist the
failing tests until the implementation can be fixed. No need
to hold back testing the other implementations.

Task-number: QTBUG-58737
Change-Id: I9ae16ab778dbe2e95a6ca5e0bae00df4bad65cb2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-11 07:37:22 +00:00
Alex Trotsenko
6e8fcab7e0 Improve QIODevice::peek() performance on buffered devices
Since 5.7, QIODevice::peek() implementation is based on transaction
mechanism. While technically it's correct, seeking backward on a
buffered random-access device clears the internal buffer that affects
the performance of reading.

To solve the problem, this patch implements peek mode directly inside
the reading procedure.

Task-number: QTBUG-56032
Change-Id: Ic5269f76e44c491a0309e13aba87fa7cf7b9259f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-09 18:46:24 +00:00
Marc Mutz
0f2638c994 Blacklist tst_QElapsedTimer::elapsed() on Windows
This test was determined to be flaky on the CI.

Task-number: QTBUG-58713
Change-Id: Ie6e6a69b8ea625e3a3102c88d52f1f0fbec242aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-09 10:01:08 +00:00
Marc Mutz
626a4d89c2 QFormLayout: take the correct row in takeRow()
I didn't even try to understand what the old code was trying to do;
once you're told by a user that the code is wrong, you see that it is.

Fixed by just using the row as passed to takeRow() instead of trying
to do some storage-index calculations. The m_matrix indexing operator
does it all for us.

Added a test that checks that the expected field widget gets
returned. Fixed expected test data that was wrong, and just checking
that the implementation behaves as implemented, instead of as
documented.

Amends change 8fbae648db.

[ChangeLog][QtWidget][QFormLayout] The functions takeRow() and
removeRow(), new in 5.8.0, now take and remove the correct row.

Task-number: QTBUG-58693
Task-number: QTBUG-15990
Change-Id: I7185ccbc6c03e2579741cad5c0c821d3ed165474
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-02-08 11:01:31 +00:00
Marc Mutz
9e5e30fa13 QStringMatcher: fix setCaseSensitivity() on a non-QString-backed matcher
When a non-QString-backed mode (via the (QChar*, int) ctor) was added
for Qt 4.5, the author forgot to adjust the setCaseSensitivity()
function.  It still uses q_pattern instead of (p.uc, p.len) as the
pattern for which to create the skip-table. Since there is no
setPattern() overload for this mode, the correctness of the matcher is
not harmed by this, but its performance degrades to that of a linear
scan: the skip-table, being filled from an empty pattern, will be
all-zeros, sending bm_find() into the 'possible match' case at every
character.

Since matching is still correct, but slow, it's not possible to write
a test for this. I did, however, leave my attempts in the auto-test,
for when we add QStringView overloads of setPattern() which will then
be able to expose the bug.

Change-Id: I7b803e8624b0352a0a974900affbbfc0c260d93b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-07 16:31:00 +00:00
Samuel Gaist
8b1d9d308b Fix result handling in QDialog::done
The setData method of an item view would get an incorrect value of a
QDialog's result. This patch changes the order of functions called to
fix that.

[ChangeLog][QtWidgets][QDialog] Fixed a bug where accessing the result
of QDialog's result could yield an incorrect value in some situation
like using it as a delegate for item views.

Task-number: QTBUG-6018
Task-number: QTBUG-12156
Task-number: QTBUG-14430
Change-Id: I6ee4b6e8cacf6a806631c05c6c5dbcff925df65e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-07 09:09:42 +00:00
Marc Mutz
c876bb1f13 QInputDialog: prevent crash in static get*() functions when parent gets deleted
As explained in

   https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0

creating dialogs on the stack is a bad idea if the
application or the dialog's parent window can be closed
by means other than user interaction (such as a timer or
an IPC call). Since we cannot know whether Qt is used to
build such an application, we must assume it is, create
the dialog on the heap, and monitor its lifetime with a
QPointer.

Instead of using manual resource management, add a
minimal implementation of QAutoPointer, and use that in
all static get*() functions.

Task-number: QTBUG-54693
Change-Id: I6157dca18608e02be1ea2c2defbc31641defc9d1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-06 14:41:46 +00:00
Aleksey Lysenko
f53ab9d736 Reset QFileDevicePrivate::cachedSize on file close
When a QFile object is reused, the atEnd() method may return incorrect
values. The reason for this is that QFileDevicePrivate::cachedSize is
not cleared. Setting cachedSize = 0 in the close() method fixes this issue.

Task-number: QTBUG-57698
Change-Id: I828a2cf844e98d581098f2c781fa47d2cd3275ce
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-06 07:36:24 +00:00
Thiago Macieira
239418a947 Use a precise timer in tst_QTimer::remainingTime
At 200 ms, the error on first firing could be 10 ms.

Task-number: QTBUG-58519
Change-Id: Ifaee7464122d402991b6fffd14a02a4ce782f11f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-02-05 18:19:51 +00:00
Thierry Bastian
b8dbde10a0 Fix data corruption when reading byte arrays from QSettings
On macOS, the code that read the plist is using
QByteArray::fromRawCFData. When we return the data directly
we need to detach the QByteArray so that it does not point
CFData's data that will get deallocated just after the call.

Task-number: QTBUG-58531
Change-Id: If829a304b986c99c8fc2aeeb992f2d539a4eef3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-02-03 15:37:58 +00:00
David Faure
61371f0321 tst_qurl: add test for fromUserInput(3 args) using "." as working dir
As used in recent qtdeclarative commits, so better make sure it keeps working.

Change-Id: I6d0ceda76201e3e7f75661cb6449e1ff32329126
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-02 12:12:58 +00:00
Thiago Macieira
14f0964344 QVariant: don't do fuzzy comparisons with NaN and infinities
There was a test that tested this, but was wrong.

[ChangeLog][QtCore][QVariant] Fixed a bug that caused wrong results for
comparisons of QVariants containing either NaN or infinite numbers.

Task-number: QTBUG-56073
Change-Id: I33dc971f005a4848bb8ffffd1475d29d00dd1b7f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-31 19:09:28 +00:00
Friedemann Kleint
41e4b4de91 QtGui/painting benchmark test: Fix Clang warning about uninitialized value
benchmarktests.h:323:18: warning: field 'm_as_pixmap' is uninitialized when used here [-Wuninitialized]
benchmarktests.h:371:18: warning: field 'm_as_pixmap' is uninitialized when used here [-Wuninitialized]
benchmarktests.h:417:18: warning: field 'm_as_pixmap' is uninitialized when used here [-Wuninitialized]

Change-Id: Ica496e3baa19e0701c64222ce8ab92ec94178db7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-01-31 08:37:56 +00:00
Thiago Macieira
e2c0d1ea2e Read the .ini file back in text mode
Because on Windows, the .ini files are saved with CRLF, but the files in
the Qt resource are just LF (.gitattributes makes them so).

Task-number: QTBUG-25446
Change-Id: I5eab0d9620bd1ba675b0a87c554f62cef0f98fcc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-31 06:03:39 +00:00
Eskil Abrahamsen Blomfeldt
8d752b5151 Accept all formatting characters as valid input
Amends 7896ae052a. The previous change
focused only on ZWJ and ZWNJ, but there are many other formatting characters
that we need to support and that may be rejected by the German keyboard-hack.
This opens up for all characters in the Other_Format category.

Task-number: QTBUG-58364
Change-Id: Idd967a9ae5b12060c851f6030b7e019508561696
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-26 10:59:49 +00:00
Marc Mutz
940d667eb4 Plug leaks in tests/auto/dbus
In tst_QDBusMetaObject::types(), hold a QMetaObject obtained from
QDBusMetaObject::createMetaObject() in a QScopedPointer instead of
leaking it. Use correct return value type.

This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/dbus.

Change-Id: I1df7f8e42d45f40ecf381fe7b684a8ab5ebee675
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-26 10:33:28 +00:00
Marc Mutz
e15cb86b3b Plug remaining memleaks in tests/auto/widgets/itemviews
... on Linux AMD64 builds.

Pass QObject parents to QObjects otherwise leaked.

Change-Id: Ia4f0ad2fdc4ef62a3d35a2cfca74965f79692da3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-26 10:32:51 +00:00
Marc Mutz
e4b19bfb94 Plug memleaks in tst_QHeaderView
The char* returned from QTest::toString() calls must be manually
delete[]ed.

Change-Id: Iad078e8741e3e97693b1a417693f414b3fb3ec09
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-26 10:32:45 +00:00
Marc Mutz
7e6e920633 Plug memleaks in tst_QTreeView
Forgot to delete QAIMs without parent.

Change-Id: I9c914e841123ee250fb977c45a84870463288d9b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-26 10:32:35 +00:00
Marc Mutz
9064d0b8a8 tst_QTreeWidget: plug memleaks
Taken QTreeWidgetItems need to be deleted, as do items
created without a parent, and widgets without parent.

Change-Id: I7ffa69903af9a1b92ba308f9f9416aec1d6d975f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-26 10:32:30 +00:00
Marc Mutz
1f814caca3 Plug memleaks in tst_QAbstractItemView
Styles need to be deleted manually...

Change-Id: Ic4193d22a57801127e994062cade7cb9ef6f34d8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-26 10:31:46 +00:00
Allan Sandfeld Jensen
f823af43f2 QVariant of nullptr should always be null
Implements isNull for QVariants of a nullptr so they always return
true to isNull(), instead of depending on how they were constructed.

Task-number: QTBUG-58296
Change-Id: Ibddec795cdadedef7e17d22c265c29e752d8f99f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-25 17:05:18 +00:00
Allan Sandfeld Jensen
374a173d14 Improve QTest::qWait() precision and switch to QDeadlineTimer
Do not wait up to the timeout ms after already having waited several
times. At the same time upgrade to using the QDeadlineTimer which
is designed for this purpose.

Change-Id: Iaf5e4f4655605d5143ce91040c6eb6706752e504
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-25 16:40:57 +00:00
Friedemann Kleint
a8a74fe81a Stabilize tst_QPropertyAnimation::noStartValue()
Remove the qWait() and introduce a QTRY_COMPARE()
checking for the end value first.

Task-number: QTBUG-58402
Change-Id: I2d3758178de5f67881008f28c406076ad27c4a90
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-01-25 11:36:41 +00:00
Oleg Yadrov
59780d132a Cocoa: fix crash regression in qt_mac_create_nsimage()
The regression was introduced in d8857f21ac. The original change was
meant to fix support for SVG icons, but failed to take into account
a valid QIcon with no sizes, but which is also unable to create
a pixmap for the requested size.

Task-number: QTBUG-58344
Change-Id: I7ac1dbfaf6e3dab8581fe4b33c814e2517fcdba8
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-01-23 23:34:44 +00:00
Friedemann Kleint
45948967bd tst_QSocks5SocketEngine: Refactor tests
Rewrite tcpSocketNonBlockingTest() and downloadBigFile() to use lambdas for
the slots. This allows for removing the related member variables and slots
of the test class and ensures no leaks of sockets or inconsistent values.
Add an error handler printing the error message to the flaky downloadBigFile()
test.

Change-Id: Ieb64063c41e045a1a50a6d074bef01753ee319ef
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-01-23 12:22:54 +00:00
Friedemann Kleint
578154c47d tst_QPauseAnimation: Use QTRY_COMPARE for checking the stopped state
Use QTRY_COMPARE with a timeout to check for the stopped state
unless BAD_TIMER_RESOLUTION is defined.
This speeds up the test by 1s and prints diagnostic information
should an interval be too short (as seems to be the case on macOS,
currently).

Change-Id: I8f884cd66ad33314124d3130d9f49606e6dfe9f3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-01-20 18:03:34 +00:00
Dmitry Shachnev
287f548d4c Make shortcuts work for platform menu bars
When a platform menu bar is used, the QMenuBar is hidden, so shortcuts
for QActions attached only to it do not work.

Extend the macOS-specific code to treat such menubars as visible to
other platforms, to make the shortcuts work.

The exception is made for internal QMenuBar shortcuts, which are
forwarded to the platform menu. A follow-up change will add support
for this to QDBusPlatformMenu. The updateGeometries() method is called
for platform menu bars too to make sure the internal shortcuts are
registered even if the global menu is in use.

Add two cases to the tst_QMenuBar::activatedCount() test to test
both native and non-native menu bars when possible (it now passes with
native menu bars too).

Change-Id: I2d7128512719ac199cd3f8f7ba28333d04d84ed4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-01-19 08:41:55 +00:00
Mikkel Krautz
19a1a0871d QSslDiffieHellmanParameters: simplify defaultParameters() construction
This commit simplifies defaultParameters() to simply construct an empty
QSslDiffieHellmanParameters and assigning the DER-form of the DH parameters
to QSslDiffieHellmanParametersPrivate's derData field.

This creates a valid QSslDiffieHellmanParameters instance, but skips any
potentially expensive verification steps.

The previous implementation of defaultParameters() would use the public
fromEncoded() method to construct an instance of the default parameters.
This triggers a verification of the passed-in data, which can be expensive.

To ensure our defaultParameters() QSslDiffieHellmanParameters instance does
pass verification, this commit adds an autotest to verify that.

Fixes QTBUG-57815.

Change-Id: I6b1d9dbbfde526b232c319195ddbad42326be27c
Task-number: QTBUG-57815
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-01-18 11:32:02 +00:00
Aleksei Ilin
0243863382 Fix access incorrect index in QListView with batch layout
The size of flowPositions is larger by one than the number
of rows in the model so the last correct row number is
flowPositions.count()-2, not flowPositions.count()-1.

Change-Id: Idf8bbd155151d553947d5d299dd01ffaff0c95fa
Task-number: QTBUG-47694
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-17 14:00:31 +00:00
Marc Mutz
4baf08653c QHostAddress: add missing docs
qHash(QHostAddress) was added in Qt 5.0 (at least the version with uint seed = 0).

op==(QHostAddress::SpecialAddress, QHostAddress) was there since QHostAddress was
added before public history. Since QHostAddress does not have a \since, the I did
not supply one for op==, either.

Since the equality operator did not have unit-tests, added one.

Change-Id: I954a0df02464338f08a12ca58d4cc0ceb013e67a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-15 08:07:22 +00:00
Marc Mutz
610c7da075 Plug memleaks in tst_QStackedLayout
QLayout::replaceWidget() doesn't delete the affected item, but returns it.

Change-Id: Ibda96e4bf2432ad13ed2908c7d37547f46e29a37
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-01-14 18:17:47 +00:00
Thiago Macieira
5a1b4832a2 Adapt to the C++ SIC introduced by P0021: noexcept overloading
C++17 adopts P0021R1[1], which makes noexcept be part of the function
pointer's type and thus be overloadable. It contains some provisions for
allowing a noexcept function pointer to cast implicitly to a non-
noexcept function pointer, but that fails in the presence of templates
and additional overloads that could match the type in question.

Fortunately, the paper proposed a test macro, so we can change our
sources now and be compatible with both C++14 and C++17 rules.

This first failed with Clang 4.0 trunk. This source incompatibility is
not our fault, it's the language's doing.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html

Task-number: QTBUG-58054
Change-Id: I2bc52f3c7a574209b213fffd14988cf0b875be63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-14 03:24:30 +00:00
David Faure
2bb01172a7 QFont: fix fromString(toString()) when application font has styleName
The style name needs to be cleared if not present in the string,
otherwise the style name from qApp->font() (which propagates to
any default-constructed QFont) remains.

Change-Id: I9b6522a39a38526cced8a11ed02ae32582026480
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
2017-01-11 15:15:39 +00:00
David Faure
62882ad2fe tst_qfont: clear style name in test font
The test failed if qApp->font() had a styleName() set,
when testing old serialization formats which didn't serialize it.

Change-Id: If0236d354be144b3a990e074a22f796fffb1ed18
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
2017-01-11 15:15:36 +00:00
Marc Mutz
f480196f1b tst_utf8: remove duplicate nonCharacters() data
The population of data rows was factored into a separate file, qutf8data.cpp, in
commit e20c4730. Merge commit 9bd03235 failed to track a conflicting change into
the new file, and brought the code back into the tst_utf8.cpp, where it has been
duplicating the utf8data data ever since.

Change-Id: I4282685b882448f927289468bd7ab340a21ea0b3
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 18:39:31 +00:00
Jason Erb
ae42bf0f9b Fixed Chinese language selection on iOS
For language "Traditional Chinese" on iOS with region "US",
the logic was formerly to attempt a match on country/language/script (fail),
followed by country/language (which would result in script defaulting to
"Simplified"). Now, the logic is to try language/script first if script is
specified. Failing that, language/country will be attempted.

Task-number: QTBUG-39639
Change-Id: I75a774b1e66686e95167ff221458a97a7ea2660d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jason Erb <jason.erb@sparist.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 17:35:35 +00:00
Ulf Hermann
0979c5304c Drop unnecessary dependencies from some tests
The future tests don't need QtConcurrent as QFuture and friends are in
QtCore. The printdevice test doesn't use QtNetwork and the lancelot as
well as the testlib tests don't use QtXml.

Change-Id: I150ac99b36682aa23ad22ba943266eb0f0952838
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-10 16:34:52 +00:00
Ulf Hermann
2ed9a52ebf Fix compilation without sharedmemory
We have to enable qt_safe_ftok with either sharedmemory or
systemsemaphore. In order to make the resulting QT_CONFIG work with the
bootstrap library we switch the features off for bootstrapping. Some
tests and examples have to be excluded when sharedmemory is not
available.

Change-Id: I3fc3926d160202b378be2293fba40201a4bf50c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-05 08:38:33 +00:00
David Faure
a8ae8e3130 QDateTime::fromString(): improve performance by 33%
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.

tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
 RESULT : tst_QDateTime::fromString():
-     36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+     24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)

Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-03 13:37:49 +00:00
Simon Hausmann
3986be6d98 Improve reliability of network bearer tests
May of the tests initiate a scan / update of the network configuration
and expect the API to deliver exactly one update. This turns out to be a
race condition as the update may be emitted multiple times, as
QNetworkConfigurationManagerPrivate::updateConfigurations() is called
via posted events (queued signal emissions) from the bearer thread, and
so after creating the spy we may receive an update from _before_ and end
up emitting the signal multiple times.

Task-number: QTQAINFRA-1040
Change-Id: I931e2907f0cb86d48b4ab1a8795d75206035ea11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-02 21:03:29 +00:00
David Faure
77a8e90cdd QHeaderView: fix restoreState() on a model with more columns
When saving state for a 3-columns headerview and then restoring that
state onto a 5-column headerview, the headerview shouldn't suddenly think
it has 3 columns.

Rather than making restoreState() fail, we adjust for the additional
columns, so that we can still apply the customizations from the user to
all other columns (hiding, moving, etc.).

Change-Id: I3f220aa322ea8b629d2fe345f8cde13e0ea615d6
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2016-12-29 17:32:58 +00:00
Stephen Kelly
baad82d242 QIPM: Persist model indexes after emitting layoutChange, not before
Callers can persist a QModelIndex which was not persisted before in a
slot connected to the signal, and such a persisted index must be updated
in the course of the layoutChange.

Store the indexes to persist after emitting the signal.

Task-number: QTBUG-32981
Change-Id: Ibee4c0d84817d72603a03fe5b22fdeefeac0695e
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-21 01:37:50 +00:00
Stephen Kelly
0874861bcc QSFPM: Remove data manipulation from move handlers
Similar to the fix in the parent commit, incorrect updating of the
internal data structures during layout changes can lead to dangling
pointers being dereferenced later.  Moves are treated as layoutChanges
by this proxy by forwarding to the appropriate method.  However, data is
incorrectly cleared prior to that forwarding.  Remove that, and let the
layoutChange handling take appropriate action.

Change-Id: Iee951e37152328a4e6a5fb8e5385c32a2fe4c0bd
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-21 01:37:40 +00:00
Stephen Kelly
3bd0fd8f97 QSFPM: Fix handling of source model layout change
In sourceLayoutAboutToBeChanged the source model update is ignored if
the affected parents are filtered out anyway.  The same logic is
attempted in the sourceLayoutChanged slot, but there the early-return
logic is applied too late - the mapping is cleared before performing the
early-return.  Because pointers into the mapping are used in the
internalPointer of QModelIndexes in this class, persistent indexes used
later will segfault when attempting to dereference it.

Additionally, if a parent becomes invalid as a result of the
layoutChange, it would be filtered out by the condition in the loop,
resulting in a different result in the comparison of emptiness of the
parents container.

Fix that by persisting the parent's container, and performing the test
for early-return before clearing the mapping.

Task-number: QTBUG-47711
Task-number: QTBUG-32981
Change-Id: If45e8a1c97d39454160f52041bc9ae7e337dce97
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-21 01:37:31 +00:00