Commit Graph

7686 Commits

Author SHA1 Message Date
Liang Qi
7bbb9a8ce8 Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-10-05 12:38:45 +00:00
Milla Pohjanheimo
2755e02f07 Increase timeout for tst_QXmlSimpleReader::inputFromSocket() test
The test tst_QXmlSimpleReader::inputFromSocket() is failing with
"QTestLib: This test case check ("(((server->listening)))") failed
because the requested timeout (5000 ms) was too short, 11700 ms would
have been sufficient this time".
Increased the timeout, since it's better to wait than to fail.

Task-number: QTBUG-63539
Change-Id: I804549648ea834e41d3c87871f5bab90f209385c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-05 10:22:12 +00:00
Svenn-Arne Dragly
ba423261cd Improve performance in QThreadPool
When many runnables are executed, this improves the
performance by not resizing the queue for each runnable,
which was the case in the previous version, because of
many calls to QVector::takeFirst().

Also add a test that makes sure tryTake() is safe to
call and does not leave the queue in a bad state that
tries to use nullptr entries.

Change-Id: I608134ecfa9cfc03db4878dcbd6f9c1107e13e90
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-10-04 12:00:33 +00:00
Gatis Paeglis
d7c57fa68e tests: un-blacklist tst_QMenuBar::taskQTBUG4965_escapeEaten
We can't qWaitForWindowExposed on native menu bars. Other test
functions in this file are already disabling the native manu bar.

Task-number: QTBUG-24326
Change-Id: Iecf907ca84589159417d0d942c911485a41af164
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-10-04 11:41:55 +00:00
Liang Qi
bc5f45052f Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/corelib/global/qconfig-bootstrapped.h
	src/corelib/global/qglobal.h
	src/corelib/tools/qcryptographichash.cpp
	src/corelib/tools/qcryptographichash.h
	src/corelib/tools/qmessageauthenticationcode.cpp
	src/plugins/platforms/windows/qwindowswindow.h
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST

Change-Id: Ib68112de985a3d714c2071f47c10e907e4f0229a
2017-10-04 13:41:04 +02:00
Richard Moe Gustavsen
b4981f9d4c Widgets: change QWidget::setTabOrder to understand compound widgets
A "compound widget" is a widget that has a focus proxy set to an inner
child. This is normal for complex black-box components where focus handling
is delegated to the children. Since the compound can have several
children, a local tab order might exist between them.

The current implementation of setTabOrder had no idea about
compound widgets. As such, when connecting two compounds in the
tab chain, it would just break up their inner tab order and
cause tabbing to ignore children other than the proxy.

The new implementation recognizes compound widgets, and add some
extra code to figure out the correct tab targets. This way, the
local tab order between the children will be preserved.

This implementation was inspired by the patches of Marek Wieckowski posted
in the linked bug report, and later modified by Nikita Krupenko.

[ChangeLog][Widgets] QWidget::setTabOrder() will now preserve the local
tab order inside a widget if it has a focus proxy set to an inner child.

Task-number: QTBUG-10907
Change-Id: I0673d39d70ec8c6bf64af30bf978d67c651b2f3c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-10-04 11:27:18 +00:00
Timur Pocheptsov
3faf8f4d48 tst_QSsl(longlongnamefollows) - fix a flakey auto-test
The original test was using QSslSocket::waitForEncrypted function, which
is apparently a bad idea on Windows: connecting to 'www.qt.io' we have
to verify certs and there is no guarantee a given Windows VM has the required
CA certificate ready in its cert store. In such cases we start a background
thread (aka CA fetcher's thread) and it calls a (potentially blocking for
a significant amount of time) function (CryptoAPI). When finished, this
thread reports the results via queued connection, which does not work
if we are sitting in a tiny-loop inside waitForEncrypted. Re-factor
the test to use signals/slots and a normally running event loop.
Also, the last test makes a wrong assumption about Windows - fixed.

Task-number: QTBUG-63481
Change-Id: I4abe9cda2a6c52d841ac858cccb6bf068e550cb8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-10-03 16:37:30 +00:00
Samuel Gaist
b6f6920654 Change qrand() to QRandomGenerator in the SSL backend
Change-Id: I631649b2ad8d9c2c766e99a12f7ff3a39c79cc7d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-30 18:08:13 +00:00
Mårten Nordheim
8b64a1054a Fix cookies not being applied on redirect
Task-number: QTBUG-63313
Change-Id: I5245fc837557f19062cbbf0f1dfb86353c85229f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-29 14:44:13 +00:00
Tor Arne Vestbø
c3e93391ee qmake: Allow non-bundle apps and libs to have an Info.plist
Change-Id: I5fe5c8d3214876520b5259d478ac9ef887c61e95
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-09-29 10:08:08 +00:00
Jake Petroules
7fd3cc3980 Clean up OS version checks for Apple platforms
Convert QSysInfo/QOperatingSystemVersion to __builtin_available where
required or possible, or to QOperatingSystemVersion where
__builtin_available cannot be used and is not needed (such as negated
conditions, which are not supported by that construct).

Change-Id: I83c0e7e777605b99ff4d24598bfcccf22126fdda
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-29 03:30:13 +00:00
Paul Olav Tvete
ff2e9a17e7 Fix crash when reparenting window container
QWindowContainer assumed that a widget could never change from
native to non-native. This is not a fact when the window container
is reparented to toplevel and back. In this case, usesNativeWidgets
would be stuck at true, and parentWasChanged() would go down the
native widget path, triggering an assert.

The solution is to always recalculate the usesNativeWidgets bool.

Task-number: QTBUG-63168
Change-Id: I88178259878ace9eb5de2ee45ff5e69b170da71c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
2017-09-28 12:09:27 +00:00
Tony Sarajärvi
e96c56c740 Blacklist tst_QWindow:testInputEvents on RHEL 7.4
Swapping from RHEL 7.2 to 7.4 produces new autotest failures.

Task-number: QTBUG-63433
Change-Id: I3e59aa73b5874cfec06e166f521e06b0c7829743
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-27 18:46:51 +00:00
Thiago Macieira
f7350ac99e Improve qustrlen further by avoiding the alignment prologue
This avoids looping prior to the main 16-byte loop, by performing one
load that may include bytes prior to the start of the string. This is
guaranteed not to fault, since str points to a valid character, but it
may cause Valgrind to print warnings.

