Commit Graph

8230 Commits

Author SHA1 Message Date
Kari Oikarinen
ebcc6687b0 Blacklist tst_QWidget::raise on openSUSE
The test occasionally gets an unexpected paint event on openSUSE.

Task-number: QTBUG-68175
Change-Id: I998d79dd12aac1f924c14d7ff7e864c4f081983c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-05-09 13:05:54 +00:00
Kari Oikarinen
7eab9ec63b Stabilize tst_QMdiArea::subWindowList
Flakily failed on openSUSE.

Task-number: QTBUG-68170
Change-Id: Ic75e081238ccf4bad54de39e6bdaa892796b599e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-05-09 09:58:04 +00:00
Kari Oikarinen
e110ab6c28 tests/auto/widgets/itemviews: Avoid unconditional qWait()s
Task-number: QTBUG-63992
Change-Id: Id4fcb0c2e4f83edd9508565468e16f57e100c780
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-05-09 05:52:22 +00:00
Liang Qi
b5a956601f Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
	tests/auto/corelib/io/qresourceengine/qresourceengine_test.pro

Change-Id: I3169f709cc2a1b75007cb23c02c4c79b74feeb04
2018-05-08 20:43:45 +02:00
Edward Welbourne
fec96d9a9f Remove mention of selftest.qrc from generator script's doc
This supplements b1945604a7, which
removed the qrc file in favor of test/test.pro coding for it.

Change-Id: I15507c89ca14fa6e6b8223de671ffff7092272d0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-05-08 12:45:25 +00:00
Kari Oikarinen
c580644fe9 tests/auto/network: Avoid unconditional qWait()s
Replace with QSignalSpy or QTRY_COMPARE when possible.

Task-number: QTBUG-63992
Change-Id: I18dc8837301424855487a12ee62451a5aeb21bf0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-05-08 12:35:40 +00:00
Mitch Curtis
4c92fce761 Fix order of mouse selftest in selftests.pri
Put it in alphabetical order like the rest of the list.

Change-Id: I3da3bb68d1847f53419bb79490b946c935ebb518
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-05-07 14:53:26 +00:00
Mitch Curtis
630b06f86c Add self-tests for QTest::keyPress() and QTest::keyRelease()
They didn't exist up until now, and future patches rely on them, so
add them.

Change-Id: I8afdb9417263b45d43355c688a813bdf99ea5fc8
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-05-07 14:53:18 +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
Oliver Wolff
a27f888dec tst_qresourceengine: Fix test for configurations with builtin_testdata
If builtin_testdata is present additional data ends in inside of
resources so that tests can access this data when needed. The addiitonal
data has to be taken into account in the resource engine's test.

Change-Id: I10de6b9612ca49b314d77cfadd5b2360a5d90d53
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-05-07 07:59:37 +00:00
Oliver Wolff
4dada8068a tst_qiodevice: Skip broken winrt tests
Change-Id: I399cc1aed3ee4151cf6adfd8f8780d8975604d52
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
2018-05-07 07:37:51 +00:00
Qt Forward Merge Bot
ba2b7b8e33 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ib58433da04bffb5dfab5486b80f17f39cc4145fa
2018-05-05 01:00:55 +02:00
Mårten Nordheim
ef242e0b34 OpenSSL 1.1.1: Fix tst_QSslCertificate::toText
The formatting of the output from QSslCertificate::toText has
changed slightly from before, so it no longer matches the test's
data.

From what I can tell we just do a manual sanity check and create
a new file with the new output and then augment the test.

Task-number: QTBUG-67463
Change-Id: I751e5a3f9a28015f97c895cea47384704fd68e38
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-05-04 12:57:47 +00:00
Jüri Valdmann
93e0ff037e QJsonDocument: Validate also zero-length objects
The added test case is the binary JSON equivalent of

    {"a":{"š":null}}

with two modifications. First, the length of the string "š" has been corrupted
to 0xFFFFFF00. Second and more import, the Base::size field of the inner object
has been reset to 0.

On its own the first modification would normally trigger a validation error.
However, due to the second modification the Value::usedStorage for the inner
object evaluates to 0, completely disabling all further validation of the
object's contents.

Attempting to convert this binary JSON into standard JSON will lead to the JSON
writer trying to construct a QString of length 0xFFFFFF00.

Fixed by validating also objects with usedStorage == 0.

Task-number: QTBUG-61969
Change-Id: I5e59383674dec9be89361759572c0d91d4e16e01
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-04 12:04:05 +00:00
Jüri Valdmann
3fc5500b4f QJsonDocument: Reject objects containing themselves in binary JSON
The added test case is a binary JSON file describing an array which contains
itself. This file passes validation even though attempting to convert it to
plain JSON leads to an infinite loop. Fixed by rejecting it in validation.

Task-number: QTBUG-61969
Change-Id: Ib4472e9777d09840c30c384b24294e4744b02045
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-05-04 12:03:57 +00:00
Jüri Valdmann
d3935cbd71 QJsonDocument::fromRawData: Fix out-of-bounds access
This method takes a pointer+size pair, but begins reading through the pointer
without first checking the size parameter. Fixed by checking the size parameter.

A new test case is added with an empty binary json file. Although the test does
not fail under normal conditions, the problem can be detected using valgrind or
AddressSanitizer.

Task-number: QTBUG-61969
Change-Id: Ie91cc9a56dbc3c676472c614d4e633d7721b8481
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-04 11:53:03 +00:00
Frederik Gladhorn
1e9da7b3fd Accessibility: Fix leaking cached interfaces
When the application closes, we should clear the cache to not run into
memory sanitizers claiming that we leak.

Change-Id: Ibf9fcda107be6b7f3ed414d7651080aa1f61a3a5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2018-05-04 10:56:35 +00:00
Filipe Azevedo
ebd3a13b80 Add a QPalette color role for placeholder texts
This allow to customize easily placeholders in QLineEdit by example.

Change-Id: I2bb379164376e1d88b42d6c86c2e5b8df99fbc56
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-05-04 08:53:06 +00:00
Eskil Abrahamsen Blomfeldt
e28ae083d2 macOS: Fix stretch of condensed fonts with NoFontMerging
When showing a condensed font with AnyStretch, we should
not apply any stretch to the font (and if a stretch is
requested, we should calculate the actual stretch based
on how much the font is already stretched or condensed).

This usually works as expected, however, when using
QFont::NoFontMerging as the style strategy, we would
scale the glyph advances by the stretch of the font
since the calculated stretch of the font engine would
be overwritten by the actual stretch. In the case where
we use font merging, this would be done for the multi
engine, so we would not get the same issue, since the
text engine gets the stretch from the actual font engine
and this still has the original, calculated stretch
set.

Note on the test: We can't use testString() for this,
since it contains a space, and the test font does not
have a glyph for this, so we will end up merging a
different font for the space, giving us a slightly
different advance.

[ChangeLog][QtGui][macOS] Fixed display of condensed fonts
when NoFontMerging is in use.

Task-number: QTBUG-63800
Change-Id: I5b05e0dbfc8ae4b5d10c621ecb0975f53fda9483
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-05-04 04:46:48 +00:00
Liang Qi
60fefff22f Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
	examples/widgets/graphicsview/elasticnodes/node.cpp
	examples/widgets/graphicsview/elasticnodes/node.h
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/cocoa/qnsview_drawing.mm
	src/widgets/kernel/qmacgesturerecognizer_p.h

Change-Id: I13cf06bac75d48d779d8ee7b5c91bfc976f2a32c
2018-05-03 14:50:22 +02:00
Gatis Paeglis
2ef83cc12c tests: unblacklist tst_qwindow.cpp::modalWindowPosition()
For details see QTBUG-67757.

Change-Id: I82559cb667a8622f29f7e6a6f24bc2b1e59917d6
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
2018-05-03 07:16:15 +00:00
Friedemann Kleint
6171d647b3 tst_QUdpSocket: Fix Clang warning about unused expression
tst_qudpsocket.cpp(965,9):  warning: expression result unused [-Wunused-value]
    if (!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint), socket2.errorString().toLatin1().constData())

