For some reason, the overload resolution of the
High DPI scale() functions introduced by
b6ded193ee chose the
wrong overloads for QPointF and/or QPoint; it fell
back to the generic template intended for qreal,
QSize, etc, ignoring the origin. Remove the
template and spell out all overloads.
Fixes: QTBUG-77255
Change-Id: I5661f16f7326f65156f646f430f5a0c71d5302d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Lookups performed via QHostInfoRunnable must not synchronously call
the user-code's receiver objects, as that would execute user-code in
the wrong thread. Instead, post a metacall event through the event
loop of the receiver object, or the thread that initiated the lookup.
This was done correctly for the trivial cases of empty host name or
cached results, so the code generally existed. By moving it from a
global function into a member function of QHostInfoResult, we can
simply access the required data to construct and post the event.
As we process that posted event, we need to check that the context
object (which is already guarded via QPointer) is still alive, if
we had one in the first place. If we had one, and it's deleted, then
abort.
[ChangeLog][QtNetwork][QHostInfo] Functors used in the lookupHost
overloads are now called correctly in the thread of the context object.
When used without context object, the thread that initiates the lookup
will run the functor, and is required to run an event loop.
Change-Id: I9b38d4f9a23cfc4d9e07bc72de2d2cefe5d0d033
Fixes: QTBUG-76276
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QNetworkAccessManager::connectToHostEncrypted()/connectToHost()
creates 'fake' requests with pseudo-schemes 'preconnect-https'/
'preconnect-http'. QHttp2ProtocolHandler should handle this
requests in a special way - reporting them immediately as
finished (so that QNAM emits finished as it does in case of
HTTP/1.1) and not trying to send anything.
We also have to properly cache the connection - 'https' or
'http' scheme is too generic - it allows (unfortunately)
mixing H2/HTTP/1.1 in a single connection in case an attribute
was missing on a request, which is wrong.
h2c is more complicated, since it needs a real request
to negotiate the protocol switch to H2, with the current
QNetworkHttpConnection(Channel)'s design it's not possible
without large changes (aka regressions and new bugs introduced).
Auto-test extended.
Fixes: QTBUG-77082
Change-Id: I03467673a620c89784c2d36521020dc9d08aced7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
When successfully finishing a parse, it's reasonable to expect that the
QIODevice was advanced to the end of the input data.
[ChangeLog][QtCore][QCborStreamReader] Fixed a bug that caused the
QIODevice that the data was being read from not to show the entire CBOR
message as consumed. This allows the user to consume data that may
follow the CBOR payload.
Fixes: QTBUG-77076
Change-Id: I1024ee42da0c4323953afffd15b23f5d8fcc6f50
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
1. Use per-case QNAM objects
2. In a slots (connected to QNetworkReplies) - if an error detected - stop
the event loop (no reason to continue waiting) and then do normal
QVERIFY/QCOMPARE things.
3. In tests, check QTest::currentTestFailed after the event loop returned -
if an error was detected by a slot, no need to continue with QCOMPARE/QVERIFY
in the test itself.
Task-number: QTBUG-77053
Change-Id: I3827a629a2749becd3dc6eee7fd6994d96441e65
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
fix the bloody test for good - the idea to have a shared QNAM (shared
by test cases in this test) was somewhat wrong to start with.
Fixes: QTBUG-77053
Change-Id: I5755e96ec988e2dd546f527f3f902fc43914b0b7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The public QWidget::create still has them, but we don't need to
propagate them on - that just makes debugging the window creation
flow harder.
The window argument to QWidget::create is technically used to
guard an early exit in the function, but to keep behavior the
same we leave it for now.
Change-Id: Ic0287575aa25f1272e216adc1b75e34d6f55f6d9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The call to QFileDevice::unsetError() in QSaveFile::open() does
not clear QSaveFilePrivate::writeError. Clear it in addition.
Fixes: QTBUG-77007
Change-Id: I5e5009750f1726d1c74c1b4eb1c33f3a5393fe4f
Reviewed-by: David Faure <david.faure@kdab.com>
The previous code handled only some error codes, in a very inefficient
way, for some code paths. This change standardizes error handling using
a helper function that maps winsock WSAE* codes to Qt error codes.
The test for connecting to unreachable hosts or ports is now more
generic, and enabled on Windows, where it passes in local tests,
but dependency on network configuration still makes it fragile,
so ignoring some failures without completely skipping the test.
[ChangeLog][Network][Windows] Correctly emit errors when trying to
reach unreachable hosts or services
Change-Id: Icaca3e6fef88621d683f6d6fa3016212847de4ea
Fixes: QTBUG-42567
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Counting absolute paint events is fragile, as there are no guarantees
that a single call to QApp::processEvents only delivers a single paint
event to a widget. As of QTBUG-76566, we see that the items occasionally
receive three calls to paint, which can be simulated by activating other
windows while the test is running and waiting for events to be
processed.
Instead, verify that we do receive any paint events as the first test,
and then verify increments when we expect updates.
This also reverts change 24b9424adc.
Change-Id: Ib51853e918f31acd3aea10d4109c95f34012a29f
Fixes: QTBUG-76566
Reviewed-by: Dimitrios Apostolou <dimitrios.apostolou@qt.io>
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
The QTest::mouseMove calls are not reliable, and seem to produce
flakiness, at least on WinRT. Removing them, and only depending on
handling of the synchronously delivered QMouseEVent for simulated
mouse moves.
Also, initialize the expected cursor shape from an empty scene;
this avoids that showing the view with the cursor accidentially
on an item results in the wrong default shape. Remove hard
coded coordinates, just test what we know.
Fixes: QTBUG-73545
Change-Id: I6f81d6b16bb613ec77aaa776d6a80aac739aeb58
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
As with widgets, items that are disabled should not receive any input
events.
Similar to QGraphicsScene, which ignores disabled items when handling
mouse presses, the view should also ignore them when handling mouse
moves to update the cursor.
Since QGraphicsView only adjusts the cursors on mouse moves, reenabling
an item that is currently under the mouse will not change the cursor.
This is consistent with other changes of item attributes that would
position the item under the mouse (such as moving it). The overhead of
hit-testing items for every such attribute change would be too large,
and applications can generate a mouse move event if they really need
to adjust the cursor in all situations.
[ChangeLog][QtWidgets][QGraphicsView] Ignore disabled items when setting
the mouse cursor.
Fixes: QTBUG-76765
Change-Id: Ifcd31fc0581e8421e58eeb436a55b031909eed7e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The tests send QEvent::MouseMove events to the view, but don't fully
construct the event with both local and global position. Consequently,
QMouseEvent will use QCursor::pos as the global position, which is
unreliable, as QTest::mouseMove can not guarantee that the mouse really
moves - when running the tests locally on e.g macOS, it never does.
So instead construct the QMouseEvent with the trivially calculated
global position.
Change-Id: Ic4c914e3af7f15751545080d4743b06d3887cce8
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
This reverts commit 9a25d27b9d58316dee5d2305135d2d74ad5d51e7.
The QSKIP is no longer needed as the imap server's certificate
was updated
Task-number: QTBUG-76610
Change-Id: I1007ce50d6f7f6258fdeb8894c66678a660b03ca
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This is the most flaky-pass test currently.
It fails the first time it is run on MacOS_10_12, but
succeeds all the following times.
This happens extremely often, so disable it until the issue
is resolved.
Task-number: QTBUG-76566
Change-Id: I94359eceb91c3b958930424e6c8b5957fb3f1252
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QWidgetPrivate::updateIsTranslucent sets the surface format of the
window with the alpha based on the translucency attribute, so we need
to call this function when the attribute value changes. The test can
confirm that the window's requested surface format has changed, we
can't rely on what is actually set, and don't have to rely on
hard-coded values like 8bit alpha.
While WA_NoSystemBackground needs to be set for WA_TranslucentBackground
to have an effect, we can't clear the attribute when clearing
translucency (as it might have been set explicitly).
Change-Id: I238d6930b7e0488397467a4e035b5f530566a1ff
Fixes: QTBUG-60822
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When calling waitFor{ReadyRead,Disconnected} it will wait for data but
if the data is already received and the read notification has been
queued (and there's no more data coming in) it will return false.
By checking if a read notification has been queued and then handling
this we can easily take care of this scenario.
Fixes some flaky tests which missed the read data in waitForDisconnect
and similar.
Fixes: QTBUG-38385
Change-Id: Ic05d59883c1175783e56ff1822b6636c35aec874
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The completer popup has focus, making QShortcut direct to it's window
rather than to the window the completer belongs to. As QShortcut handles
the case for Tool windows that have a parent, but doens't do the same
for popups. And they shouldn't be treated the same way, as a context
menu popup for a e.g. text edit should in fact block the text edit's
shortcuts while open.
However, the completer popup is special, in that it explicitly makes the
widget completes for its focusProxy, which is what we can use to fix
this issue.
Change-Id: Ie7177d39668b3af14a1d9e0ee5d93eca9c67c8af
Fixes: QTBUG-4485
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
81e298a51d fixed a case where the focus
chain was screwed up when the order was already correct. This worked
correctly in most cases but not when the next focus widget of the first
one had Qt::NoFocus.
The optimization check if lastFocusChildOfFirst is the same as second is
thrown away since it now does not longer screw up the focus chain and
the save would only be four pointer assignments.
Fixes: QTBUG-75388
Task-number: QTBUG-10907
Task-number: QTBUG-68393
Task-number: QTBUG-69619
Change-Id: I581ed532156c34ea970123afd063194aab016304
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QSslSocket (OpenSSL backend) does not use mutex/locks during
a handshake, so we re-enable previously skipped tests.
This reverts commit 8c87a1402c.
Change-Id: I994b085f016f0eb18b3ba439a7041ea08cd3577b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is the worst fix ever, adding one more qWait. The test has been
updated in the 5.13 branch, so there a different fix will be needed. For
now this is in line with the rest of the code.
This test is currently one of the worst offenders when it comes to flaky
tests.
Task-number: QTBUG-64639
Change-Id: Ia1e71cc948997408b9658839013c9ad098111033
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
If this callback is not set then OpenSSL will call the callback
used for <= TLS 1.2 unconditionally when connecting. If using PSK it
will call it again later once the preshared key is needed.
We don't currently handle the TLSv1.3 PSK, but we definitely should.
But for now we can work around it - when psk_use_session_callback is
called we simply change the PSK callback to a dummy function whose only
purpose is to restore the old callback.
This is mostly done to keep behavior the same as it is now for users
(and to keep our tests running).
Later we can add a new signal and handle this new feature properly.
Task-number: QTBUG-67463
Change-Id: I4aca4ae73ec4be7c4f82a85e8864de103f35a834
Reviewed-by: Simo Fält <simo.falt@qt.io>
In this threaded setup the server can sometimes have the data before it
calls "waitForReadyRead", what happens then is that we fail the wait and
as a result the test fails overall.
Let's check if we actually got some data after all and then continue if
we did. Since both the client and the server currently wait the same
amount of time (2s) the max timeout for the client was increased by
0.5s so it has some time to notice that the server got the message.
Change-Id: Ib5915958853413047aa5a7574712585bcae28f79
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e79b1dcdf5)
Reviewed-by: Simo Fält <simo.falt@qt.io>
We use global object to store errors found by q_X509Callback.
Thus, we also use a lock/mutex. It would appear all tests
involving in-process server and QNAM are prone to intermittent
failures on our Windows VMs - it's always about timeouts due
to the client socket (QNAM) locking and the server socket blocking
main thread while trying to acquire the same lock.
The real fix is to get rid of global variable/locking, we'll
have it later (quite a change and requires a lot of accuracy).
Task-number: QTBUG-76247
Change-Id: Iffc90d9e16783f17f62e836e01c35f22681bdd39
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 91ab70d17f)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
The code for generating round line joins is optimized with a shortcut
for the inner, normally invisible joins. For certain joins of a
tightly turning bezier, this optimization would lead to visible
painting error. Fix by avoiding the optimization if the next control
point is so close as to allow such tight turns.
As a driveby, make the angle > 90 test cheaper, since absolute
precision is not required in the optimization choice.
Fixes: QTBUG-75008
Change-Id: I293e0776003310dc36fa7f43fbcd9c25f1f8fa5d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
@3x is in use on iOS already, so extend the handling in QImageReader
to all single-digit factors, like QIcon does.
Fixes: QTBUG-76273
Change-Id: Ic9442731c0549dbe8f797e1ddb1a09d8447e8441
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Fix test for systems that do not resolve their hostname to localhost.
Not using name resolution also makes the test more robust.
Change-Id: I558b9a975b9021536709db87fbf6a3b314f7ca79
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The value of NColorRoles got changed since 5.11. It introduced one more
role called "PlaceholderText" in the ColorRole enumeration.
When using QDataStream (5.12) to read QPalette objects from a file
written by 5.9 (<5.11), the processing results are inconsistent.
Fixes: QTBUG-74885
Change-Id: I14d57f9603a26e5890b4fd57c7e464c5b38eb3f2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The test is failing in 5.13 for unknown reasons.
Task-number: QTBUG-72296
Task-number: QTBUG-72344
Change-Id: I24c1ad1b6def3096de99caeeebeee6e204cc75ca
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The window tends to grow to span screens in multi-screen setups; force it to
be on the primary screen by showing it maximized in that case.
Change-Id: I984ba7a4cd4abd1f862c59c8dca0e2275f44c724
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
- Use nullptr
- Use range-based for
- Use correct static invocation
- Set a title on shown windows to make it possible to identify
slow tests
- Fix the class declarations, use override, member initializations
- Use Qt 5 connection syntax where possible
- Ensure top level widget list is empty after each test, delete left-over
menu bars and disable menu animations
Change-Id: Ieeb943ea669cd139f1835088b816802e777a9676
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Use a fuzz check (cf 6309062722) and a minimum
size similar to tst_qwidget to make the test pass on large monitors with or
without active scaling.
Change-Id: I5a9e28e38e1d007057894c349c94f0e6fe12009c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
- Use nullptr
- Fix C-style casts
- Fix redundant bool expressions
- Fix else after return
- Remove unnecessary casts to int from registered enums
- Fix most signedness-related warnings
- Use range-based for
- Use correct static invocation
- Set a title on shown windows to make it possible to identify
slow tests
- Fix the class declarations, use override, member initializations
- Use Qt 5 connection syntax
- Remove unused variables
- Streamline code in some cases
Change-Id: I1350b382b0b7d0f3198039fdc78892cfa1dd498d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- Use nullptr
- Fix C-style casts
- Remove unnecessary casts to int from registered enums
- Fix most signedness-related warnings
- Use range-based for
- Use correct static invocation
- Set a title on shown windows to make it possible to identify
slow tests
- Fix the class declarations, use override, member initializations
- Streamline code in some cases
Change-Id: I4c9b99126cff02136def0e03accdf1129fe6d72b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
- Use nullptr
- Fix C-style casts
- Use range-based for
- Use correct static invocation
- Set a title on shown windows to make it possible to identify
slow tests
- Fix the class declarations, use override, member initializations
- Use Qt 5 connection syntax; use lambdas where applicable
to remove helper slots
- Streamline code in some cases
- Replace helper function to convert touch points by the one in
QWindowSystemInterfacePrivate
- Use a logging category for the debug outpt, silencing some output
Change-Id: Ia46c7ad7c08f3afc8e5869ea99b66e406de97781
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
It's not clear why this test fails - and only does so sometimes - but
fail it does, so we ned to skip it to let development keep going. As
it happens, the same platform over-optimizes various computations
using qfloat16; which can at least be used to test for this platform,
since it wrongly distinguishes two qfloat16 values that theory and all
other platfomrs agree should coincide.
Fixes: QTBUG-75812
Change-Id: Ie9463d7dc21bca679337b475d13417b9f42bbf9b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
If the deadline is far in the future, the conversions to nanoseconds
or internal arithmetic may overflow and give an invalid object, thus
the deadline may end up in the past. Added a test to the testlib
selftest for sleep.
[ChangeLog][QtCore][QDeadlineTimer] Fixed integer overflows
leading to immediate timeouts.
Task-number: QTBUG-69750
Change-Id: I9814eccdf9f9b3add9ca66ec3e27e10cd5ad54a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Note that the test is still disabled, but this is needed in any case.
Change-Id: Ib7523ba800b94c32690c1bd09b23fc2078c71d4e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
We have been rather sloppy in how read-only versus editable is handled.
According to the definition, editable signifies that in principle a
widget allows the user to change its text. Read-only means that this
ability is (currently) disabled.
Task-number: QTBUG-75002
Change-Id: I5d71843abcdaac52f4a60a1abcac2604341f6c96
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
The formatting of times in Norwegian has reverted to using dots in
place of colons, as it did before v31 (commit 82deb0ad1), so reverted
the tests to their state before that.
Change-Id: I8a09ce253731bb0f0f3caca117f06ad568940a81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Also de-duplicate the "monospace" string in qgenericunixthemes.cpp,
and add tst_QFontDatabase::systemFixedFont() to verify that
QFontDatabase::systemFont(QFontDatabase::FixedFont) really returns
a monospace font across platforms. Replace commented-out qDebug()s
with qt.text.font.match and qt.text.font.db logging categories to
troubleshoot when the test fails (among other uses). Add qt.qpa.fonts
logging category to unix themes to show default system and fixed fonts
(font engines on other platforms are already using this category).
Fixes: QTBUG-54623
Change-Id: I2aa62b8c783d9ddb591a5e06e8df85c4af5bcb0c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
- Never for global inputs
- Otherwise only if the temporary is referenced more than once
-> meaning it's actually caching the result of some operation
Tests updated accordingly.
Change-Id: Ic76615370d23dee3965ca6350d5257a8be5a3e22
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>