Change-Id: I6e9274c1e7444ad48c81fffd14dcae854bba24b2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-26 18:19:35 +00:00
Liang Qi
aadfe7d634 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/gui/kernel/qguiapplication.cpp
	src/platformsupport/input/libinput/qlibinputpointer.cpp
	src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/testlib/qtestsystem.h

Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
2017-09-26 16:14:54 +02:00
Paul Olav Tvete
35781b3588 Return focus to correct widget after showing menu
By the time we call setKeyboardMode(true), the menu may
already have taken focus. This change sets keyboardFocusWidget
before opening the popup, and makes sure that keyboardFocusWidget
is not set to the popup. (We cannot remove the assignment from
setKeyboardMode(), since it's called from several places.)

[ChangeLog][QtWidgets] Fixed widget losing focus after showing
menu second time.

Task-number: QTBUG-56860
Change-Id: Ic01726bf694e6f365dd7b601ad555156e0fdf6c5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-09-26 13:38:06 +00:00
Gatis Paeglis
542e11ab2b tests: make exposeEventOnShrink_QTBUG54040 not flakey on xcb
From: https://tronche.com/gui/x/xlib/events/exposure/expose.html

"The circumstances in which the X server generates Expose events
are not as definite as those for other events."

On windows with XCB_GRAVITY_NORTH_WEST flag set we should not get
expose events according to e2665600c0,
but as stated earlier this might not always be true.

Nevertheless, sometimes we get expose event from X server when shrinking
window, but most of the time we don't. Make the test not flakey by
checking that we get at least 1 expose event, instead of exactly 1.
Now running test 500 times in a loop does not fail.

Task-number: QTBUG-63424
Change-Id: I8004e622020cc09e11b7d592faf6d9ee1b9cfee2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-09-26 12:49:59 +00:00
Richard Moe Gustavsen
0dbede2b17 Widgets: be able to tab to a widget that has a focus proxy
When tabbing/searching for the next focus widget, the current
code would check if the next widget in the focus chain
had a focus proxy, and if so, ignore it. The exact reason
for this behavior is not clearly understood, but some widgets
(e.g QSpinBox) has children (a QLineEdit) that sets the parent
as focus proxy. If we didn't ignore children with focus proxy, tabbing
from a QSpinBox would lead us to find the inner QLineEdit, which
(because of its proxy), would lead us back to the QSpinBox. And
therefore not be able to tab out.

But ignoring the focus proxy has other problems. Normally a focus
proxy is the next sibling to the widget it acts as a proxy for, and
tabbing to the widget will therefore appear correct. But if the
focus proxy is not the next sibling, the logic will fail, since
the tab would anyway give focus to the next sibling. This becomes very
apparent if the focus proxy is a child of the widget, since then
its likely that the focus proxy is not the _first_ child among all
the children. So tabbing to the parent would not give focus to
the proxy.

This patch will change this logic so that you are allowed to tab to a
widget with a focus proxy. But we check that if you do so, you actually
end up moving focus in the right direction. If not, we ignore it like
before. This will ensure that we tab correctly when dealing with focus
proxies, and especially when focus proxies are used to construct
compound widgets.

[ChangeLog][Widgets] When tabbing to a widget with focus proxy, focus
will now be given to the proxy rather than just being ignored.

Task-number: QTBUG-10907
Change-Id: I66d1da5c941fdd984bb2783cc355ca65b553b5dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-09-25 07:18:37 +00:00
Thiago Macieira
9467ebcf15 Autotest: centralize the detection of IPv6 support
I'll need it again in the next commit.

Change-Id: I209fcd5dbc2b4e5381cffffd14df65dcee71ca7e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-25 05:38:27 +00:00
Thiago Macieira
282065d443 QRandomGenerator: update API to better name
"generate" is better than "get", and we already have "generate(it, it)"
which uses std::generate(). This changes:

 - get32()    →   generate()
 - get64()    →   generate64() and QRandomGenerator64::generate()
 - getReal()  →   generateDouble()

Change-Id: I6e1fe42ae4b742a7b811fffd14e5d7bd69abcdb3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-22 15:29:42 +00:00
Shawn Rutledge
bcdd07ceb8 Blacklist tst_QItemDelegate::enterKey tests on openSUSE 42.3
Task-number: QTBUG-62967
Change-Id: Ifce1c8732e126e26636057de29e1fe6348c914bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-09-22 14:34:30 +00:00
Gabriel de Dietrich
4c025ca9c7 QCompleter: Send activated() signal only once on return key
Due to the complex event forwarding logic between QCompleter,
QComboBox, QLineEdit and QWidgetLineControl, in some cases the
same single user return key press could result in duplicated
activated() signals being emitted by QComboBox. The first one
would be emitted because QLineEdit emitted editingFinished()
as a result of QCompleter::eventFilter() having forwarded the
return key press event to QComboBox. The second one, would
happen right after, as QCompleter::eventFilter() would process
the same event on behalf of its popup.

(We recall that QCompleter is installed as its own popup event
filter. That's also the case for the completer's widget, although
the purpose there is limited to focus-out events).

The current fix consists on skipping the emit as a result of
QLineEdit::editingFinished() if the completer's popup is still
active. For this to be accurate, it helps to test whether the
completer's popup is visible, so we will not be hiding it in
QWidgetLineControl::processKeyEvent() anymore. Indeed, we know
that if the popup is visible, that means that processKeyEvent()
was called after being forwarded by the completer's popup event
filter. Furthermore, the popup will be hidden by its event filter
shortly after it returns from said event forwarding call.

Based on a patch by Alexey Chernov <4ernov@gmail.com>.

Task-number: QTBUG-51858
Task-number: QTBUG-51889
Change-Id: I013f6c3000ae37b5b0ec20eaf5cf7746c9c903e3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-09-22 00:02:06 +00:00
Liang Qi
e5114e10dc Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-09-21 06:55:09 +00:00
Edward Welbourne
e0c2d328b1 Fix #if-ery and accompanying comment
The comment was back-to-front on the meaning it needed to address; and
the #if-ery used a deprecated define, now changed to match what
sanity-bot asked for.

Change-Id: I0a971ab2e405e5908066da86964d67c8b852f114
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-20 11:50:47 +00:00
Tony Sarajärvi
30a6557eb0 Blacklist tst_QItemDelegate::testLineEditValidation in openSUSE 42.3
This autotest is blacklisted as it is deemed flaky.

Task-number: QTBUG-63262
Change-Id: I216985e81d1c1cb3528fd8a005be48cad2a31ab7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-09-20 10:06:34 +00:00
Tony Sarajärvi
bbaedb9744 Blacklist flaky QItemDelegate tests in openSUSE 42.3
Task-number: QTBUG-62967
Change-Id: I05cbf06f068701ee16b54e7052e02becc0c47702
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-09-20 10:06:28 +00:00
Liang Qi
01bc69f99f Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/styles/mac/qmacstyle_mac.mm
	src/widgets/util/qcompleter.cpp
	src/widgets/widgets/qmainwindowlayout.cpp
	src/widgets/widgets/qmdisubwindow.cpp

Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
2017-09-20 11:58:32 +02:00
Tony Sarajärvi
bf41fbb233 Blacklist tst_QGraphicsScene::isActive in openSUSE 42.3
This autotest is blacklisted as it is deemed flaky.

Task-number: QTBUG-63260
Change-Id: I3e83bcb0dbbe4fbf9d5c16f764fbeeca2b52d10c
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2017-09-20 09:48:36 +00:00
Andy Shaw
35bb55cd12 Itemviews: Set the WA_InputMethodEnabled attribute correctly
When focus is put back onto an itemview and the current item is editable
then the WA_InputMethodEnabled attribute should be set. Likewise this
should be set/unset when the current index changes too, depending on
whether the index is editable or not.

Change-Id: Iaea075e669efd21bdaa89a49c500c449272d098b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-09-20 07:37:35 +00:00
Kevin Funk
58c14c4a7e Replace Q_NULLPTR with nullptr where possible
Remaining uses of Q_NULLPTR are in:
src/corelib/global/qcompilerdetection.h
  (definition and documentation of Q_NULLPTR)
tests/manual/qcursor/qcursorhighdpi/main.cpp
  (a test executable compilable both under Qt4 and Qt5)

Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-19 11:53:55 +00:00
Kevin Funk
47c92fbb0b Replace Q_DECL_OVERRIDE with override where possible
Remaining uses of Q_DECL_OVERRIDE are in:

src/corelib/global/qcompilerdetection.h
src/corelib/global/qglobal.cpp
doc/global/qt-cpp-defines.qdocconf
  (definition and documentation of Q_DECL_OVERRIDE)
tests/manual/qcursor/qcursorhighdpi/main.cpp
  (a test executable compilable both under Qt4 and Qt5)

Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-19 11:53:42 +00:00
Andy Shaw
3c95c748e0 Fix recordOCI() test to treat clob/nclob as QByteArray
Change-Id: I0315b23dad66f98fc681c624d4afa8b5abb54a7b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-18 21:06:49 +00:00
Andy Shaw
2d168af7d7 OCI: Use correct type for getting doubles
Change-Id: Iffb81a37a517e58d48757d82f93f20e8c5100033
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-18 21:06:42 +00:00
Jake Petroules
83122b1932 Remove unnecessary VxWorks ifdef
Change-Id: Ie655bdff9a09c6060f66e4346b94ba52443241f4
Reviewed-by: Tuomas Heimonen <tuomas.heimonen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-18 21:06:25 +00:00
Jake Petroules
69b16a46e8 Exclude QSystemSemaphore test with -no-feature-systemsemaphore
Change-Id: I9db6b68c3d26b27a0203c68c48ab73602eb15095
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-09-18 08:56:53 +00:00
Giuseppe D'Angelo
0d409f2d4e ModelTest: cleanups
In preparation to move the code into QTestLib proper.

* Move to PMF-based connect() statements
* Remove a bunch of commented out code
* Streamline the logging of debugging / warnings, use categorized logging

Change-Id: Iec0872b63959decce49487762472c9a82bcc9fa1
Reviewed-by: David Faure <david.faure@kdab.com>
2017-09-17 21:27:58 +00:00
Giuseppe D'Angelo
fc208838ae QScopedPointer: add get()
For self-consistency with QSharedPointer and minor consistency
with std::unique_ptr (although QScopedPointer isn't movable, so we
can't claim STL compatibility with it).

[ChangeLog][QtCore][QScopedPointer] Added get().

Change-Id: Ib58f936afa0e0d5bce57a61d1467b69956f37ceb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-17 11:42:26 +00:00
Giuseppe D'Angelo
72f700edd6 tst_qidentityproxymodel: map the index to the source model
In data(), index belongs to the proxy, not to the source. It needs
to be mapped back to it first.

Change-Id: Ie5dcbf13166dadf62f3d85b594d3227383132521
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-09-15 13:52:10 +00:00
Jake Petroules
7127202358 Exclude tst_QDir::mkdirOnSymlink on Unix platforms without symlinks
One example is VxWorks.

Change-Id: I253df715a9417c1f9cede79b1e1860924e0da8a9
Reviewed-by: Tuomas Heimonen <tuomas.heimonen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-15 11:20:32 +00:00
Thiago Macieira
5d48143ff8 Autotest: use QUdpSocket instead of QTcpSocket in tst_QNetworkInterface
We don't need to bother the network test server with a TCP SYN packet.
All we need is for the local operating system to figure out the IP
address it would use to send a packet to the test server. We can do that
with QUdpSocket.

Also, the network test server hasn't been called "fluke.troll.no" for
almost a decade.

Change-Id: I209fcd5dbc2b4e5381cffffd14df65ccc7133247
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-14 13:17:02 +00:00
Allan Sandfeld Jensen
590e71a69c Fix convertToFormat with color-tables
The function was only well defined from RGB32 and ARGB32PM formats,
this patch fixes it so it behaves well from all formats.

Task-number: QTBUG-63163
Change-Id: Id892531d9aaf997b707b430196c1166493792a2a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-09-14 08:13:46 +00:00
Thiago Macieira
84fcc38955 Autotest: when using libproxy, QNetworkProxyFactory isn't generic
Looks like whoever created the blacklist never tried to figure out why
it happened.

Change-Id: I84e45059a888497fb55ffffd14d2fb29e32a4521
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-13 18:42:44 +00:00
Mårten Nordheim
1394610c79 Workaround for proxyChange failing when run alone
The issue itself is not really worth fixing (the very first request
being supposed to have a different proxy than any of the other
following requests before a session has been initiated), but we can
at least make the test pass when it is run alone.

Task-number: QTBUG-63134
Change-Id: I6c7df5c5653541031811e6bff562572061afae0f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-13 18:42:30 +00:00
Thiago Macieira
3b61cd6ad7 QStringView: De-inline the length calculation so we can use SSE2
Performance is more important in this case than the theoretical benefit
of constexpr. This commit implements the SSE2 search for 16-bit null and
it might be possible to implement the equivalent for AArch64
(investigation required). It also adds a fallback to wcslen() for
systems where wchar_t is short (non-x86 Windows or 32-bit x86 build with
-no-sse2).

We can re-add the constexpr loop once the C++ language has a way of
overloading constexpr and non-constexpr. GCC has a non-standard way to
do that with __builtin_constant_p, which is also implemented in this
commit, but note that the inline function is still not constexpr.

Change-Id: I6e9274c1e7444ad48c81fffd14dcaacafda5ebdc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-13 16:19:45 +00:00
Ulf Hermann
3b5b8f1d4a QXmlStreamWriter: Avoid writing invalid characters
Some valid UTF-16 characters cannot be expressed in XML 1.0 and a
QString may contain invalid unicode. In both cases we should not write
the respective data to the output stream, as that generates invalid XML,
which then cannot be read back by QXmlStreamReader. In addition we
should report an error if we encounter them.

The change filters the incorrect strings from the output and introduces
an "encodingError" flag which is reported from hasError().

[ChangeLog][Important Behavior Changes] Characters invalid in XML, such
as 0x0 or 0xfffe, as well as strings containing unmatched UTF-16
surrogates are now suppressed from the output of QXmlStreamWriter and
cause the error flag to be set.

Task-number: QTBUG-63150
Change-Id: Ia29bab768fed9681dd68e8934da2a7e3fcdfc3cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-13 07:29:00 +00:00
Stephan Binner
bef8b905af Convert features.sizegrip to QT_[REQUIRE_]CONFIG
Change-Id: Ieac4ae1f0b8b84e943c00da9903346a44e57138c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-09-12 18:12:47 +00:00
Giuseppe D'Angelo
71a2dd955c QSharedPointer: add get() for STL compatibility
[ChangeLog][QtCore][QSharedPointer] Added get(), for compatibility
with std::shared_ptr.

Change-Id: I77189c89bc6a222313b9b2353f1fb3969433c750
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-12 14:05:21 +00:00
Andy Shaw
764854dc47 Call canFetchMore/fetchMore when scrolled to the bottom of the view
When scrolling to the bottom of the view, if there are expanded items
then it should call canFetchMore/fetchMore up the chain until it
finds one with more items that can possibly be retrieved.

This brings it in line with the QAbstractItemView implementation
which would call canFetchMore on the root index, therefore we
go up the chain to the root to see if anything before that can be fetched.

[ChangeLog][QtWidgets][QTreeView] QTreeView now calls canFetchMore and
fetchMore when the bottom of the QTreeView is scrolled to.

Task-number: QTBUG-48725
Change-Id: I2b2145684bb34c8c317bfce4a0ef14f243a64719
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-09-12 12:56:18 +00:00
Tony Sarajärvi
ba1b73175b Blacklist tst_QOpenGL autotest in Windows 7
Task-number: QTBUG-63122
Change-Id: Idb4c84800265c2e446d27516261fcc418be7863b
Reviewed-by: Joni Jäntti <joni.jantti@qt.io>
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2017-09-12 07:15:25 +00:00
Tor Arne Vestbø
d2a988512e macOS: Detect use of heap-allocated QMacAutoReleasePool
QMacAutoReleasePool is backed by an NSAutoreleasePool, which documents that
"you should always drain an autorelease pool in the same context (invocation
of a method or function, or body of a loop) that it was created".

This means allocating QMacAutoReleasePool on the heap is not a supported
use-case, but unfortunately we can't detect it on construction time.

Instead we detect whether or not the associated NSAutoreleasePool has been
drained, and prevent a double-drain of the pool.

Change-Id: Ifd7380a06152e9e742d2e199476ed3adab326d9c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-08 12:05:21 +00:00
Gatis Paeglis
1af927976a tests: fix and un-blacklist tst_qgraphicsview::hoverLeave
Tests should not use QCursor to emulate mouse move, see QCursor::setPos() docs.

The flakiness of the test on XCB is not surprising when the test queries geometry
even before the window has been shown. With the re-factored version I could not
reproduce flakiness anymore.

Removed Q_OS_MAC and closed QTBUG-26274 as test passes on macOS from which I
assume that the underlying issue has been fixed.

Removed Q_OS_QNX ifdef as test does not rely on QCursor anymore.

This patch also fixes the issues on minimal / offscreen platform plugins.
QCursor::setPos() is evil for auto test purposes.

Note:

We intentionally use QTest::mouseMove(QWindow *window, ..), not the QWidget overload.
The QWindow version gets routed through QWSI, which ensures that all necessary events
are generated as expect. In QWidget code path this is currently disabled by
QTEST_QPA_MOUSE_HANDLING.

Change-Id: I285c26cff09e3f2750f8c2abbb1f46c8f7be984a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-09-07 15:16:46 +00:00
Liang Qi
19dd2ca93b Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	examples/opengl/qopenglwidget/main.cpp
	src/3rdparty/pcre2/src/pcre2_printint.c
	src/plugins/platforms/cocoa/qnsview.mm
	src/widgets/widgets/qcombobox.cpp

Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
2017-09-06 13:26:31 +02:00
Friedemann Kleint
3b6fb8f22e Use QTRY_COMPARE in tst_qwidget::activation() (Windows only)
Speeds up the test from approximately 770ms to 180ms.

Change-Id: I2e5479fd5190b841b44d4a66380d27b1c3b55162
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-06 10:28:02 +00:00
Stephan Binner
c6b9c6e5f2 Convert features.socks5 to QT_[REQUIRE_]CONFIG
The sources were already added conditionally in the project file since
179fe5981f.

Change-Id: I0baaec2e772f3e596d311c1973b9745aa2b80423
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-09-06 06:50:54 +00:00
Tony Sarajärvi
f9fea20c10 Extend blacklisting of tst_QWidget::maskedUpdate to openSUSE 42.3
Task-number: QTBUG-51399
Change-Id: I7fcc52da2ce539251f6bad0394c4580dd76439a7
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2017-09-04 12:11:47 +00:00
Tony Sarajärvi
a2dbf1e779 Blacklist tst_QItemDelegate::enterKey tests on openSUSE 42.3
Task-number: QTBUG-62967
Change-Id: I42f25120f1a9e2ef6a9a147e4f36edcdff2922a6
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2017-09-04 12:11:44 +00:00
Timur Pocheptsov
6a0f59f9c1 Fix MiniHttpServer (POST/PUT requests processing)
Teach our MiniHttpServer to better handle POST and PUT requests:
read the POST/PUT data too (not headers only), before replying
and flushing. The  original comment says MiniHttpServer does
not support POST/PUT requests, it's not true anymore - we can
handle them (perhaps the simplest/shortest ones).

Task-number: QTBUG-62844
Change-Id: I80260f8ede1bb1b0b9d6042ecd59558bb7e9a998
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-04 12:11:11 +00:00
Stephan Binner
093064fdeb Convert features.completer to QT_[REQUIRE_]CONFIG
Change-Id: If45a46c08b37d245229a39f3d6ffbb34154934f2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-09-04 11:28:02 +00:00
Orgad Shaneh
ced0f54ec3 Fix resolution of relative links on Windows
[ChangeLog][QtCore][QFileInfo] Relative symbolic links on Windows are
now resolved to their absolute path by symLinkTarget().

Task-number: QTBUG-62802
Change-Id: I5826517130bd389aef994bf3f4b6d99b2a91b409
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-09-04 07:35:09 +00:00
Frederik Gladhorn
9831118378 Merge dev into 5.10
Change-Id: I5fb5e7e6e57bb5db6fcb1f670f7f6cbc8def2d60
2017-09-02 10:27:09 +02:00
Thiago Macieira
b5d471d0c2 QNativeSocketEngine: disable unused methods about OS socket buffer
They aren't used in the API, so let's stop wasting library size.

Change-Id: I6e9274c1e7444ad48c81fffd14db247ecf825a57
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-01 16:40:36 +00:00
Thiago Macieira
541a031552 tst_QMutex: produce less noise with MSVC
Since MSVC doesn't have <chrono> (according to QT_HAS_INCLUDE), the QSKIP
in the test was printed for every line in the table. Instead, add the
skip in the _data() function.

Change-Id: I6e9274c1e7444ad48c81fffd14dbcee5e5a322aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-01 16:36:17 +00:00
Albert Astals Cid
6e18293299 Forward the readChannelFinished from the plain socket to the ssl socket
Task-number: QTBUG-62257
Change-Id: I12632b7ffd2012adc99b4784892cbb6f79e065f7
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-09-01 15:09:14 +00:00
Liang Qi
112a4af107 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	examples/examples.pro
	qmake/library/qmakebuiltins.cpp
	src/corelib/global/qglobal.cpp
		Re-apply b525ec2 to qrandom.cpp(code movement in 030782e)
	src/corelib/global/qnamespace.qdoc
	src/corelib/global/qrandom.cpp
	src/gui/kernel/qwindow.cpp
		Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08)
	src/network/ssl/qsslkey_openssl.cpp
	src/plugins/platforms/android/androidjniinput.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/widgets/widgets/qmenu.cpp
	tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp

Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
2017-08-31 14:31:31 +02:00
Joni Jäntti
e938150412 Revert "tst_qwidget::activation expect fail on Win 10"
This reverts commit 8561281768.