Task-number: QTBUG-63512
Change-Id: I51959432c6ff166c188842e34c3033ab1319c079
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-02 15:56:04 +00:00
Andy Shaw
3e001feb4d If the page size is not valid on the new printer, set a custom size
When the page size was not valid on the new printer, it would end up
having the wrong page size name on the new printer. What should happen
in this case is that it should set the originally set page size as a
custom page size on the printer instead.

Task-number: QTBUG-62221
Change-Id: Iaca34ae262f5d0685ca60e4ca4b38229a2283289
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2018-05-02 13:32:09 +00:00
Qt Forward Merge Bot
7de400052f Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ia082e20e2eb4b76afd4c1a1584ff4e5514655d7a
2018-05-02 13:15:15 +02:00
Friedemann Kleint
7a1df39010 Tests: Fix clang warnings about unused variables and captures
tst_qline.cpp(170,12):  warning: unused variable 'baseB' [-Wunused-variable]           ^
tst_qline.cpp(169,12):  warning: unused variable 'baseA' [-Wunused-variable]
tst_qheaderview.cpp(3329,14):  warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    waitFor([this, &header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; });

qheaderview.cpp(3338,14):  warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    waitFor([this, &header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; });

Change-Id: I0245a7b66d15b896e864b488f7a58e8513fbdc6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-02 09:36:00 +00:00
Jan Arve Saether
c1ead32a84 Fix crash in QMacPanGestureRecognizer
The reason it crashed was this:
1. Button was pressed => _panTimer started with the graphics view as
   destination.
2. Button was released => the graphicsview is destroyed
3. 300 ms later: Qt tries to deliver TimerEvent from _panTimer to the
   graphics view. Unfortunately, the graphics view is deleted, but Qt
   doesn't know that... (*crash*)

We therefore chose to start the timer with a destination we are controlling the
lifetime of: the QMacPanGestureRecognizer. Inside the timerEvent of that we can
check if the actual target is already destroyed.

Task-number: QTBUG-60404
Change-Id: Iff8f5b7217de42c4c5cf551ca507f0cff1c99a78
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-05-02 09:16:22 +00:00
Kari Oikarinen
3761d99512 tst_QTabWidget: Add unconditional qWait() back
paintEventCount() is currently flaky on macOS. It gets extra paint events after
qWaitForWindowExposed() returns, which causes the following assertions to fail.

Add the wait that was removed in 0cb940b1d3 back
to fix those failures.

Task-number: QTBUG-68032
Change-Id: I68e0b6008de40922ec740291dfdd1842e0f62f89
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2018-05-02 09:04:14 +00:00
Gabriel de Dietrich
8b098e6544 tst_QMenuBar: Remove obsolete warning check
This warning was removed when we refactored QCocoaMenuItem::sync().

This change amends 8412009de6.

Task-number: QTBUG-68013
Change-Id: I0d65109dff5f82db530b6bdced96c05692af6b4b
Reviewed-by: Liang Qi <liang.qi@qt.io>
2018-05-01 17:11:16 +00:00
Daniel Teske
259648f876 QItemSelectionModel: More fixes for is(Column/Row)Selected
Replace the code for isRowSelected and isColumnSelected with
a much simpler algorithm for deciding if a row/column is selected.

In a model with a cross-hatch of unselectable indexes, the return values
of is(Column/Row)Selected would depend on the order in which the
selections were done.

Task-number: QTBUG-18001
Change-Id: I6aa4b1df7c07fae469a686041927fa8c42bc9b16
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-04-30 19:01:14 +00:00
Daniel Teske
d6b9cba812 tst_QLineEdit: Use correct keys to move to Start/End of Line
Home/End don't actually work on macOS. The "select all and delete" key
was not actually testing anything at all.

Change-Id: I44d3e9dd27da418afd699bf8720d5369325d20df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-04-30 19:00:34 +00:00
Mårten Nordheim
51e14787d5 Stop rejecting cookies which have a domain that matches a TLD
... but only if the host it came from is an EXACT match. Also only apply
the cookie if the url is an EXACT match.

[ChangeLog][QtNetwork][QNetworkCookieJar] Cookies will no longer be
rejected when the domain matches a TLD. However (to avoid problems
with TLDs), such cookies are only accepted, or sent, when the host name
matches exactly.

Task-number: QTBUG-52040
Change-Id: Ic2ebd9211c48891beb669032591234b57713c31d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-30 11:18:43 +00:00
Kari Oikarinen
b7d810a7cc tst_QFocusEvent: Add qWaitForWindowActive() to checkReason_focusWidget()
checkReason_ActiveWindow() started failing on Windows when run together with
other tests, but still passed on its own.

The offending tests was checkReason_focusWidget(), which showed a window but did
not wait for it to be active.

After adding this wait the whole test executable passes on Windows as well.

Amends fd87c8da82.

Change-Id: I384bc45176fcd7bf6f491a4f39b46464ba45693b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-27 07:16:11 +00:00
Thiago Macieira
ff029a9ca8 tst_QString: remove old HP aCC workaround
Change-Id: I3840d727dee443318644fffd15291b1d77dca2fc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-04-27 07:07:45 +00:00
Ulf Hermann
e0b5ff4ad5 QWidgetWindow: Immediately forward close events to QWindow
This way the platform window is destroyed in a timely manner, preventing
redundant close events from the window system.

Task-number: QTBUG-43344
Change-Id: Ifdfca59ceacef54405f1c227c493dc514a1b27ea
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-04-27 07:00:13 +00:00
Kari Oikarinen
e69b6d2dbc tst_Gestures: Use QTest::qWaitForWindowExposed()
Instead of a local wrapper for it.

Change-Id: I0708dfad44b3db0c7a13e75ba5b4193ab50ac315
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-27 06:20:48 +00:00
Liang Qi
866b47916d Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: Ideea96d1b43d47b1d9b34e11c9986a88e240aa71
2018-04-26 09:55:10 +02:00
Eirik Aavitsland
bd1fd197ca Fix drawTiledPixmap() and texture-brush painting with high-DPR images
Although QPainter::drawImage()/drawPixmap() would render images scaled
according to their devicePixelRatio(), that would not happen for
drawTiledPixmap() and when using a textured brush. Implemented here,
in combination with the pending "High-dpi drawTiledPixmap (raster
paint engine)" commit.

[ChangeLog][QtGui] Fix drawTiledPixmap() and texture-brush painting with high-DPR images

Task-number: QTBUG-67248
Change-Id: I037e3f897fa708038a0222d3b0c61c7842d87961
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-04-25 13:39:28 +00:00
Gatis Paeglis
d50d35d9db tests: cleanup tst_QComboBox::keyBoardNavigationWithMouse()
- Don't use QCursor when we can position a mouse relative to the
window coordinates via QTest::mouse*() functions. Even the way
QCursor was user here seemed to be hackish. This hack apparently
was there to make the test pass on macOS, I have verified that
the updated test continue working on this platform.

- Remove Q_OS_QNX ifdef, as this test does not depend on QCursor anymore.

- Remove QTest::qWait()-s. Unconditinal waiting should not be used.

- Add better comments.

- Other minor things.

And move tst_QComboBox to use QTEST_QPA_MOUSE_HANDLING code path.
Eventually we want to deprecate the legacy code path.

Change-Id: Ib72f324b5197d0fd66fc32b8c1c7509e58838e04
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-25 13:07:23 +00:00
Kari Oikarinen
0cb940b1d3 tests/auto/widgets/widgets: Avoid unconditional qWait()s
Task-number: QTBUG-63992
Change-Id: I7b0c259800082284ddae4e25d139ad3adc858467
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-25 11:55:34 +00:00
Kari Oikarinen
73031ebb99 tests/auto/widgets/{effects,styles}: Avoid unconditional qWait()s
Task-number: QTBUG-63992
Change-Id: I1af537bae705d4627880c5ae50669b1ef72562f2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-25 05:47:01 +00:00
Johan Klokkhammer Helsing
8ac0e6592b Skip flaky tst_QWindow::childWindowPositioning on Wayland
Sometimes causes protocol errors (i.e. termination) on Wayland with xdg-shell
v6.