This change needs to be reverted because Windows 10 Creator's
Update doesn't fail on this test anymore during CI runs.
Reason for this is unknown.

Change-Id: Ice250ecedb14ac96fb3693b2d9884ef452a91cc2
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-08-30 12:49:02 +00:00
Joni Jäntti
de6d6eb13e Revert "tst_qgraphicswidget expect fail on Win 10"
This reverts commit 3d5bf00f18.

This change needs to be reverted because Windows 10 Creator's
Update doesn't fail on this test anymore during CI runs.
Reason for this is unknown.

Change-Id: I9f1c88606c97afc5952af34e04310612b783a9c2
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-08-29 11:59:23 +00:00
Alexander Volkov
d61e61fa1a uic: Use nullptr instead of Q_NULLPTR in generated code
nullptr can be used directly in the Qt code since Qt 5.7.
Use it in generated code for consistency.

Change-Id: I249aeaf0a39b46ce1106b29d3ea4569a399908b7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2017-08-28 15:25:07 +00:00
Friedemann Kleint
eb93d7b517 Testlib: Format QVector2/3/4D in QCOMPARE
Change-Id: Ia0709e598d2fddd6c2f448633b484749146265f7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-08-27 06:17:32 +00:00
Alex Trotsenko
ca0df4b269 Introduce QIODevice::skip()
[ChangeLog][QtCore][QIODevice] Added skip() method to improve
performance in read operations.

Change-Id: I79068a3e9df108756abe37ba3d431e27e7413621
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-27 06:17:09 +00:00
Timur Pocheptsov
53357f0156 HTTP/2 - implement the proper 'h2c' (protocol upgrade)
Without TLS (and thus ALPN/NPN negotiation) HTTP/2 requires
a protocol upgrade procedure, as described in RFC 7540, 3.2.
We start as HTTP/1.1 (and thus we create QHttpProtocolHandler first),
augmenting the headers we send with 'Upgrade: h2c'. In case
we receive HTTP/1.1 response with status code 101 ('Switching
Protocols'), we continue as HTTP/2 session, creating QHttp2ProtocolHandler
and pretending the first request we sent was HTTP/2 request
on a real HTTP/2 stream. If the first response is something different
from 101, we continue as HTTP/1.1. This change also required
auto-test update: our toy-server now has to respond to
the initial HTTP/1.1 request on a platform without ALPN/NPN.
As a bonus a subtle flakyness in 'goaway' auto-test went
away (well, it was fixed).

[ChangeLog][QtNetwork][HTTP/2] In case of clear text HTTP/2 we
now initiate a required protocol upgrade procedure instead of
'H2Direct' connection.

Task-number: QTBUG-61397
Change-Id: I573fa304fdaf661490159037dc47775d97c8ea5b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-08-27 04:54:55 +00:00
Orgad Shaneh
0f11fab6f7 Fix resolution of relative symlinks from relative path on unix
Consider the following:
/root/target - a file
/root/path/link -> ../target
/root/path/other/exe - executable

Running from /root/path/other.

exe is:

#include <QDebug>
#include <QFileInfo>

int main()
{
    qDebug() << QFileInfo("../link").symLinkTarget()
    return 0;
}

The link references /root/target, but the current output is
/root/path/target.

The link doesn't depend on the PWD. It depends on its own directory.

Change-Id: I61e95018154a75e0e0d795ee801068e18870a5df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-27 02:39:57 +00:00
Edward Welbourne
515b905150 Adapt qmake's raw-string parser to avoid confusion by macros
A macro name ending in R might expand to a string; if this precedes a
string constant, we're juxtaposing the strings.  My first parser for
raw strings would mistake it for a raw string instead, ignoring the
part of the identifier before R.  Re-worked the exploration of what
came before the string to catch these cases, too.

The backwards parsing would also allow any messy jumble of [RLUu8]* as
prefix for the string; but in fact R must (if present) be last in the
prefix and *it* can have at most one prefix, [LUu] or u8.  Anything
else is an identifier that happens to precede the string.  Reworked
the parsing to allow only one prefix and not treat R specially unless
it's immediately (modulo BSNL) before the string's open-quotes.

Add link to the cppreference page about string literals, on which the
grammar now parsed is based.

Added a test for the issue this addresses.
Verified that this fails on 5.6, dev and 5.9 without the fix.
Expanded the existing test to cover R-with-prefix cases.

Task-number: QTBUG-55633
Change-Id: I541486c2ec909cfb42050907c84bee83ead4a2f4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-08-24 14:27:50 +00:00
Sérgio Martins
6522d4c487 Fix invalid placeholder name in tst_qsqlthread.cpp
Change-Id: I88c0c48888b86b58d85223ad1dc4cafdaea01d77
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-08-23 12:48:32 +00:00
Gabriel de Dietrich
b65e30c861 QWidget: Call appropriate QWindow method from setGeometry_sys()
When calling resize() from showEvent(), we'd set the full geometry
on the widget's QWindow. This resulted in the top-level window
being moved to the top-left corner, even though no other call to
move() or setGeometry() had happened before.

The solution consists on calling the proper QWindow methods depending
on whether setGeometry_sys() is called for a move, a resize or both.

Furthermore, this needs QWindow::resize() to set its position policy
to frame-exclusive. The documentation states that is already the case
and we're setting the full geometry on the platform window, so we need
to convey that bit of information.

This also solves the age-old conundrum: "### why do we have isMove as
a parameter?"

Change-Id: I2e00fd632929ade14b35ae5e6495ed1ab176d32f
Task-number: QTBUG-56277
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-08-23 08:42:44 +00:00
Friedemann Kleint
1bbad92e83 tst_QPrinter: Share printers in testPageRectAndPaperRect/testMargin
Speeds up testing by a factor of 2.

Task-number: QTBUG-61827
Change-Id: I9d6c9d9786d35af3083bc7e98beb9a79dbcc7e11
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-08-23 08:09:12 +00:00
Andy Shaw
c1cd8df84e Fix the test for non-English based setups
Unsetting the SOFTWARE environment variable will force lpstat to use
English for the output, so we can ensure that the test will pass
regardless of the language used for the machine.

Change-Id: Iddf5e8aadaa546ae3e0dd172df84e4e43ee02c2a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-08-23 08:07:37 +00:00
Friedemann Kleint
82e7bd689a tst_QPrinter: Disambiguate all file names
Introduce helper function which uses a number to build
unique names. Remove helper for deleting files since it
now uses a temporary directory. Add a few cases
that were overlooked in 88c68f4d9e.

Task-number: QTBUG-61827
Change-Id: I53355f99ffc3bfe6ad6994a5439710c9fa8cdad5
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-08-23 08:05:17 +00:00
Thiago Macieira
189e9c93d7 QTemporaryFile: Add support for Linux's O_TMPFILE
That means a file is never created, unless you ask for the name. There's
no chance of left-over temporary files being left behind. QSaveFile also
benefits from this, since the save file is not present on disk until
commit(). Unfortunately, QSaveFile must go through a temporary name
because linkat(2) cannot overwrite -- we need rename(2) for that (for
now).

[ChangeLog][Important Behavior Changes][QTemporaryFile] On Linux,
QTemporaryFile will attempt to create unnamed temporary files. If that
succeeds, open() will return true but exists() will be false. If you
call fileName() or any function that calls it, QTemporaryFile will give
the file a name, so most applications will not see a difference.

Change-Id: I1eba2b016de74620bfc8fffd14cc843e5b0919d0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-23 04:02:19 +00:00
Morten Johan Sørvig
750a252b89 Blacklist tst_QMessageBox::defaultButton on osx ci
Has become flaky on CI. Does not fail locally.

Change-Id: I42938849571938db78b16a72c215442a69f7c2d5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-08-22 05:10:54 +00:00
Morten Johan Sørvig
d044b0b1e3 Remove timer checks from testQuitLock
This test sets up two timers:
	- a 100ms recurring timer
	- a series of 10 200ms single-shot timers.

After quitLock lets exec() return it then uses a signal
spy to check if the 100ms timer fired at least 17/20
of the times it should.

However there is no guarantee that the 100ms timer
will fire more often than the 200ms timer. If the
native timer callbacks happen at 500ms intervals then
Qt will fire both timers (once) at that interval.

In practice this seems to happen on macOS CI under
system load and/or with the test app napping.

The primary goal for the test is to verify that exec()
returns when it should; we can remove the timer signal
spy.

Remove testQuitLock from BLACKLIST.

Timely timer:

  524429311.389913 runLoopTimerCallback
  524429311.389979 200ms fire
  524429311.389997 100ms fire
  524429311.490056 runLoopTimerCallback
  524429311.490130 100ms fire
  524429311.589752 runLoopTimerCallback
  524429311.589929 200ms fire
  524429311.589976 100ms fire

Delayed timer:

  524429428.690887 runLoopTimerCallback
  524429428.691002 100ms fire
  524429428.691143 200ms fire
  524429433.692103 runLoopTimerCallback
  524429433.692205 100ms fire
  524429433.692331 200ms fire

Change-Id: Iff4faaa1de3741cf4e217949d5ed17d4e70c6af2
Task-number: QTBUG-61499
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-08-22 05:10:48 +00:00
Edward Welbourne
b9557296cb Fix crash when reading a PKCS12 file with no private key
The only reason our code wants PKCS12 files is for a private key, but
a valid file needn't contain one; and reading a file without lead to a
crash in QSslKeyPrivate::fromEVP_PKEY().  So check for missing key and
fail the load, since the file is useless to us.  Also ensure the
caller's pkey is initialized, as we aren't promised that
PKCS12_parse() will set it when there is no private key.

Add a test for this case (it crashes without the fix) and update the
instructions for how to generate test data to cover it also.
(Corrected the wording there, too; at the interactive prompt,
"providing no password" really provides an empty password.)

Task-number: QTBUG-62335
Change-Id: I617508b903f6d9dee40d539b7136b0be8bc2c747
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-08-17 06:43:49 +00:00
Andy Shaw
a3d59c7c7f Block input to a window shown while an application modal dialog is visible
Although the window is refused input for the most part from the system,
it does not act like that it is blocked by the application modal dialog.
This ensures that it is the case and prevents things like being able to
double click on the title bar to maximize the window on Windows.

Task-number: QTBUG-49102
Change-Id: If1582819b90cb2ec9d891f664da24f13bfec7103
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-08-16 13:13:55 +00:00
Tony Sarajärvi
f9f5b35e73 Blacklist tst_QFont::DefaultFamily in B2Qt
Task-number: QTBUG-62528
Change-Id: Iadf9a923b2a624c5082fd1bd61691f8100178f94
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-16 07:32:09 +00:00
Liang Qi
106d3b9bf9 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/plugins/platforms/cocoa/qcocoamenu.h
	src/plugins/platforms/cocoa/qcocoamenu.mm
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/widgets/styles/qstylehelper_p.h

Change-Id: I54247c98dd79d2b3826fc062b8b11048c9c7d9bb
2017-08-15 16:31:48 +02:00
Milla Pohjanheimo
0273391dbe Update binary compatibility files for Qt 5.9.0 for QtBase
Added binary compatibility files for Qt 5.9.0.
'QOpenGLExtraFunctionsPrivate::Functions' and
'QOpenGLExtraFunctionsPrivate' have been blacklisted in
qtqa/tests/postbuild/bic/tst_bic.cpp, because those give false
positive fail in the binary compatibility tests.

Change-Id: I2231daef61a0c4677af36c85575b8dcd81070d44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-14 13:48:17 +00:00
Thiago Macieira
10b46fe474 Autotest: Fix test when running on a non-Unicode-capable locale
Like my default FreeBSD environment.

Change-Id: I3868166e5efc45538544fffd14d8a7f2dffa6ac9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-12 07:56:39 +00:00
Jarkko Koivikko
8de79dbcec Widgets: Fix ImSurroundingText query for a QLineEdit with mask
QLineEdit with a mask does not return empty fields with the
ImSurroundingText query. This is a problem for the input
context that is not aware of the mask and relies on the
fact that the cursor position never exceeds the boundaries
of the surrounding text.

This change fixes the issue by returning unmasked text with
the ImSurroundingText query.

[ChangeLog][QtWidgets][QLineEdit] Fixed behavior of the
ImSurroundingText query. Previously, it returned a masked
text whose length may be less than the cursor position.
Now it returns unmasked text, so the text length is always
greater than or equal to the cursor position.

Task-number: QTBUG-60319
Change-Id: I1c8009164836a1baa2e3a45958bf1ea5fa9be38d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2017-08-11 13:27:37 +00:00
Thiago Macieira
5d2240718c Autotest: fix blacklisted test about position on non-regular files
On BSD systems (tested on macOS and FreeBSD), you *can* lseek(2) or
ftell(3) on a pipe and get its current position. But QFile will not get
the position when the file is sequential, so we need to return 0.

Technically speaking, we ought to do the same for block devices, but if
you're redirecting stdin, stdout or stderr in the unit test to or from a
block device, you deserve the extra work to add that yourself to the
test.

Change-Id: I3868166e5efc45538544fffd14d8a74e92963fe7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-08 21:48:28 +00:00
Thiago Macieira
6504bc6bbc QFileInfo: harmonize QFileInfo() and QFileInfo("")
If a QFileInfo was constructed with an empty path, which could happen
with QFileInfo(QFile()) or via QDir, etc., then it would issue system
calls to empty paths and could even produce warnings. This commit makes
am empty path name be the same as a default-constructed QFileInfo and
corrects the use if 0 for ownerId and groupId to match the
documentation.

[ChangeLog][Important Behavior Changes] QFileInfo on empty strings now
behaves like the default-constructed QFileInfo. Notably, path() will now
be the empty string too, instead of ".", which means absoluteFilePath()
is no longer the current working directory.

Change-Id: I8d96dea9955d4c749b99fffd14ce34968b1d9bbf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-08 21:48:23 +00:00
Thiago Macieira
883dfb3d15 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/widgets/kernel/qwidget.cpp

This merge also extends the expected output of the pairdiagnostics
teamcity output (added in dev in commit
c608ffc56a) after the recent addition of
the flowId attribute to the teamcity output (commit
8f03656211 in 5.9).

Change-Id: I3868166e5efc45538544fffd14d8aba438f9173c
2017-08-08 11:48:10 +02:00
Simon Hausmann
b75bc0f75c Fix failing network cookie jar tests
The test verifies that a cookie with a date in the future is not
"expired" and will be sent to the server. This test started failing
on August 7th 2017 when the test case "0003" with it's cookie expiring
August 7th 2017 started ... expiring ;-)

Bumped all suspicious cookie test cases by a hundred years.

Change-Id: I7c09069ec4999e2ea0aae7b2a2819cced0fd6a99
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-07 19:19:13 +00:00
Simon Hausmann
ea9032ceaa Revert "Ignore thaiZWJ failure on RHEL 7.2"
The blacklisting is not needed anymore as we now use -qt-harfbuzz.

This reverts commit b36e5faad4.

Task-number: QTQAINFRA-1363
Change-Id: I3ae50588204b27e6880416ae2cbc28dda53bb292
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-07 07:18:26 +00:00
Eskil Abrahamsen Blomfeldt
9342a8b843 Add QTextOption/QTextEdit/QPlainTextEdit::tabStopDistance property
In Qt, we have QTextOption::tabStop, QTextEdit::tabStopWidth and
QPlainTextEdit::tabStopWidth.

Neither are very good names, since the tab stop is neither a
numerical value as in the former, nor does it have any dimensions
that can be measured, as in the latter. Vertical text advances
may also be supported by Qt at some point in the future, at
which point the name would make even less sense.

At the same time, we expose the actual type of the tab stop
distance as floating point in the QTextEdit and QPlainTextEdit
API instead of always rounding it to an int.

To avoid duplicating either of these APIs in Qt Quick, we
introduce tabStopDistance as the common term instead and deprecate
the old names.

[ChangeLog][Text] Introduced tabStopDistance property in
QTextOption, QTextEdit and QPlainTextEdit as replacement for
the inconsistently named tabStop and tabStopWidth properties.
QTextOption::tabStop, QTextEdit::tabStopWidth and
QPlainTextEdit::tabStopWidth have subsequently been deprecated.

Change-Id: Ib7e01387910cddb58adaaaadcd56c0e69edc4bc2
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-06 08:16:06 +00:00
Thiago Macieira
6c3a3d498a Filesystem: Use "birth time" to avoid confusion with Unix ctime
The Unix stat fields "st_ctime" and "st_ctim" mean "change time", the
last time that the file/inode status fields were changed. It does not
mean "creation time". So this commit splits all of the internal API to
"birth" and "metadata change" instead of "creation" to avoid the
conflict.