Task-number: QTBUG-67648
Change-Id: I6c855affb145590f47a425d233c5fd6b7e1e8914
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
2018-04-25 04:51:34 +00:00
Allan Sandfeld Jensen
e413874467 Fix division by zero in radial gradiants with NEON
The NEON implementation uses rsqrt and thus can not be taken on 0, so
replace the minimum with something close to zero instead of zero.

Task-number: QTBUG-59961
Change-Id: Ia39e45be675b056c1e22900495ce9ba4e8b70e5f
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2018-04-24 18:16:54 +00:00
Thiago Macieira
309dacedac Atomics: remove requirement for alignment equality with plain types
This was originally added so that you could replace a T with
QAtomicInteger<T> in the same class and still keep ABI. However, for
legacy reasons, on 32-bit x86, types larger than 4 bytes keep an old
1990s alignment of only 4 bytes, but modern std::atomic<T> for those 8-
byte types enforces an alignment of 8 bytes. Therefore, the requirement
to keep alignment is not possible to guarantee.

In other words: you may not replace T with QAtomicInteger<T> or
std::atomic<T> and assume no ABI breakages in all platforms.

This is a requirement to implement atomicity. An 8-byte type aligned to
only a 4-byte boundary could cross a 16-byte boundary or, worse, cross a
cacheline boundary. Crossing the 16-byte boundary could be bad on some
processors, but crossing the cacheline boundary (addresses ending in
0x3C, 0x7C, 0xCC and 0xFC, or 4 out of 64 possible addresses or 6.25%)
is always bad: the CPUs cannot guarantee an atomic load or store
operation.

See also <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71660>.

Task-number: QTBUG-67858
Change-Id: If90a92b041d3442fa0a4fffd15283e4615474582
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-04-24 17:36:42 +00:00
Kari Oikarinen
15ada2b917 tests/auto/widgets/kernel: Avoid unconditional qWait()s
Task-number: QTBUG-63992
Change-Id: Icb32b516002c3bb2841c8e7a29624e54cfcbbcac
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-24 05:01:57 +00:00
Qt Forward Merge Bot
02268b8496 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: If950406391f79d99f0101f0b6755395accb26f34
2018-04-24 01:00:19 +02:00
Simon Hausmann
be9a56e5e3 Make it easier to use resources in plugins when using static linking
RCC generates code that registers resources automatically on program
startup via global constructors. When linking statically and nothing
references the symbols in the .o file compiled from the RCC generated
code, then the linker will discard the embedded resources and they will
not get initialized. That is why for static linking it is necessary to
explicitly initialize resources using the Q_INIT_RESOURCE macro.

We can avoid the need for the explicit initialization in the context of
plugins that are statically linked into the application. resources.prf
can generate a .cpp file with a helper function that contains all the
Q_INIT_RESOURCE calls for all resources in the plugin. That helper
function in turn is injected into the plugin entry point, which in turn
is guaranteed to be included in the final binary.