Change-Id: I149e0540c00745fe8119fffd1463fe78b619649e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-05 16:41:38 +00:00
Thiago Macieira
261c6713bd Introduce QFileInfo::birthTime and metadataChangeTime
[ChangeLog][QtCore][QFileInfo] Deprecated created() because it could
return one of three different file times depending on the OS and
filesystem type, without the ability to determine which one is which. It
is replaced by metadataChangeTime() and birthTime().

[ChangeLog][QtCore][QFileInfo] Added QFileInfo::metadataChangeTime(),
which returns the time the file's metadata was last changed, if it is
known, and falling back to the same value as lastModified() otherwise.
On Unix systems, this corresponds to the file's ctime.

[ChangeLog][QtCore][QFileInfo] Added QFileInfo::birthTime(), which
returns the file's birth time if it is known, an invalid QDateTime
otherwise. This function is supported on Windows and on some Unix
systems.

Change-Id: I0031aa609e714ae983c3fffd1467bd8b3e3a593d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-05 16:41:32 +00:00
Borgar Ovsthus
8f03656211 Add flowId to messages when logging in TeamCity format
Added flowId='name' to each message when using TeamCity logging format.
This is necessary to distinguish separate processes running in parallel.

[ChangeLog][QtTest] Added flowId to messages when logging in TeamCity
format. FlowId is used to distinguish logging from multiple processes
running in parallel.

Change-Id: I7f5046c1058ff02770404caa2c9b3a5398f97f6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 18:48:48 +00:00
Thiago Macieira
4934138be2 Allow QSettings to synchronize non-atomically
This is required so that one can use QSettings in situations that
temporary files or renaming may not work.

[ChangeLog][QtCore][QSettings] Added setAtomicSyncRequired(), which
allows one to use QSettings with config files in unwriteable directories
or in Alternate Data Streams on NTFS on Windows. This used to work
before Qt 5.4, but remains a non-default behavior due to the potential
of data corruption.

Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4f77112f0402f
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-08-04 17:30:16 +00:00
Thiago Macieira
66500b9d75 Support Alternate Data Streams in QSaveFile
We can't use MoveFile to do atomic commits on an ADS, so QSaveFile needs
to detect when the target name is ADS and then use the direct fallback
mode.

[ChangeLog][QtCore][QSaveFile] Saving to Alternate Data Streams on NTFS
on Windows is now possible, but requires setDirectWriteFallback(true).

Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4bc062ae1750d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2017-08-04 17:30:13 +00:00
Thiago Macieira
3d6cbe3409 Long live QTemporaryFileName!
So we can use it in QTemporaryFile, QTemporaryDir and QFile::rename()

[ChangeLog][QtCore][QTemporaryDir] The class now supports the "XXXXXX"
replacement token anywhere in the template, not just at the end. This
behavior is similar to what QTemporaryFile supports.

Change-Id: I1eba2b016de74620bfc8fffd14ccb645729de170
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-04 17:30:03 +00:00
Allan Sandfeld Jensen
74197140be Implement conversion from nullptr QVariant to QString and QByteArray
A nullptr QVariant should become a null QString or QByteArray,
since null strings have previous in our APIs represented the null value
in the absence of a dedicated null metatype.

Change-Id: I3b8f6386ece314d7c196959fbcf042c4fe0508a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:44 +00:00
Edward Welbourne
fbe84a1a19 Add a test that we can read SQL time-stamps
Based on a test-case from Israel Lins Albuquerque, that my planned
fixes to our parsing of ISODate date-times would break.

Change-Id: I5658df9c7daed59d43aa5574df25d4d9eac4677d
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:39 +00:00
Edward Welbourne
a9c111ed8c Clean-up in QDateTime's parsing of ISODate{,WithMs}
Actually check that there's a T where ISO 8601 wants it (instead of
just skipping over whatever's there), with something after it; move
some declarations later; add some comments; and use the QStringRef API
more cleanly (so that it's easier to see what's going on).  Simplify a
loop condition to avoid the need for a post-loop fix-up.

This incidentally prevents an assertion failure (which brought the
mess to my attention) parsing a short string as an ISO date-time; if
there's a T with nothing after it, we won't try to read at index -1 in
the following text.  (The actual fail seen had a Z where the T should
have been, with nothing after it.)

Add tests for invalid ISOdate cases that triggered the assertion.

Change-Id: Ided9adf62a56d98f144bdf91b40f918e22bd82cd
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:35 +00:00
Kevin Ottens
b6c3f55b93 GLSL 1.00 ES must be selected using "#version 100"
I was mistaken before, the "es" part for that version isn't optional, it
*must* be omitted.

Change-Id: I9e83d2317523fb0a905e40b95a56033cf693b93b
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2017-08-04 11:19:30 +00:00
Allan Sandfeld Jensen
f2c6e10ad5 QVariants of null pointers should be null
Changes the QVariant::isNull() implementation for
pointer types so they return true if null.

[ChangeLog][QVariant] QVariants containing pointers will now return
true on isNull() if the contained pointer is null.

Change-Id: I8aa0dab482403837073fb2f376a46126cc3bc6b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:25 +00:00
Thiago Macieira
b12fd1fa9d Long live qEnvironmentVariable()
[ChangeLog][QtCore] Added qEnvironmentVariable, which returns the value
of an environment variable in a QString, while qgetenv continues to be
used to return it in a QByteArray. For Unix, since most environment
variables seem to contain path names, qEnvironmentVariable will do the
same as QFile::decodeName, which means NFC/NFD conversion on Apple OSes.

I opted not to #include <qfile.h> from qglobal.cpp to implement that
QFile::decodeName functionality, so qglobal.cpp doesn't depend on
corelib/io and to avoid possible recursions.

Task-number: QTBUG-41006
Change-Id: I14839ba5678944c2864bffff141794b8aaa7aa28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:13 +00:00
Simon Hausmann
1f4fd599a8 Ignore thaiZWJ failure on RHEL 7.2
The test fails when the system harfbuzz (version 1.3.2) is installed.

Change-Id: Id18a5a3c503f64ef56567d71655e433a46908b3f
Task-number: QTQAINFRA-1363
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-04 11:18:50 +00:00
Simon Hausmann
b36e5faad4 Ignore thaiZWJ failure on RHEL 7.2
The test fails when the system harfbuzz (version 1.3.2) is installed.

Change-Id: Id18a5a3c503f64ef56567d71655e433a46908b3f
Task-number: QTQAINFRA-1363
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-04 08:36:36 +00:00
Raschbauer, Reinhard
52c66e8515 QAbstractItemView: fix nullptr violation
If in a slot connected to QAbstractItemView::clicked
QAbstractItemView::setModel(nullptr) is called the method
QAbstractItemView::mouseReleaseEvent will cause a segmentation fault.
The problem is that the method QAbstractItemView::model used in
QAbstractItemView::mouseReleaseEvent will return a nullptr if a null
model was set. The solution is to used d->model since it is always a
valid model. (See line d->model =
(model ? model : QAbstractItemModelPrivate::staticEmptyModel());
in method QAbstractItemView::setModel)

Change-Id: I6f01bdeac64495ee4a76adcc7bf8da8a7719ef4d
Reviewed-by: David Faure <david.faure@kdab.com>
2017-08-04 08:36:29 +00:00
Friedemann Kleint
959cc53b61 tst_NoQtEventLoop: Pass with High DPI scaling active
- Determine window sizes according to screen size and turn off
  scrolling.
- Center the window to get it out of the way of taskbars.
- Make the window top-most.
- Turn off scaling so that coordinates passed to the QWindow
  child match device coordinates and the child is positioned
  correctly.
- Make the child window a yellow raster window for easier
  debugging.

Task-number: QTBUG-45956
Change-Id: I05864770f8ed638d0a36f3e3f2afed73d2952436
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-08-04 08:36:16 +00:00
Frederik Gladhorn
e5cdb966bf Ignore tests that fail on OpenNebula
These tests need fixing, but they are already partially blacklisted
and need investigation once the switch is completed.

Task-number: QTQAINFRA-1292
Task-number: QTQAINFRA-1355
Task-number: QTQAINFRA-1362
Change-Id: Ic50d0c4a01ee7e72be1129d418eff244ba783185
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 09:30:06 +00:00
Joni Jäntti
8561281768 tst_qwidget::activation expect fail on Win 10
This test fails on Windows 10 x64 Creators Update CI builds for unknown reasons.

Change-Id: I766bccfd4dea9ea195c68403018b419e800a7b3b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 06:58:35 +00:00
Joni Jäntti
3d5bf00f18 tst_qgraphicswidget expect fail on Win 10
tst_qgraphicswidget::checkReason_ActiveWindow fails on Windows 10
Creators Update. Added expect fail for Windows platform.

Task-number: QTBUG-62244
Change-Id: I71868a496659e7136af9a5b74684ba39edaf03ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 06:58:27 +00:00
Joni Jäntti
b091472f44 tst_qfocusevent activateWindow for Win 10
This workaround was created to make tst_qfocusevent test pass on Windows
10 x64 Creators Update.

Task-number: QTBUG-61467
Change-Id: I63eb149ae850174fb5de99761a6001e000a151a2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 06:58:19 +00:00
Oswald Buddenhagen
d61ac601d8 unbreak tst_qresourceengine for prefix builds
don't try to execute a binary from the install dir.

amends 8e776d39f.

Change-Id: I37990bc83b295379f0c93f4ca712e1bbf980fd44
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-08-03 04:54:56 +00:00
Frederik Gladhorn
6c2bfbf88e Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-08-02 23:15:27 +00:00
Timur Pocheptsov
72cf2339ed Introduce QHstsStore - the permanent store for HSTS policies
The store is using QSettings under the hood. A user can enable/disable
storing HSTS policies (via QNAM's setter method) and we take care of
the rest - filling QHstsCache from the store, writing updated/observed
targets, removing expired policies.

Change-Id: I26e4a98761ddfe5005fedd18be56a6303fe7b35a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-08-02 22:01:47 +00:00
Morten Johan Sørvig
e44ff19783 Add QThreadPool::stackSize
Allows setting the stack size for the thread pool
worker threads. Implemented using QThread::stackSize.

Task-number: QTBUG-2568
Change-Id: Ic7f3981289290685195bbaee977a23e0c3c49bf0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-08-02 21:58:54 +00:00
Allan Sandfeld Jensen
bef7e4a222 Allow conversion of QVariants with real null values
Update documentation to be clearer on the special null variant state
with no value as opposed to a variant with a null value, and only block
conversions of the former.

Change-Id: I24fd50285414e049de87de54a63700a89bd5adf1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-02 21:09:19 +00:00
Oswald Buddenhagen
ee07b912a1 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/plugins/platforms/xcb/qxcbconnection.h
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
	src/plugins/styles/mac/qmacstyle_mac.mm
	src/widgets/widgets/qdockarealayout.cpp
	src/widgets/widgets/qmainwindow.cpp
	src/widgets/widgets/qmainwindowlayout.cpp
	src/widgets/widgets/qmainwindowlayout_p.h
	tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
	tests/auto/other/macnativeevents/BLACKLIST
	tests/auto/widgets/widgets/qmenu/BLACKLIST

Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
2017-08-02 22:52:32 +02:00
Friedemann Kleint
245d83bb50 tst_QImageReader: Fix the size of the SVG images
The image appears to be 128x128. Fixes test failures

FAIL!  : tst_QImageReader::readFromResources(rect.svg) Compared values are not the same
   Actual   (image.size()): QSize(128x128)
   Expected (size)        : QSize(105x137)
.\tst_qimagereader.cpp(1493) : failure location
FAIL!  : tst_QImageReader::readFromResources(rect.svgz) Compared values are not the same
   Actual   (image.size()): QSize(128x128)
   Expected (size)        : QSize(105x137)

which likely do not show in the CI since the qtsvg module is not
available when checking only qtbase.

Change-Id: I84ebdde6f2251f56a00f16a54bd20d0c2b23638e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-08-02 20:25:47 +00:00
Kevin Ottens
4bfff6a98b Implement graph layers support in QShaderGenerator
Change-Id: I823f7866bc5e1f3b262f1aacf4c341dabda7305d
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-02 17:34:56 +00:00
Kevin Ottens
236284357f Add support for layers in QShaderGraphLoader format
Change-Id: I5038600e73523ac7eb37a88ddff1f942af18f18e
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-02 17:34:52 +00:00
Kevin Ottens
f3c70ab9f3 Implement graph layers support in QShaderGraph
When creating the statements, it is now possible to pass a list of
enabled layer names. Every node or edge which is not in the list of
enabled layers will be pruned from the graph prior to traversal. Note
that an empty layer list for a node or an edge means it is on all
layers.

Change-Id: I61a4df7d395b4beb42ee55ce08fef8ebe04263c9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-02 17:34:48 +00:00
Kevin Ottens
32281653bf Add the layer concept to QShaderNode and QShaderGraph::Edge
This will be used in further commits

Change-Id: I49977f1ea482b97dc0a159f69a0d2eda3865ec44
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-02 17:34:44 +00:00
Kevin Ottens
3d5c4ce01e Add support for QShaderLanguage enums in QShaderGenerator
Change-Id: I93306d783309cda09fedae3713afde851df3e9a3
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-02 17:34:40 +00:00
Kevin Ottens
dd04551504 Extend the parameter support in QShaderGraphLoader for richer types
In particular, go through QMetaType/QMetaEnum to deal with enums.

Change-Id: I2e847ba328eb46609b86b3dfd6c4dbf532d78b7d
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-02 17:34:35 +00:00
Kevin Ottens
50775424be Extend the parameter support in QShaderNodeLoader for richer types
In particular, go through QMetaType/QMetaEnum to deal with enums.

Change-Id: Idbe16c913c1d471a4a91d219f77876e498c192d9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-02 17:34:30 +00:00
Simon Hausmann
d1d2ca2b41 Ignore hanging tst_qinputdialog::getInt/getDouble() test on macOS 10.12
Change-Id: I495cd98144ba9145e44a9ee5cb8748ae97a6166f
Task-number: QTQAINFRA-1356
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-02 15:49:53 +00:00
Simon Hausmann
f3ca13f3d1 Ignore failures of showMinimizedKeepsFocus/activateWindow on macOS 10.12
Change-Id: I1b5823b48c5dd5bebb8172fd696fc521b7de75b2
Task-number: QTQAINFRA-1359
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-08-02 15:49:23 +00:00
Simon Hausmann
30d32ae72c Ignore failures of submenuTearOffDontClose on macOS 10.12
Change-Id: Ie3409da033325aea832907579d4d61dfd3610e7a
Task-number: QTQAINFRA-1358
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-08-02 15:49:18 +00:00
Joni Poikelin
0a5f71c606 Fix storing of QDateTime timespec for Sqlite
Commit 9e64fc9e1c caused a regression
which stored all QDateTime entries as if they were in localtime,
which causes them to be offset by the amount of local timezone
offset. This is fixed by adding "Z" if the time should be in UTC or
using "+/-hh:mm" if it should use fixed UTC offset or specific
timezone.

Task-number: QTBUG-57138
Change-Id: Ie60905dfb3a517db442b636ca41daf8348753d84
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-07-31 17:59:49 +00:00
Edward Welbourne
60a9747bb5 Add a date-time test for time-zones near epoch and odd transitions
Check we do handle DST after epoch and don't before.
Check we do notice various unusual transitions.
Check we do handle non-whole-hour-offset zones.
(Unfortunately, MS-Win lacks data for some of the zones and is wrong
about the two date-line crossers, so we skip those for it.)

Change-Id: If420d61b9db7f914ca25c22297c16e917ad2307a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-31 09:24:31 +00:00
Joerg Bornemann
85403d0af0 Support more than 62 instances of QWinEventNotifier, take 2
QWinEventNotifiers were limited to 62 instances, because of
WaitForMultipleObject's limitation to MAXIMUM_WAIT_OBJECTS - 1 handles.

Use the RegisterWaitForSingleObject API which does not have this
restriction and executes waits in threads managed by the system. A
central manual reset event per event dispatcher is signaled in the
RegisterWaitForSingleObject callback and waited for in the event loop.

Task-number: QTBUG-8819
Change-Id: I3061811c18e669becf9de603bbdd7ba96e4d2fcd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-07-30 19:11:49 +00:00
Alex Trotsenko
6adff20fe6 Fix bytesAvailable() on UDP under Windows
When ::WSAIoctl() reports 1 byte available for reading, we are trying
to peek an incoming datagram to ensure that the data is actually
delivered. But, according to MSDN docs, we are not allowed to pass NULL
as 'lpNumberOfBytesRecvd' parameter to ::WSARecvFrom() call, if
'lpOverlapped' parameter is also NULL.

The case with an empty datagram is fixed accordingly.

Change-Id: Id13038245332d3fb4bc18038d44a7cfd7ce04775
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-30 13:02:30 +00:00
Friedemann Kleint
3bdd59920f Refactor tst_qdir::entryList()
Split the test in two: one test that requires the symlinks
and test files and one that does not need them.
In the test with test files, verify each step and the deletion
of the files.

Task-number: QTBUG-58654
Task-number: QTBUG-50835
Change-Id: I14de57ce7a1df2d834d5a7565c804dead1d89088
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-29 09:51:50 +00:00
Jędrzej Nowacki
3760120ab3 Remove tst_qtconcurrentiteratekernel blockSize test
The test is just wrong.

It suggests, that it tests minimal block size,
but in reality it is checking if a maximal peak of block size
is bigger then expected minimum block size.

The minimal block size is 1, not 1024 / ideal threads count and
it is defined in BlockSizeManagerV2.

The maximal block size is defined and it is fixed, but it is an
implementation detail, probably not worth testing.

The test is based on a race condition as peakBegin and
peakBlockSize are modified in parallel from multiple threads,
without any synchronization.

Change-Id: I430eedcf83b0fa3e2ce2cfd294eaee7b301e48ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-29 09:35:16 +00:00
Simon Hausmann
5881fc0d2d Ignore tst_QFocusEvent failures on macOS 10.12
Task-number: QTQAINFRA-1352
Change-Id: Ia5cad1af74a2ea581d768ce150e480f3a97b6495
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-07-29 09:35:03 +00:00
Simon Hausmann
5a9247166c Ignore failure of qaccessbilitymac on macOS 10.12
Task-number: QTQAINFRA-1351
Change-Id: I9b41e5664cdb6cedcb68be6197fc21b2cc45963d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-07-29 09:34:57 +00:00
Simon Hausmann
5bce6aabdc Enrich tst_macNativeEvents blacklist
Amends 0c7e4b97a7

Task-number: QTQAINFRA-1292
Change-Id: I599dc1e7d39a96617d48fa32227093c8501b1323
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-07-29 09:34:52 +00:00
Edward Welbourne
8b628bb251 Add test for time zone transitions near the epoch
This needs a zone with transitions near the epoch; and the only CET
with DST that winter was Italy (copied by Malta), for which the Olson
database had a recent (2016) correction to its data, for that winter.
That means we get inconsistent results on O/Sen of different ages.

So add a separate testEpochTranPrivate(), alongside testCetPrivate(),
and test it with America/Toronto.  (Unfortunately, MS-Win gets the
date wrong on the first transition after the epoch, so we have to code
round that.)

Since information before the epoch isn't reliably available, only test
the search backwards if nextTransition does find something before it.
(We can safely assume all real transitions happened since 1601;
non-celestial time-keeping wasn't accurate enough, before that, for
anyone to synchronize with anything but celestial time.)

Change-Id: I984b46938a2805b93bb2afd6855e317b5d66b386
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-28 08:14:36 +00:00
Soroush Rabiei
5e1408bd0d Test locale propagation from date-time editor to its calendar popup
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Task-number: QTBUG-59106
Change-Id: I5b79b76087f0e980de5ea4ec687e8b8e2184506f
Reviewed-by: David Faure <david.faure@kdab.com>
2017-07-28 08:14:28 +00:00
Thiago Macieira
15df77f683 Fix use of getentropy on larger blocks
Found while working on suppressing the warning about the return value
(which is either 0 or -1) was being ignored.

Task-number: QTBUG-61968
Change-Id: I02d22222fff64d4dbda4fffd14d148b1724547ca
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-27 23:19:05 +00:00
Jesus Fernandez
763b0a68be Fix QStandardItem::setChild crash when passing a null pointer
Passing a null pointer as a parameter to the setChild function no
longer crashes when calling the
QStandardItemModelPrivate::itemChanged signal. The child is removed
from the model.
The patch also fixes the behavior of deleting a item. A
dataChanged signal is emitted.

Change-Id: I027e8b0d84fe33c5fca056df870f0e60a020824b
Reviewed-by: David Faure <david.faure@kdab.com>
2017-07-27 19:41:06 +00:00
Thiago Macieira
7c45c6a3c4 Revert "Make QFile::open fail when using an invalid file name"
This reverts commit 346cd79192. The bug
report was incorrect, since the suggested file name is actually valid,
it just happens to name an Alternate Data Stream (ADS) "20:803Z.txt" in
file "testLog-03".

[ChangeLog][QtCore][QFile] Reverted an incorrect change from Qt 5.9.0
that forbade the creation and access to Alternate Data Streams on NTFS
on Windows. This means that file names containing a colon (':') are
allowed again, but note that they are not regular files.

Task-number: QTBUG-57023
Change-Id: I81480fdb578d4d43b3fcfffd14d4f2147e8a0ade
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-07-27 15:42:55 +00:00
Jędrzej Nowacki
7daf0ea581 Blacklist tst_MacGui::nonModalOrder
The test is marked as expected failure for the last 3 years, in CI it
is proven to be somehow flaky and it is failing now because of XPASS
which is not covered by blacklist feature.

This patch extends efforts of 7eba6d039d
and 03b4838cb5 by blacklisting the test
completely.

Change-Id: Ia295d61620fa6bc97b168d4de9456a18ed5c064f
Task-number: QTQAINFRA-1333
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-27 09:08:58 +00:00
Eskil Abrahamsen Blomfeldt
73176d2922 Add API to disable text shaping on fonts
In the past, we had an undocumented text flag that worked with
one of the QPainter::drawText() overloads. This was never intended
as public API and served a specific cause in Qt WebKit at one point.

But there is a general need for such API, as disabling shaping features
easily gives 25% performance improvement on text rendering even for
fairly short strings.

This patch adds a new style strategy flag to disable shaping and
will just uses the CMAP and HDMX tables to get glyph indices and advances
for the characters. In Qt 6, the TextBypassShaping flag can be removed
completely and be replaced by the style strategy.

[ChangeLog][QtGui][Text] Added QFont::PreferNoShaping style strategy to support
improvements to performance at the expense of some cosmetic font features.

Task-number: QTBUG-56728
Change-Id: I48e025dcc06afe02824bf5b5011702a7e0036f6d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-26 10:51:00 +00:00
Jüri Valdmann
af7e756155 Return "en" for QLocale::c().bcp47Name()
Currently QLocale::c().bcp47Name() returns "C" which, according to [BCP47], is
not a valid language tag. In particular it does not conform to the ABNF grammar
in section 2.1 which specifies a minimum length of 2 characters for all language
tags.

[BCP47]: https://tools.ietf.org/html/bcp47

This patch changes the return value to "en" seeing as the documentation for
QLocale::Language states that the C language is identical in behavior to
English.

Task-number: QTBUG-61949
Change-Id: I2a381def8fb7156467e01d105da92bb1f4821204
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-26 08:22:51 +00:00
Jüri Valdmann
2031196ad1 Add test for QLocale::bcp47Name()
Task-number: QTBUG-61949
Change-Id: I34fece0441afb1e69ea84ae59b90c5e2b7cf133f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-26 08:22:43 +00:00
Edward Welbourne
cff39f1818 tst_QTimeZone: improve readability of code and failure reports
When QCOMPARE(,) reports two 12-digit numbers, it's not always
immediately obvious what the difference is (much less what 1/3600000
of it is); nor is it obvious that (or why) a given 12-digit number is
in fact correct.  In contrast, our eyes can make sense of a
QDateTime's reported value quite well, enabling us to see what's
different; and it's possible to at least confirm the plausibility of
2-or-3 am on a spring or autumn day at a plausible transition (or even
to confirm it exactly by consulting suitable web-sites).  Also
document the actual transition happening in each case (since I *did*
consult a suitable web-site).  So prefer to QCOMPARE(,) two QDateTime
values instead of two 12-digit qint64s.

Where a that would be unsuitable, at least compare the difference to
zero, to make the error easier to understand (except when one of the
twelve-digit numbers consists entirely of 9s; that, for once, actually
is easy to see).

Write various multiples of 3600 as the relevant intelligible whole
number times 3600, rather than premultiplying, to make it obvious to
reders what's going on.

None of this changes what is actually tested.

Change-Id: I488e751283a55d4623c93612af13ad631144900d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-25 14:09:03 +00:00
Edward Welbourne
37b0a4d2e1 Fix a loop-test and the bogus data the loop expected
A loop initialized i = 0 and used i > 2 as its condition; it didn't
get very far.  Consequently, the test it was in never checked whether
CET's 2011 transitions happened at the times expected - which they
didn't, as the times in question were in fact the times at which
Pacific/Auckland had its transitions that year.

Change-Id: I94d1f8df615c5bcfe48e73d41b4c7faf2beccb96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-25 14:08:55 +00:00
Timur Pocheptsov
410148ef1e tst_QSslSocket::ephemeralServerKey - fix for OpenSSL 1.1
The original test is quite unfortunate - it has cipher names hardcoded,
and it fails with OpenSSL 1.1 - no matching cipher found for 'RC4-SHA'
and QSslContext::initSsl fails with 'Invalid or empty cipher list'.
We skip this test entry for 1.1.

Change-Id: I810b80a62d9e27a60db71fd412af0c80630d976c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-25 13:29:32 +00:00
Stephan Binner
7964b7468d Convert features.tabbar to QT_[REQUIRE_]CONFIG
Change-Id: Id21a95cbc61b2559a8f517ee60548b61536e3cc4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-25 11:24:02 +00:00
Stephan Binner
2d02c4c799 Convert features.dockwidget to QT_[REQUIRE_]CONFIG
Change-Id: I1d4b0268df01f8bc0aec28af52cc4b639a376863
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-25 11:23:58 +00:00
Stephan Binner
3ade30a2af Convert features.calendarwidget to QT_[REQUIRE_]CONFIG
Change-Id: I93c2e00828a233f004c599bd0702d0a470ae29ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-25 11:23:41 +00:00
Tor Arne Vestbø
185d87708b Fix tst_QAbstractItemView::task200665_itemEntered
Moving the cursor is not synchronous.

Change-Id: I6b820af026585e1fcfef845cc712fa8f6812e941
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-25 10:54:40 +00:00
Allan Sandfeld Jensen
a06148e341 Improve symmetry of variant json conversions
Make QVariant::toJsonValue do conversions as well as
QJsonValue::fromVariant.

Change-Id: I175d43677061470691e2e0104a800be355fbbd3d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-25 09:00:46 +00:00
Andy Shaw
fcfee98f62 QLineEdit: Don't move the cursor after internalInsert() has done so
internalInsert() will set the cursor to the right position which accounts
for any input mask set on the control as well. Therefore it will already
be placed at the next correct position and should not be changed again
after that.

Task-number: QTBUG-40943
Change-Id: Ic0f5fad6999ddd367e435ec4409a5db5b9eacb7b
Reviewed-by: Daniel Teske <qt@squorn.de>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-07-24 09:51:17 +00:00
Tor Arne Vestbø
593719aab5 macOS: Blacklist flakey test tst_QMenu::tearOff()
Change-Id: Id220f10f4ff756230155c7c8f37713d53ed3ca0c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-24 03:49:37 +00:00
Tor Arne Vestbø
58685a48a6 macOS: Blacklist tst_QMenu::pushButtonPopulateOnAboutToShow
It's flakey/failing on macOS, the menu is opened but opened above
the button, so the intersection test fails.

Change-Id: I6b13a1b0df2b07fa36bbb73071cdeb55547ac93a
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-24 03:49:30 +00:00
Frank Meerkoetter
c4e8726042 Fix warning about self assign
...tst_qlineedit.cpp:1938:9: warning: explicitly assigning value of variable of type 'Qt::Key' to itself
-Wself-assign]
    key = key;
    ~~~ ^ ~~~