Change-Id: If1abf9c85ef92935020af073b989c58c1ae6ca63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-04-23 13:56:07 +00:00
Mårten Nordheim
72bb1d95fd Introduce QPasswordDigestor functions
Added a few functions to derive keys from passwords. Currently it
supports PBKDF1 and PBKDF2 as defined in
RFC 8018 ( https://tools.ietf.org/html/rfc8018 ).

[ChangeLog][QtNetwork][QPasswordDigestor] Added QPasswordDigestor

Task-number: QTBUG-30550
Change-Id: I2166b518bd8b54e3486514166e76fd9ba2f219c8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-23 12:55:45 +00:00
Mårten Nordheim
c45802e33a QSslKey: Implement PKCS#8 support for the generic backend
This patch adds the ability to decode keys which are encoded with PKCS#8
using the generic back-end (used in winrt and secure transport).

It works on both WinRT and macOS; however QSslKey seems unused in the
WinRT backend and it seems only RSA keys can be used for certificates
on macOS. Meaning that DSA and Ec, which in theory* should represent
their unencrypted versions, can't currently be tested properly.

* Can also be confirmed by loading the key using the ST or WinRT
backend, calling toPem(), writing the output to a file and then loading
the unencrypted key using openssl.

[ChangeLog][QtNetwork][QSslKey] Added support for PKCS#8-encoded keys
in the generic SSL back-end (used for SecureTransport on macOS and for
WinRT). Note that it does not support keys encrypted with a PKCS#12
algorithm.

Task-number: QTBUG-59068
Change-Id: Ib27338edc7dbcb5c5e4b02addfdb4b62ac93a4c3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-23 12:55:38 +00:00
Kari Oikarinen
12559058b0 tst_QFile: Don't expect Windows HANDLE equality in nativeHandleLeaks()
That check is flaky on Windows. It doesn't seem to be testing Qt functionality.
I also don't see CreateFile2() documentation mentioning any guarantees that
opening the same file twice would give the same HANDLE each time.

Change-Id: Ica2e60571ae9fc39bf822803a2a9dd6add8323d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-23 12:45:32 +00:00
Qt Forward Merge Bot
100ebf1c97 Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev 2018-04-20 20:06:18 +00:00
Qt Forward Merge Bot
6f45fda50b Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I0bea38585382b5d9c8d7a013bf6bcb3a6008d159
2018-04-20 21:22:53 +02:00
Tor Arne Vestbø
2b40af7177 tst_qimagereader: Make sure to include all image resources in test
The manually maintained qrc file was missing corrupt_clut.bmp among
others.

Change-Id: I8916ba76a63950de03f25814d893306d046d273d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-20 15:05:01 +00:00
Andy Shaw
7c532891e0 Send ShortcutOverride event when receiving a non-spontaneous key press
When a key press is received which is not spontaneous then it needs to
be manually sent as a shortcut override event to ensure that any
matching shortcut is triggered first. This enables emulation/playback
of recorded events to still have the same effect.

[ChangeLog][QtWidgets] Sending a key press event with sendEvent() now
sends a ShortCutOverride event first to the widget to trigger any
shortcuts set first.

Task-number: QTBUG-48325
Change-Id: Iafcc2cdb1773bffe89edaeb0abc44cd5a51088e6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-04-20 10:18:49 +00:00
Jan Murawski
b0726e8641 Add HTTP caching headers to KnownHeaders
QNetworkRequest is already aware of the Last-Modified header but
has been lacking support for the If-Modified-Since, ETag, If-Match
and If-None-Match headers. These headers are used with HTTP to
signal conditional download requests.
See RFC 7232 for more information.

Change-Id: I248577b28e875fafd3e4c44fb31e8d712b6c14f1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-04-19 06:46:13 +00:00
Lars Schmertmann
c08197ccab QObject: Extend debug output of connect
Sometimes it is hard to find the line, when the warning
"QObject::connect: invalid null parameter" appears in the log.
This change adds the class names of the sender and receiver
to give a hint where to search for the wrong call to connect.

Change-Id: I00cead7d943f96d60f198cb3f0bed34ba10285c5
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-04-18 17:57:30 +00:00
Timur Pocheptsov
46ad794a96 Auto-tests: remove unneeded 'gui' from QT variable
none of these tests needs anything GUI-related.

Change-Id: I6b3c02bf13da60ab460f0cc4d804f1d03bc68f50
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-18 14:22:26 +00:00
Timur Pocheptsov
9865ecf9db h2 auto test - replace QEventLoop (and QTimer) with QTestEventLoop
QTestEventLoop (conveniently so) takes care of timeouts thus no
external QTimer/handling logic needed at all.

Change-Id: Id65ea928daec1e7d9380107e63916896f19d3d14
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-18 14:18:38 +00:00
Kari Oikarinen
c6ee1899ea Blacklist tst_QWindow::isActive on Ubuntu
Task-number: QTBUG-67768
Change-Id: Ie1e0b406c152c854ef3629fa4d469dd73452f128
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-18 13:23:18 +00:00
Andy Shaw
8e5f6e3bed Don't send a mouse move when we just need to do a synthetic enter/leave
[ChangeLog][QtWidgets] QApplication no longer sends a mouse move event
to the entered widget if it sends synthetic enter and leave events.

Task-number: QTBUG-67736
Change-Id: I75daaffd53f1ddc2bc4d7df67382cbc22d3eb6fc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-04-18 08:19:41 +00:00
Qt Forward Merge Bot
c8625a3e67 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I86f04fc3b2e4291f161a4985adddd6fd6c789d33
2018-04-18 01:00:28 +02:00
Edward Welbourne
3ac029f674 Make generated selftest output match for in-source builds
When generate_expected_output.py is run for an in-source build, the
raw output contains no paths to the sources for the script to whittle
down, as it does for shadow builds, to just the path from qtbase down.
So kludge together some extra regexes that can fix that up and tweak
some relevant code to provide them with the data they need.

Change-Id: I656d7126087bd9ad20b2af6835fba314d90a171d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-17 16:22:49 +00:00
Andy Shaw
0b70f5ada9 QDoubleValidator: Allow intermediate values as close as possible to one considered invalid
The documentation states that if you have a range of
0.00-2.00 with the number of decimals set to 2 then
any number up to 9.99 would be considered intermediate.
This is because the number of digits still matches both before
and after the decimal point. If it is 10.0 or 9.999 then
it is still considered invalid.

In the case of 9.999 being invalid in this case, the documentation
is corrected as this was incorrectly indicated as Intermediate,
as the code indicates it as Invalid.

Change-Id: I07b433e856f355916a1240deafdf4ef58e680639
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-04-17 15:36:34 +00:00
Oliver Wolff
215e0f35d0 tst_qdir: Fix absoluteFilePath for winrt
The drive has to be defined for every Windows configuration (also
including winrt).

Change-Id: I94a3131b8aec20cda97dc78f55b1d87aa10240e4
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-04-16 05:23:17 +00:00
Qt Forward Merge Bot
4aa6f54fec Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I8c353b4c53e90434453c76691eac39a894d23b49
2018-04-15 01:00:18 +02:00
Kari Oikarinen
0dd3e02aac tests/auto/widgets/util: Avoid unconditional qWait()s
Task-number: QTBUG-63992
Change-Id: I795e564b051bbabd1fc2d2fca8171da6072f99eb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-13 12:32:52 +00:00
Kari Oikarinen
66cc08961f tst_QWidget: Avoid unconditional qWait()s
Task-number: QTBUG-63992
Change-Id: I1696ccbdf0523ece694f2dac52c015443c8b19fb
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-13 05:43:45 +00:00
Eirik Aavitsland
7f782e1fc4 Fix crash if QPixmap::defaultDepth() is called when no QGuiApplication
This static method can be called before QGuiApplication is created. At
that point there is yet no primary screen, so the implementation
needs to guard against dereferencing a nullptr.

Task-number: QTBUG-67309
Change-Id: I6b7b9e97b1c3c79bf2f9c6d6247c3b10f39f7a55
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-12 21:22:20 +00:00
Lars Knoll
4f158ccee5 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I9f802cb9b4d9ccba77ca39428a5cb1afd2d01642
2018-04-12 22:00:35 +02:00
Alex Trotsenko
e8733ffc51 QWindowsPipeReader: fix waiting on inactive pipe
To read data from a named pipe, QWindowsPipeReader uses the ReadFileEx()
function which runs asynchronously. When reading is completed and the
thread is in an alertable wait state, the notified() callback is called
by the system, reporting a completion status of that operation. Then the
callback queues a readyRead signal and starts a new sequence. The latter
is skipped if the pipe is broken or the read buffer is full.

Thus, if an application does not run the event loop, the next call to
QWindowsPipeReader::waitForReadyRead() should emit the queued signal
and report true to the caller even if no new read operation was started.

Change-Id: I37102dbb1c00191d93365bfc2e94e743d9f3962a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-04-12 18:08:29 +00:00
Timur Pocheptsov
9917eb2ec6 HTTP/2 - reset uploadByteDevice if necessary
1. If a request was redirected or some error was encountered, we
   try to reset the uploading byte-device.
2. Disconnecting from the byte-device is not enough, since we have a
   queued connection, _q_uploadDataReadyRead() gets called even if
   byte-device was deleted and thus sender() can return null -
   we have to check this condition.
3. Update auto-test with a case where our server immediately
   replies with a redirect status code.

Task-number: QTBUG-67469
Task-number: QTBUG-66913
Change-Id: I9b364cf3dee1717940ddbe50cba37c3398cc9c95
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-12 14:02:20 +00:00
Kari Oikarinen
a88063008d Blacklist tst_QItemDelegate::comboBox on openSUSE
This failed (occasionally) in finding the editor widget, so wait for the window
to be shown properly. Also enter the event loop with QTRY_VERIFY and not for a
fixed time of 1 s.

This however just moved the point of failure. Now the test fails since the
clearing and setting of focus does not dismiss the editor widget sometimes, so
still blacklist it.

Task-number: QTBUG-67282
Task-number: QTBUG-66216
Change-Id: Iec598609fce23a25d7b955082d0973685d612715
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-12 12:48:12 +00:00
Kari Oikarinen
b096982899 Don't mark tst_QFiledialog as insignificant_test
Change-Id: Id3fef4e66bd8f96c8f87dd94bbca216cc65f8489
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2018-04-12 12:21:55 +00:00
Edward Welbourne
5c63e6fd75 Clean up some trivia in tst_QTimeZone
Fix a mistaken #ifdef that should have been #if; and only call
QTimeZone::availableTimeZoneIds() once in transitionEachZone_data(),
while switching to use of a ranged-for.

Change-Id: Id27aae9ef450f21350283099c892ca7173884b94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-04-12 11:48:06 +00:00
Kari Oikarinen
350a64196f tests/auto/dbus: Avoid unconditional qWait()s
Use QTRY_COMPARE instead of a wait followed by QCOMPARE. Unless the condition
doesn't change and the wait provides the opportunity for things to go wrong.

Task-number: QTBUG-63992
Change-Id: I13474a45f1f4df9d77a418729a5748235ae0dd1a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-12 05:49:07 +00:00
Gabriel de Dietrich
91fa300cbe QMacStyle: CC_ComboBox is now HITheme-free
For the time being, no more stretched QComboBox. They
were already looking bad before and nobody complained,
so it's a non-issue. In the future, we might use square
combo boxes in the same way as we do for push buttons
but for non-editable QComboBox only.

Removes what is now dead code, including some leftovers.

tst_QMacStyle updated to reflect size changes to accom-
modate the focus ring.

Change-Id: I60fac86b9acb52cc96373bca0b3cad598ec4f1e7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-04-12 00:20:42 +00:00
Daniel Savi
6a4b6971f4 Add more formatting to QTextDocumentWriter when writing ODF files
QTextDocumentWriter only supports a small subset of table formatting
when exporting to ODF-format. This patch adds more formatting
capabilities to the ODF exporter:
- table border support
- table alignment
- table width
- respect column constraints (column widths)
- add a tab before soft line breaks. This will avoid causing the last
line to stretch all over the cell in justified paragraphs.

With this patch, line height settings are now exported, too.

[ChangeLog][QtGui][QDocumentWriter] QDocumentWriter now supports table
borders, table alignment, table width, column widths, line height and
image resolution when exporting QTextDocuments to ODF files.

Task-number: QTBUG-63581
Change-Id: I2d269ef0f842e73af64d48bfef531d5fa3078088
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-11 18:44:31 +00:00
Mårten Nordheim
f8e551cf08 Fix loading pkcs#8 encrypted DER-encoded keys in openssl
When we load DER-encoded keys in the openssl-backend we always turn it
into PEM-encoded keys (essentially we prepend and append a header and
footer and use 'toBase64' on the DER data).

The problem comes from the header and footer which is simply chosen
based on which key algorithm was chosen by the user. Which would be
wrong when the key is a PKCS#8 key. This caused OpenSSL to fail when
trying to read it. Surprisingly it still loads correctly for unencrypted
keys with the wrong header, but not for encrypted keys.

This patch adds a small function which checks if a key is an encrypted
PKCS#8 key and then uses this function to figure out if a PKCS#8 header
and footer should be used (note that I only do this for encrypted PKCS#8
keys since, as previously mentioned, unencrypted keys are read correctly
by openssl).

The passphrase is now also passed to the QSslKeyPrivate::decodeDer
function so DER-encoded files can actually be decrypted.

[ChangeLog][QtNetwork][QSslKey] The openssl backend can now load
encrypted PKCS#8 DER-encoded keys.

Task-number: QTBUG-17718
Change-Id: I52eedf19bde297c9aa7fb050e835b3fc0db724e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-11 14:30:08 +00:00
Timur Pocheptsov
e3cea2a7b9 QSslSocket (OpenSSL 1.1) - respect requested protocol version
Properly handle single protocol TLS configurations. Previously,
due to the use of generic (non version-specific) client/server method
they worked as ranges of protocols instead. This also fixes a couple
of previously broken tests.

Task-number: QTBUG-67584
Change-Id: Ied23113a4fab6b407a34c953e3bd33eab153bb67
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-11 12:10:01 +00:00
Liang Qi
093290a662 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/platforms/ios/quiview.mm

Change-Id: I0fd0adeca1590fffddd577873172f6d987a60412
2018-04-11 09:34:23 +02:00
Kari Oikarinen
edef007137 tests/auto/gui/kernel: Use QTRY_VERIFY instead of manual wait loops
This reduces the timeout from 10 seconds to the default 5, but the tested events
(resize events, painting) seem like something that should happen in 5 seconds.

Change-Id: I1d12372f37264bf7be64096e43813cd03f567102
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2018-04-11 06:11:27 +00:00
Kari Oikarinen
b318c14bd5 Stabilize tst_QWidget_window::setWindowState
Bumping the timeout removed flaky failures in an RHEL debug VM.

Task-number: QTBUG-67151
Task-number: QTBUG-66216
Change-Id: I2fde636149f5104a41b757df956d84edc420e7c7
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-04-11 06:07:26 +00:00
Kari Oikarinen
8c3475c190 tst_QGL: Use qWaitForWindowExposed()
Instead of an unconditional wait.

Change-Id: I360cd665c10c3fd4f936c95ef04957ae1c49c0de
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-11 06:05:46 +00:00
Juan Jose Casafranca
95c8f24b71 Enable BuiltIn input in the shader graph builder
BuiltIn inputs shouldnt be translated into a code input. We comment the
input line for this variables

Change-Id: I3b7d2fd06afc6a122d90a999fc5a5246fc93234e
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2018-04-10 23:49:37 +00:00
Christian Ehrlicher
c7cbf21699 QPixmapCache: make sure to not overflow cache limit
The cost for the pixmap cache was calculated in bytes but
setCacheLimit() takes the size in kilobytes. This lead to the
situation that all values above 2097152 overflowed and disabled
the caching completely. Fix it by calculating the cost in
kilobytes as it is done in QGLContext.

Task-number: QTBUG-45293
Change-Id: Ib8dc2360c8f3201ce0b615a04c38b5ccaa8fc6cf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-04-10 18:45:27 +00:00
Timur Pocheptsov
fdc28956c9 Revert "tst_QSslSocket::signatureAlgorithm - fix for OpenSSL 1.1"
This reverts commit e2694fa602.
I'm reverting this patch - I'll fix QSslSocket instead to respect
the requested protocol version.

Change-Id: Ia4bb09a8801c58bc76837518934ac7a3eedd3c07
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-10 13:17:02 +00:00
Friedemann Kleint
2268b6bcdd QtGui: Add qt_imageToWinHBITMAP(), qt_imageFromWinHBITMAP()
Add functions for converting QImage to HBITMAP and back
supporting additional formats of QImage (RGB888, RGB555,
Indexed8 and Mono). Add test with roundtrip to tst_qimage similar
to tst_QPixmap::toWinHBITMAP().

Task-number: QTBUG-51124
Change-Id: Ib568898e7162686bfa527d828785628eb0b78e21
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-04-10 12:20:45 +00:00
Mårten Nordheim
5e7a64d1e3 QCryptographicHash: Add a static method to retrieve hash length
It's useful when you need to check how long a hash will be without first
generating one.

[ChangeLog][QtCore][QCryptographicHash] Add a static method, hashLength,
which returns the length of the output of a hash function in bytes.

Change-Id: Id6a454016523de83d157fd95c50105c6db4bb1d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-10 12:17:43 +00:00
Kari Oikarinen
32d9cf7310 Fix tst_QFiledialog::completer
The test was failing because the files it expected to create were not actually
visible on the disk.

This was because 189e9c93d7 made QTemporaryFile
use unnamed files if the file name is not actually requested. Fix by forcing the
temporary file to be made with the requested name.

CI has not caught this because the test executable is marked insignificant_test
on Linux.

Change-Id: Ibe0244fdfcc66acf3be4314da51b4c0b3b520b71
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-10 08:33:15 +00:00
Kari Oikarinen
3e2c930242 tst_QEventLoop: Remove unconditional qWait()
Task-number: QTBUG-63992
Change-Id: I9d9e3966252f01cded489313561641e1c0292b91
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-04-10 08:32:21 +00:00
Qt Forward Merge Bot
e027c7241f Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I0120f804522c0c652e9537b6e9fe08189f071ed2
2018-04-10 01:00:26 +02:00
Mårten Nordheim
5c4e5032b5 Unblacklist qsslkey for Linux
Except RHEL-6.6 and 7.4

It was blacklisted in f3939d943e, along
with a lot of other entries. No specifics are known about why it was
blacklisted originally, but now it only fails on RHEL because they
use OpenSSL 1.0.1.

Change-Id: I6d1d1b7b7bf5386b2115b8780163550cf03bbad7
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-04-09 09:34:50 +00:00
Johan Klokkhammer Helsing
1b109dbd91 tst_QClipboard: Skip on Wayland, as it requires real input events
On Wayland, manipulating the clipboard requires an input event serial, which is
not possible to get unless the compositor sends us input events.

Change-Id: If5231a5db85f8d6ad988ea93f240cee0c3466f9f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-09 07:12:29 +00:00
Johan Klokkhammer Helsing
b451c9dfdc tst_QTouchEvent: Wait for window exposed instead of active
This makes the tests pass on Wayland compositors that don't automatically give
focus to newly created windows. Such as a headless Weston, which is very useful
for testing.

Task-number: QTBUG-66846
Change-Id: I502504b333499c89be193a3ebc19d41264a13580
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2018-04-09 07:11:47 +00:00
Kai Koehne
335754d0a3 Fix license header for tst_toolingsupport.cpp
Change-Id: Id355afc8eb57a40a0f8d06fa2920f03d94ef9337
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-04-09 06:37:01 +00:00
Kari Oikarinen
b49a2e671a tst_QPrinter: Use qWaitForWindowActive() to wait for dialog
Instead of an unconditional wait.

The QSKIP is necessary because the PDF format is non-native and the Windows
implementation of QPrintDialog doesn't work then.

The macOS implementation has the same warning, so add the check for that OS
as well.

The test has previously passed, since it hasn't seen not actually opening the
dialog as an issue.

Change-Id: Ib53e378b232580358f13e0c5206404412f9e6ee2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-09 05:59:39 +00:00
Olivier Goffart
e759d38d49 Declare the operator| in the Qt namespace for QFlags in that namespaces
This is a long overdue change so we don't break ADL of operator|.
I think will not break source or binary compatibility.

The problem is code like this:

  namespace Foo {
     struct MyStruct;
     MyStruct operator|(MyStruct, MyStruct);

     void someFunction() {
	fooLabel->setAlignement(Qt::AlignLeft | Qt::AlignTop)
     }

  }

This would be an error before as ADL would find only the Foo::operator| and not
the global one since the arguments are not in the global namespace.

After this change, ADL works fine and this code compiles

This bites people with misterious error, see questions on
https://stackoverflow.com/questions/10755058/qflags-enum-type-conversion-fails-all-of-a-sudden
https://stackoverflow.com/questions/39919142/broken-bitwise-or-operator-in-a-qt-project

[ChangeLog][QtCore] QFlags's operator| for enum types in the Qt namespace are
now declared in the Qt namespace itself.

Change-Id: I021bce11ec1521b4d8795a2cf3084a0be1960804
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-04-08 14:24:27 +00:00
Qt Forward Merge Bot
8001195098 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Idf2bef470663864069bbf7e41af07b534936863a
2018-04-07 01:00:14 +02:00
Edward Welbourne
28c9ad199c Revise dates of Pacific/Kiritimati's day-skip transition
The TZ database has recently revised its ccount of when they skipped a
day to cross the international date line, from skipping Jan 1st 1995
to skipping December 31st 1994.  So Move the before-days check to
December 30th; and correct the Feb 2nd that was meant to be Jan 2nd
(and does need to remain so, for compatibility with systems with out
of date data).

Task-number: QTBUG-67497
Change-Id: I5b9483c553205817f995f91793662a5a85e03192
Reviewed-by: Liang Qi <liang.qi@qt.io>
2018-04-06 18:05:04 +00:00
Andy Shaw
ec23d96c86 oci: Use OCIBindByPos2 to accommodate data longer than USHRT_MAX
OCIBindByPos2 is only needed when using execBatch(), binding data that
is longer than USHRT_MAX works for exec() so this is left unchanged.

Change-Id: Ifdcf91939d184f225d24c13052ea0b81611ecf91
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-06 12:44:37 +00:00
Qt Forward Merge Bot
1a464f35d1 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ic811cd444e523b904211797112bba6aaec85dddd
2018-04-06 09:32:13 +02:00
Kari Oikarinen
fd87c8da82 tests/auto/other: Avoid unconditional qWait()s
There is no need to qWait() before a QTRY_VERIFY. qWait() will also
intermittently handle events while waiting, so calling it in a loop isn't
necessary.

Change-Id: Ica7fbf18c03e673213dd9b72f31f71937cdcb145
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-04-06 07:19:19 +00:00
David Faure
a1b1dd3b84 QMimeDatabase: fix assert when fetching data for invalid mimetype
The Q_ASSERT(mimePrivate.fromCache) at qmimedatabase.cpp:218
which I added in commit 7a5644d648, was being triggered when calling comment()
for invalid mimetypes such as db.mimeTypeForName("").

Change-Id: I8037041a4b435d2a5ba24ec94b7858e38b2f0bf2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-04-06 07:19:01 +00:00
David Faure
e729ac6dc5 QSqlDatabase: Skip confusing thread warning on invalid QSqlDatabase
If the db isn't valid, then that's the actual issue, not the fact that we're
getting the same invalid db (with the same driver QSqlNullDriver) in
multiple threads.

Change-Id: I95490818ed78e741c3823e115f139c2cff01b0b1
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-04-06 07:18:03 +00:00
Kari Oikarinen
b32d16d468 tst_QLocale: Avoid manual deletes
Also use data-driven test to reduce duplication.

Change-Id: I9516e52267cb3c7b239030fd73dbbf23ac8f52f7
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-04-06 05:44:50 +00:00
Edward Welbourne
3c8181de70 Kludge QLocale test order to fix fall-out from setDefault()
This makes an irreversible global change: tests that do it will mess
with other tests.  So make sure they're all last.  This required
splitting up one test; and revealed another that secretly depended on
being run with C as default locale.

Task-number: QTBUG-67276
Change-Id: Ic24ef48b2c9bd5c37c1f11260b437628019624ca
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
2018-04-05 19:56:47 +00:00
Timur Pocheptsov
e2694fa602 tst_QSslSocket::signatureAlgorithm - fix for OpenSSL 1.1
The test creates client and server sockets with mismatching protocol versions,
trying different combinations, for example: 1) server (TLS 1.0) vs
client (TLS 1.2) or 2) server (TLS 1.2) vs client (TLS 1.1), etc.
Since TLS v < 1.2 does not support signature algorithms, they are ignored
and handshake is always successful. But our new OpenSSL 1.1 backend uses
generic TLS_client_method and TLS_server_method when creating SSL_CTX.
This means, both server and client will support TLS v. 1.2, they
will have no shared signature algorithms, thus handshake will fail
with an error string similar to this:

"tls1_set_server_sigalgs:no shared signature algorithms".

For OpenSSL 1.1 this test makes no sense.

Task-number: QTBUG-67456
Change-Id: Ibb2a12eea5e5c0ebaeee7d0719cc721ecf4763e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-05 15:15:01 +00:00
Friedemann Kleint
f2fd5f390c tst_QCursor::equality(): Silence warnings
Silence numerous warnings:
QCursor: Cannot create bitmap cursor; invalid bitmap(s)

Amends 6445aa4b06.

Change-Id: I7b467cdeeaa7a854c2878cf1ed2a6113d8c96059
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2018-04-05 09:00:39 +00:00
Qt Forward Merge Bot
bfe5e510b9 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I954bd6418bc862a04691240c0f1766f6ce033640
2018-04-05 10:02:09 +02:00
Kai Koehne
50d301cfdd Hide global qtlogging.ini from autotest
Do not let a global qtlogging.ini interfere with an autotest.
This works around an issue on Ubuntu 17.10

Task-number: QTBUG-67385
Change-Id: I0d02835eb7a561b43fe0b98f4383c170c6d51303
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joni Jäntti <joni.jantti@qt.io>
2018-04-05 05:40:07 +00:00
Johan Klokkhammer Helsing
40a15ecaad Skip tst_QWindow::spuriousMouseMove on Wayland
As setting cursor position is not allowed on Wayland.