Change-Id: I18a46f61e13f6e2c74edce869a1c36a7f3a0fb70
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-23 12:18:03 +00:00
Tor Arne Vestbø
f948f96e91 macOS: Blacklist tst_QComboBox::task_QTBUG_56693_itemFontFromModel
Counting draw calls in the style is not a reliable way to count
italic items in the combobox.

Task-number: QTBUG-62080
Change-Id: I6cb6d54535f073f66cfcf61bb19eb645284c835d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-22 06:22:26 +00:00
Tor Arne Vestbø
ab5c28ac55 Fix tst_QListWidget::QTBUG50891_ensureSelectionModelSignalConnectionsAreSet
Don't assume signals will not be emitted during show. The test should
focus on testing that changing the model results in change signals. What
happens before that is not under test, and not stable.

Change-Id: I71e62abc15fc81c069d7685e4342e795449c3632
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-21 22:10:28 +00:00
Thiago Macieira
b91a6ef9cd Deprecate and remove the unused bearer support in QNetworkProxy
This hasn't done anything since at least Qt 5.0. It's possible it was
only used in Symbian, which we removed before the 5.0 release. This only
served to make the tst_QNetworkProxyFactory test slow.

[ChangeLog][QtNetwork][QNetworkProxy] The functions related to
QNetworkConfiguration are deprecated. They've performed no action since
Qt 5.0, so code using them can safely stop doing so.

Change-Id: I84e45059a888497fb55ffffd14d31b7c2978a04e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2017-07-21 18:25:42 +00:00
Tor Arne Vestbø
2e3e8cec89 macOS: Blacklist tst_QMenu::layoutDirection
It's failing when enabling synchronous expose events, but likely
due to making assumptions about expose behavior. Will be looked
at in more detail once the expose event patch is in, so we can
move forward.

Task-number: QTBUG-62092
Change-Id: Ie76b5f11ccf841981a42d2eda19fbcda8b43c36c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-21 13:31:19 +00:00
Daniel Teske
854fdaaf76 QLineEdit: Add selectionEnd() and selectionLength()
Getting the end position of the selection was not possible.

[ChangeLog][QtWidgets][QLineEdit] Added selectionEnd(), selectionLength(),
complementing selectionStart().

Change-Id: Iaecc624063d7c043f9502351f07eb76f869e86f1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-20 13:46:26 +00:00
Simon Hausmann
d39ec44e19 Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-07-20 13:46:11 +00:00
Tor Arne Vestbø
a639a4cc07 tst_QWindow: Wait for platform to ack window states before continuing
Fixes flakiness where we enter and exit window states too fast on macOS,
while also removing 2 second waits in the positioning tests that were
slowing things down needlessly.

Change-Id: Ia4ee4d4812474c520fdd3f76b047f4eabe1a8220
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-19 23:06:21 +00:00
Tor Arne Vestbø
a63494ae12 macOS: Blacklist tst_MacNativeEvents::testKeyPressOnToplevel and friends
They fail when enabling synchronous expose events. Disabled for now
until we can look into why, but it's assumed to be an issue with the
test harness/how we hook into Quartz to send/observe events.

Task-number: QTBUG-62042
Change-Id: I723d049ec5d1029edb0ad3b1f47fffc829a8924b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-19 23:03:50 +00:00
Sergio Martins
29f6b50732 Windows: Don't raise inactive windows when showing a tooltip
The Qt4 Q_WS_WIN ifdef never got ported.

Change-Id: Iad1ca1a3e20bd5254895781eee09897520b7d7d1
Task-Id: QTBUG-39147
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-07-19 14:21:52 +00:00
Marc Mutz
94cf203f36 Use QSharedPointer::create() more
This is the result of running the (experimental) clang-tidy check
   qt-modernize-qsharedpointer-create

Discarded changes:

- tst_qsharedpointer.cpp: not sure we want these replacements there
  (→ separate change)
- tst_collations.cpp: hit in a template specialization that is
  instantiated with both QSharedPointer and QSharedDataPointer.

Change-Id: I203c2646e91d026735d923473af3d151d19e3820
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-19 13:40:42 +00:00
Morten Johan Sørvig
4585889467 Fix race condition in the processEvents test
This test verifies processEvents(WaitForMoreEvents)
behavior by first processing all pending events (in
a loop) and then verifying that a following processEvents
call actually waits.

But there is no guarantee that the OS won’t introduce
more events after the first loop has completed. This
does indeed seem to happen on recent versions of macOS.

Change the test to not require that the processEvents
call blocked and de-blacklist.

Task-number: QTBUG-61131
Change-Id: Ic8fa74a6085165442791264f6f137a2fa6083138
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-19 12:29:53 +00:00
Simon Hausmann
407302fb1b Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qwindowspipewriter.cpp
	src/widgets/styles/qcommonstyle.cpp

Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
2017-07-19 09:47:29 +02:00
Friedemann Kleint
a9dfdbd06a tst_QStyle::drawItemPixmap(): Check on the image color
Verify that all pixels of the grabbed image are green instead
of comparing an image loaded from file.
The test then also passes when High DPI scaling is active in
which case a twice as big pixmap with DPR=2 is obtained when
grabbing the widget.