Task-number: QTBUG-66824
Change-Id: I1f065b7072dff13b1ee8a4fc3ccec347e8d71ed1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
2018-04-04 12:52:50 +00:00
Allan Sandfeld Jensen
559964849a Add lancelot based benchmark
Uses the scripts and tests we already have for lancelot as a painting
benchmark.

Change-Id: Idf8a55e2261162e619f6dbb567dc19f8dc96da4e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-04-04 08:17:43 +00:00
Kari Oikarinen
3e1ecdd74c tst_QStateMachine: Don't use unconditional waits
Instead use QSignalSpy to wait directly for the expected events.

Change-Id: I319302ea7177fe690b5d885347c505454904518e
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2018-04-04 07:07:40 +00:00
Kari Oikarinen
d31a68146d Narrow tst_QDnsLookup::lookup blacklist to only CI
It is suspected that the fault actually lies in CI infra.

Amends e3cf2a1ae9.

Task-number: QTBUG-66311
Change-Id: I967da283f0b94be1d0b99481d0cbd15ca7f98d45
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-04-04 05:05:51 +00:00
Kari Oikarinen
c7dac6469c tst_QThread: Use QTRY_VERIFY instead of qWaits
These two places were sort of manually implementing QTRY_VERIFY except that they
never time out.

Change-Id: I136e6c7400194327c0475c6acfc019825ccec1b5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
2018-04-03 10:20:36 +00:00
Kari Oikarinen
231ac1b878 tst_QFutureWatcher: Avoid unconditional qWait()s
Use QSignalSpy::wait or QTRY_VERIFY instead. This shaved off ~200 ms of the
running time of the test and is more reliable.

Some unconditional qWait()s still remain in this test. They are giving an
opportunity for the wrong thing to happen and thus are not waiting for any
specific condition to be fulfilled.

Task-number: QTBUG-63992
Change-Id: I25a4470fe8d6a5b8b5039b3ed77321d24faa1707
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-03 10:20:27 +00:00
Qt Forward Merge Bot
ffb2c2ac6c Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I33b47095efdfe0ba698c6a88ca41ec911f432208
2018-03-31 01:00:13 +02:00
Samuel Gaist
6d0044f1dc Add wildcard-to-regexp support to QRegularExpression
This method will make QRegularExpression on par with QRegExp and
will allow to replace this class when a wildcard expression can be
set through an API (e.g. QSortFilterProxyModel::setFilterWildcard).

For other use cases, see QTBUG-34052.

[ChangeLog][QRegularExpression] Implemented support for wildcard
patterns.
Warning: QRegularExpression might not give the exact same result
as QRegExp as its implementation follows strictly the glob patterns
definition for the wildcard expressions.

Change-Id: I5ed4617ca679159430c3d46da3449f6b3100e366
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-30 16:34:30 +00:00
Qt Forward Merge Bot
17f4d159a9 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: If9cc79a7cc098104333821bc3b345f6890f01825
2018-03-30 01:00:14 +02:00
Friedemann Kleint
f3a461c4a2 Stabilize tst_QGraphicsProxyWidget::tooltip_basic()
Use QTRY_VERIFY instead of hard-coded wait for the tooltip to appear.
Also use QTRY_VERIFY to verify that no top level widgets are left over
to account for tooltips and effect windows.

Change-Id: Ia9835fdc480c6abb034f6fc4ad3d6b32751ee536
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
2018-03-29 20:50:00 +00:00
Oswald Buddenhagen
e5d909d6d6 qmake: make VFS aware of exact vs. cumulative evaluation
sync-up with qt-creator; no effect on qmake.

comment on cherry-pick: this is actually a lot more than a cherry-pick,
because the dual VFS needs to deal with the file ids which were
concurrently introduced on the qmake side.

Change-Id: I2c1eb16c97526fa275a1c6a2eae9266d385859ac
(cherry picked from qtcreator/424639ecac9d2e404d2bfaff7f46b45ed98664b8)
(cherry picked from qtcreator/a8010b0fff47d903d4a1f80e3adb1a2ef41beb33)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-03-29 18:15:10 +00:00
Oswald Buddenhagen
e2de837198 qmake: let QMakeVfs::readFile() report ENOFILE explicitly
when the QFile object is already constructed, querying whether the file
exists is actually cheap, so do it right away instead of later on
demand. that makes the calling code a bit cleaner.

fwiw, that we need to explicitly query the file's existence at all is a
result of QFile's completely useless error "codes" (which merely say
which function failed, as if the caller would not know).

Change-Id: Ifec39d05b1713d8128046f679287e510f10e45dc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
(cherry picked from qtcreator/5ba32e3484ead2e35cc7732dcd59a97e7459dbfd)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-03-29 18:14:58 +00:00
Kari Oikarinen
e3cf2a1ae9 Blacklist tst_QDnsLookup::lookup
Task-number: QTBUG-66311
Change-Id: I8b7536bc11763b8405ecbe5c86be94c2af036c6e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2018-03-28 14:05:43 +00:00
Kari Oikarinen
ab4f3704d8 Blacklist tst_Gestures::customGesture on openSUSE and Ubuntu
Has been flaky on those platforms in CI.

Task-number: QTBUG-67254
Task-number: QTBUG-66216
Change-Id: Ia1a718a23b1992fcc0e85bf49b714bc43acc4ce2
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2018-03-28 11:41:07 +00:00
Kari Oikarinen
be674bcdc5 tst_QLocalSocket: Only expect debug messages if debug level is enabled
Otherwise the ::debug() test fails when a build does not print qDebug()
messages.

Change-Id: I3f3c4b3c7d74004abe5ed8d7ac52164d4f88ef1f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-03-28 11:40:44 +00:00
Liang Qi
794781e7cf Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/cocoa/qnsview_mouse.mm
	src/testlib/testlib.pro

Change-Id: Ia0ce4243418fe6a485b0f290c67bd433b3b04ff2
2018-03-28 08:12:21 +02:00
Tor Arne Vestbø
f69d32b535 testlib: Ignore line locations from TAP reporter when running selftests
This is what the other reporters also do, in various forms.

Task-number: QTBUG-67351
Change-Id: I16f2c4e0991176145ee0fbcbbfeeda071603a3c2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-03-27 19:34:04 +00:00
Andy Shaw
7775eb248a sqlite: Support using execBatch() with duplicated named placeholders
Also expands the tst_qsqlquery::batchExec() test to account for this
case and generally test the functionality. In addition it is made to be
more robust to avoid any discrepencies with the testing data. The test
in general is also cleaned up to enable more of it being tested with
the different database drivers where possible.

An expected fail is added for MySQL due to the fact that it has a bug
where null timestamp entries are being converted to the current
datetime when adding it as a bind value.

Change-Id: I0061bd1c69ae35b4858afc49420f13ce59cf48ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-03-27 16:50:19 +00:00
Alex Trotsenko
cdbd68fc2f Allow QWinEventNotifier to coexist with waiting functions
Many subclasses of QIODevice have a functionality to block execution
until some asynchronous I/O operation completes. In case we are using
QWinEventNotifier, a typical reimplemented waitFor{ReadyRead
|BytesWritten}() function could look like:

  if (WaitForSingleObject(notifier.handle(),...) == WAIT_OBJECT_0) {
      notifier.setEnabled(false);
      ResetEvent(notifier.handle());

      bool res = GetOverlappedResult(...);
      ...
      return true;
  }

Despite the fact that the operation ends synchronously, it leaves the
notifier in a state that indicates it has received the event, so its
next call to setEnabled(true) will produce a fake notification.

So, we should reset a notifier's history before enabling it again.

Change-Id: I62a9dd809ce6a7a40e9d8038f2a49299b36f8142
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-03-27 15:08:46 +00:00
Eirik Aavitsland
c7c41fa1c6 Fix QPainter save/restore of clipping enabled state
Clipping enabled state would not always be correctly restored for the
raster engine (other engines work fine). The raster engine's QClipData
object is sometimes shared between painter state objects on the
save/restore stack. QClipData has its own enabled flag, and this could
then come out of sync. Fix by making sure we sync the enabled state on
restore.

Task-number: QTBUG-58789
Change-Id: I81e6254ebb93df6e153bbef58e32a885273e3224
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-03-26 16:00:43 +00:00
Svenn-Arne Dragly
50cfbd6112 Animation: Fix case where QEasingCurve::valueForProgress returns nan
Previously, we would divide by zero in BezierEase::findTForX if factorT3
was zero when solving the cubic equation.

This change fixes the problem by adding solutions for the special cases
where the cubic equation can be reduced to a quadratic or linear
equation.

This change also adds tests that cover cases where the equation becomes
quadratic, linear or invalid.

Task-number: QTBUG-67061
Change-Id: I2b59f7e0392eb807663c3c8927509fd8b226ebc7
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2018-03-26 15:53:10 +00:00
Eric Lemanissier
edf96b984d fixup oversight in rvalue overloads of operator+=() and operator<<()
ammends 4dee5446be

Change-Id: Ia0ca27644eb71815a93d6e76681b8a9e61a4e7ab
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-03-26 14:29:47 +00:00
Sergio Martins
a6d1456458 Add QTimer::connectTo(), a shorthand way of connecting to timeout()
There are a couple of Qt classes where you almost always use the
same signal, for example QTimer::timeout, QPushButton::clicked,
and QAction::triggered.

Simply doing timer.connectTo([]{}) is much more convenient, less
tedious and even fun.

Not overloading connect() as it would be confusing to see the
receiver as first argument.

And not naming it onTimeout, as that's a popular way of doing it in
other frameworks. People would assume you could use on* with any signal.
If we ever have on* it should be all or nothing.

[ChangeLog][QtCore] Added QTimer::connectTo(), a shorthand way of
connecting to the timeout() signal.

Change-Id: Ida57e5442b13d50972ed585c3ea7be07e3d8e8d2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-03-25 21:17:20 +00:00
Kevin Funk
02ed1b36da Remove CMake code for CMake < 3.1
This removes the following functions from Qt5CoreMacros:
- qt5_use_modules(...)

Task-number: QTBUG-63519
Change-Id: I59769060a3a93686bf319b558c0ede55755fdb70
Reviewed-by: David Faure <david.faure@kdab.com>
2018-03-24 22:31:18 +00:00
Alex Trotsenko
927db42882 tst_QWinEventNotifier: fix flakiness
disableNotifiersInActivatedSlot(disable_signaled2) fails, if a signaled
state of the event #2 is detected prior to the event #1. In this case,
we get a timeout on waiting for event #1 which was disabled by the
first notification.

So, accept a disabled state of the notifier in condition for successful
exit from the loop.

Change-Id: I8a2fe76f8ec9362556d1ca1fe0be39a93ed58977
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-03-23 18:09:24 +00:00
Kari Oikarinen
8e93988cce Blacklist tst_QProcess::softExitInSlots on Windows
Task-number: QTBUG-66903
Task-number: QTBUG-66216
Change-Id: I4a36d6f4b980f016e11fd7a8840dbc60a2964e83
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2018-03-23 07:11:04 +00:00
Harald Nordgren
97e40a5409 Allow adaptive decimal stepping for QSpinBox and QDoubleSpinBox
Adds the feature of adaptive decimal step sizes for the QSpinBox and
QDoubleSpinBox. By performing a calculation in
QAbstractSpinBox::stepBy() we continuously set the step size one power
of ten below the current value.