Change-Id: Ie5244a39a68ea0defd2590cf30f251d660d0869b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-07-19 07:33:38 +00:00
Friedemann Kleint
1b190e7ea6 tst_QWidget: Fix to pass with High DPI scaling enabled
Scale coordinates in a few places, remove pixmap scaling in
grabWindow() (Windows).

Change-Id: Iba9e5d3ca55422a14eda09c8d04329a455d3acb3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-07-19 07:32:55 +00:00
Thiago Macieira
f3205a4949 Merge qt_error_string and QSystemError
This removes a lot of duplicated code that existed in both qglobal.cpp
and qsystemerror.cpp, including the hack to get the correct strerror_r
signature.

This removes the incorrect use of EACCES, EMFILE, ENOENT, and ENOSPC
from qt_error_string on Windows. qt_error_string is supposed to be used
only with Win32 error codes from GetLastError(), despite there being a
lot of uses in cross-platform and even Windows-specific code that pass
errno constants.

It may or may not work: that depends on whether the constants happen to
match. ENOENT matches ERROR_FILE_NOT_FOUND and one could argue that
ENOSPC matching ERROR_OUT_OF_PAPER is acceptable, but EMFILE isn't the
same as ERROR_BAD_LENGTH nor is EACCES, ERROR_INVALID_DATA.

Change-Id: I1eba2b016de74620bfc8fffd14cccb7f77f4b510
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-18 15:51:22 +00:00
Timur Pocheptsov
07c0e0fdcf QAsn1Element - fix toDateTime function
ASN UTCTime uses two characters to encode a year (YY). When converting it
into QDate, it's quite naive to just add 2000. According to RFC 2459,
these YY represent dates in the range [1950, 2049].
This patch also introduces a helper function doing the checked conversion
from a string to int (to be reused in the following-up patches).

Task-number: QTBUG-61934
Change-Id: I3f6f471d24e8357b83b2f5973023b2b842751389
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-07-18 13:09:16 +00:00
Tor Arne Vestbø
46001e6f49 Blacklist tst_QWidget::setToolTip on all macOS platforms
It's broken due to tst_QWidget::testDeletionInEventHandlers,
but the root cause is not known yet.

Task-number: QTBUG-61986
Change-Id: I5b77efaf6910123d10a1456c54b873100e538a69
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-17 16:42:33 +00:00
Tor Arne Vestbø
64bce9bbff tst_QGL::graphicsViewClipping: Wait for viewport's window handle
The QWidget overload of qWaitForWindowExposed waits for the widget's
top level QWindow, which for the viewport is the graphics-view.

We want to explicitly wait for the viewport to be exposed, as the
viewport is covering the whole graphics-view, preventing it from
being exposed. See a6991376c.

Change-Id: I86df43871126562f09e4ce14931bc6fc7f06263d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-17 14:11:06 +00:00
Tor Arne Vestbø
b2cb4c73d3 Stabilize tst_QWidget::setMaskInResizeEvent on OS X 10.10
Change-Id: I7dbe9c7a91301e0002f9e1827f6d0b495d2b9ec5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-17 13:10:31 +00:00
Tor Arne Vestbø
af00fe5d89 macOS: Skip tst_QWindow::modalDialog
The tests uses QWindow::requestActivate() to verify that a window does
not become active when a modal dialog is running, but on macOS we have
no guards for this, so the test can potentially fail.

In addition, due to a bug in QCocoaEventDispatcher, we end up waiting
5 seconds for that failure to manifest.

Task-number: QTBUG-61965
Task-number: QTBUG-61964
Change-Id: I2f1b62d953e9b6dabf2df0c3023564f27919c498
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-07-14 15:44:01 +00:00
Tor Arne Vestbø
fdfa3b1141 Skip tst_QWidget::testForOutsideWSRangeFlag
The test assumes that resizing a QWidget to 0x0 will result in the
QWindow ending up with that size, and hence not being exposed, but
this is not the case. On a QWindow level we treat 0x0 as a trigger
for the platform layer to set the default size, and the window
ends up exposed.

Ideally QWindows should allow 0x0 sizes, but this is a bigger change.
In the meantime, we skip the tests so that other changes can be
integrated without the test failing.

Task-number: QTBUG-61953
Change-Id: Ib17187b4afd1b06eaa76653be18e93abea555b59
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-07-14 04:43:06 +00:00
Gabriel de Dietrich
d38fe875c7 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
    src/widgets/widgets/qmainwindowlayout.cpp

Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
2017-07-13 16:36:10 -07:00
Daniel Teske
7051572618 QLineEdit: Fix length calculation for input mask "\\\\"
Consider the raw string \\\\. The previous algorithm would consider
the last 3 \ to be escaped because the previous character is a \ and
thus calculating a maxLength of 3.

But this should be treated as two escaped \ with a maxLength of 2.

Change-Id: I6c4b8d090a2e1c6e85195d5920ce8b80aea1bc2d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-13 14:59:17 +00:00
Andy Shaw
0843c6ca7f QSqlField: Add a means to see what the tablename is for a given field
When you are using a query that pulls from a number of different tables
then it can be ambiguous as to which table a particular field belongs to.
So this will make it possible to determine the table that a given field
belongs to if it is set.

Task-number: QTBUG-7170
Change-Id: I49b7890c0523d81272a153df3860df800ff853d5
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-12 09:01:50 +00:00
Allan Sandfeld Jensen
b3f7bea105 Handle conversion and comparison between qvarianthash and qvariantmap
QVariant claims to be able to QVariantHash and QVariantMap, but the
actual conversion implementation is missing.

Task-number: QTBUG-61471
Change-Id: I0cba74642aa77dc423effed289bc7619922a89eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-11 21:10:54 +00:00
Allan Sandfeld Jensen
9423be1f19 Fix deprecation warnings
Switch to QImage::sizeInBytes for huge QImage support.

Change-Id: I0145f204dd2db6670e199c320fff9064b4a97ef4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-07-11 18:59:07 +00:00
Morten Johan Sørvig
a6991376cc Wait for window expose on the viewport widget
The child viewport window covers the entire client
area of the parent window, which prevents the parent
window from being exposed.

This worked by accident until now, and was uncovered
by changes to the cocoa platform plugin implementation.

Change-Id: I0d62a1a33f125e5a9030c8def452a49886e54956
Task-number: QTBUG-50414
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-11 15:24:42 +00:00
Andy Shaw
82e6ac8cdb Implement setDoubleStep for QInputDialog
setDoubleStep works in the same manner as for setIntStep in that it is
just available for input dialogs getting a double.

[ChangeLog][QtWidgets][QInputDialog] Added setDoubleStep to enable
changing of the step amount for getDouble().

Task-number: QTBUG-17547
Change-Id: I5cabcfceb23324f8045f2b1e49017644418db01a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-11 12:10:39 +00:00
Timur Pocheptsov
3e3466d28c tst_QSslSocket::protocolServerSide - fixes for OpenSSL 1.1
Several tests are not valid for 1.1 anymore:

1. SSL2 was removed, but there is no OPENSSL_NO_SSL2 and the 'protocolServerSide'
   test is trying to use QSsl::SSLv2 and thus is failing.
2. We now use the generic TLS_server/client_method instead of version specific
   methods we have in pre-1.1 back-end. So, for example, a client socket with
   QSsl::TLS_V1_0 in its SSL configuration will be able to negotiate
   TLS 1.2 if our server socket wants it, while with TLSv1_client_method
   (OpenSSL < 1.1) our test was expecting SSL handshake to fail.

Change-Id: I18efd5921c79b189e4d9529be09299a361a8a81d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-07-11 10:44:08 +00:00
Kevin Ottens
0d196b4268 Add support for parameters in QShaderGenerator
Change-Id: Iff8fec51ddbf9b018cb5ec3aff357125134013eb
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:23 +00:00
Kevin Ottens
13ecd686b9 Add support for node parameters in QShaderGraphLoader
Now the parameters from the prototypes are used as default values and
the graph file can overload them.

Change-Id: I9a8a73963c7e578bd0a34e96f76f147a12224f4f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:19 +00:00
Kevin Ottens
5667c870fb Add support for node parameters in QShaderNodesLoader
This will allow to make the prototypes more extensible when referred to
from a graph file while providing some sane defaults.

Change-Id: I1ae10182427d8a7d29c51a64e19e99139494ea92
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:16 +00:00
Kevin Ottens
f7fefed2ea Add parameters to QShaderNode
This will allow to create nodes having an entry point for tuning, still
need to be exploited by the loaders and the shader generator. Coming in
further commits.

Change-Id: I8384b0f528c9919e9f8d35102adde2b307f08b80
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:13 +00:00
Kevin Ottens
74e9a11386 Complete the QShaderGraphLoader tests to introspect nodes
We forgot to check that the node content was correct and complete when
loading the graph.

Change-Id: Id4ee6aaba6ca268b0785e7fa3fb51a19817e7c9c
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:10 +00:00
Allan Sandfeld Jensen
4f88475a96 Allow QImage with more than 2GByte of image data
Changes internal data-size and pointer calculations
to qssize_t.

Adds new sizeInBytes() accessor to read byte size, and
marks the old one deprecated.

Task-number: QTBUG-50912
Change-Id: Idf0c2010542b0ec1c9abef8afd02d6db07f43e6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-08 08:17:13 +00:00
Edward Welbourne
9381ca77b2 tst_QDateTime::toTimeSpec(): verify round-tripping works cleanly
Change-Id: I811fa4249dae923e5e4e434910d8bf96c15bff25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:09:33 +00:00
Edward Welbourne
cf9187f8c9 tst_QFileInfo: generalize old-file test
Now that QFileDevice::setFileTime() provides a portable way to prepare
our test file, we can verify QFileInfo does handle the distant past,
notably including negative time_t values.  The old MS-specific code
used a time back in 1601, which we can't hope to support
cross-platform, so use one in 1901 that's a little inside the range of
32-bit time_t.

Task-number: QTBUG-47985
Change-Id: I2de3e79d8c7864221f92395813b63f373e4d8a3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:09:24 +00:00
Edward Welbourne
fcb423d1f2 Q(Date|Time)+: in QDebug's <<, handle invalid explicitly
The output didn't previously make clear that the datum was invalid.
It's now explicitly invalid.  At the same time, use QDebug's space()
and nospace() methods to make spacing choices explicit.
Revised a QDate test to match.

Change-Id: I4699f5897530b4caa31c22fdb07de149832b30f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:08:59 +00:00
Edward Welbourne
cc3b9cf3b3 Clarify tst_QDateTime::fromStringToStringLocale() using a macro
Separate the part varying between tests from the common form of all
the tests, so the reader can see the common pattern and know for sure
that there's not a typo or copy-and-paste glitch.

Change-Id: I3145a26ab42c104eb27756d906ac87f937024bad
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:08:51 +00:00
Gabriel de Dietrich
ac8955794f tst_qstyle: Don't fail on empty scroller subcontrols on macOS
macOS hasn't had SC_ScrollBarAddLine and SC_ScrollBarAddLine
since 10.7, when transient scrollbars first appeared.

We also make the warning message a bit more informative.

Change-Id: Idef4684162456d9bc274eea77908a6afe24fa0f5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-07-07 17:54:53 +00:00