So when the value is 1100, the step is set to 100, so stepping up once
increases it to 1200. For 1200 stepping up takes it to 1300. For
negative values stepping down from -1100 goes to -1200.

It also works for all decimal values. 0.041 is increased to 0.042 by
stepping once, and so on.

The step direction is taken into account to handle edges cases, so that
stepping down from 100 takes the value to 99 instead of 90. Thus, a
step up followed by a step down -- or vice versa -- lands on the
starting value; 99 -> 100 -> 99.

Setting this property effectively disregards singleStep, but preserves
its value so that it takes effect again when adaptive decimal step is
disabled.

Adaptive decimal step allows values to be easily set to reasonable
levels. If the spin box value is 12000, changing to 13000 often makes
more sense than to 12001. The feature is turned off be default, when
single stepping is desired.

The accelerated property allows values to be changed quickly, as well,
but it is imprecise. Holding down the button makes it hard to land on
an even thousand, like 12000 or 13000. Often you end up somewhere
nearby and would need a second adjustment to get to an even hundred or
thousand.

[ChangeLog][QtWidgets] Add option of adaptive decimal step size for
QSpinBox and QDoubleSpinBox.

Change-Id: I9f286479b821e240c8ea05c238932fc128c582bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-03-22 21:37:45 +00:00
Kari Oikarinen
141582505f Stabilize tst_QGraphicsView::acceptMouseDoubleClickEvent
This test has been flaky on openSUSE in CI. The problem was that the window is
sometimes resized or removed while processing events after adding the rectangle
item to the QGraphicsScene. When the same mouse event is reused again, it uses
wrong screen coordinates. QGraphicsScene handling of mouse events then looks for
items under cursor at the wrong coordinates, does not find any items and thus
doesn't accept the mouse event.

Fix by using QTest API for simulating mouse events. Also wait for changed signal
rather than blindly running one iteration of event loop.

Task-number: QTBUG-67212
Task-number: QTBUG-66216
Change-Id: I968f9470c6f8803d01cebeda6f12ad76b4fd5293
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-03-22 13:35:51 +00:00
Edward Welbourne
58b373c9e3 Make sure $$relative_path() uses an absolute path as its first arg
Thanks to QTBUG-61373, this qmake function was called with
/usr/local/5.10.1 as baseDir, which isn't absolute, leading to an
assertion failure.  We could raise the error within qmake but it
proved easier to simply resolve any non-absolute baseDir using PWD,
before trying to use it as an absolute path.

Did the same for $$absolute_path().  Documented both.  Adjusted the
assert that caught this to report any non-absolute path that upsets
it.  Added simple tests, fixed an existing test.

Task-number: QTBUG-66156
Change-Id: Icfef2e2f5b236e071177c9beffa38d71bf404292
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-22 08:40:45 +00:00
Ulf Hermann
90ec3aba06 Clean up the moc "no-keywords" test
We can use the QT_LIB_FOO #defines instead of our own WITH_FOO ones to
determine if a library is available. Also, it doesn't currently make
sense to refer to libraries which are not part of qtbase here. We might
add that in the future, but QtScript (being deprecated) is probably not
the first one we should add.

Change-Id: I7f2397ca5499ba6003088478161182e960e815fb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-21 10:31:20 +00:00
Qt Forward Merge Bot
cc920b4cdd Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I35a6555e3885e489f88aa9b4b0142e1017f7a959
2018-03-21 08:59:26 +01:00
Allan Sandfeld Jensen
a65e383cac Switch lancelot from QRegExp to QRegularExpressions
They are faster, and using them makes it paint commands be the most
CPU intensive part of lancelot instead of regular-expression matching.

Change-Id: Ifabf1081c48a83ce089660049051428fd3a43042
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-03-20 09:00:14 +00:00
Thiago Macieira
081c001deb QSemaphore: fix deadlock when the woken up thread wakes up another
When the thread that got woken up by release() is supposed to release()
to wake up another thread, we were deadlocking. This happened because we
cleared the bit indicating that there was contention when the first
release(). Instead of storing a single bit, we now store the number of
threads waiting.

Task-number: QTBUG-66875
Change-Id: I72f5230ad59948f784eafffd15193873502ecba4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-19 20:36:51 +00:00
Morten Johan Sørvig
2776d663aa Don’t show file dialog before calling selectFile()
selectFile() is a no-op if the dialog is visible and
its line edit has focus, which will happen at some
point after show() is called.

In other words this is a race, and the test will pass/fail
depending on the timing of the platform implementation.

Task-number: QTBUG-66536
Change-Id: I03957edb6496d17af7a8ed1d4ca86435375e0d40
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-19 14:39:33 +00:00
Morten Johan Sørvig
dd96a62fca Fix focusObjectDuringDestruction crash
Don’t assume that there is an active modal widget
on QApplication::focusChanged(). That signal can also
be emitted on focus clear during dialog destruction.

Task-number: QTBUG-66536
Change-Id: I20c64339c56a52b39c26a7683b62779deba576d9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-19 14:39:08 +00:00
Morten Johan Sørvig
dae8133ded Stabilize tst_qgraphicsitem and tst_qgraphicsview
Add qWaitForWindowExposed() calls in addition to the
existing qWaitForWindowActive().

Depending on the platform, window activation events may
be synchronous, which means that a window can (and will)
become active before it becomes exposed.

This causes test failures for tests that count paint
event, and does not wait-for-exposed, when the expose/paint
event is delivered after waitForWindowActive() has returned.

We need to keep the waitForWindowActive() as well: the
test has several qWait() calls with he comment:
  “Increase the probability of window activation not
   causing another repaint of test items”.
These qWait() calls can possibly be removed in a future
commit.

Task-number: QTBUG-66536
Task-number: QTBUG-61967
Change-Id: Ie61bba058b583fdd1d80e600475aff3efccc32eb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-19 14:38:23 +00:00
Morten Johan Sørvig
b4650d9bcf Blacklist childEvents on macOS CI again
This test function was removed from the blacklist as
a part of the cleanup in 2056bc6b, but is still flaky
on CI.

Change-Id: I348ed167dff6fd618ede28456ada6da86ee341cd
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
2018-03-19 14:38:06 +00:00
Albert Astals Cid
f1b0ce40d6 Fix tst_QAbstractPrintDialog::setMinMax
Task-number: QTBUG-22637
Change-Id: I954988909f3ecaaf510653bf061096dd61d14fdf
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-03-19 10:21:14 +00:00
Johan Klokkhammer Helsing
2417cade46 tst_QOpenGLWindow: Move resizing to separate test
Resizing is broken on Wayland EGL on Intel Mesa. Move resizing into a separate
test and skip it on Wayland it until it's fixed in Mesa.

Task-number: QTBUG-66848
Change-Id: I9450a5a588b0f5d8f0bd0210aae2dc72aa48d622
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2018-03-19 08:24:33 +00:00
Johan Klokkhammer Helsing
efa6e98912 QPixmap don't assume QPlatformScreen::format is opaque
QRasterPlatformPixmap::systemOpaqueFormat returned QPlatformScreen::format
without checking that the format was actually opaque.

This caused several QPixmap tests to fail on Wayland because Wayland
compositors don't communicate the native format of the screen, just a list of
supported pixel formats, so we just return ARGB32_premultiplied in
QWaylandScreen::format().

Rename the method systemOpaqueFormat to systemNativeFormat since that's how
it's used most of the time. And do a conversion when we actually care whether
the format is opaque or not.

Task-number: QTBUG-51748
Change-Id: I47dc1c3f185fb802016ca361206d47d02e8d3cf1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-03-19 08:23:54 +00:00
Thiago Macieira
639ce9e55e Add nullptr comparison to Q{Explicitly,}SharedDataPointer
[ChangeLog][QtCore][QSharedDataPointer] Added operator== for nullptr.

[ChangeLog][QtCore][QExplicitlySharedDataPointer] Added operator== for
nullptr.

Task-number: QTBUG-66635
Task-number: QTBUG-66946
Change-Id: I72f5230ad59948f784eafffd151a18e34384d844
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-03-18 17:28:26 +00:00