Commit Graph

7589 Commits

Author SHA1 Message Date
Tony Sarajärvi
96c27f0dfa Blacklist tst_QSslSocket::protocolServerSide on OS X 10.11
Task-number: QTBUG-48860
Change-Id: Ia352378f48b9ab404d06ac5ef9bf53afa8f192fd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-03-30 12:10:16 +00:00
Sami Nurmenniemi
b387257261 Fix layout tests for GCC 5.2.x/5.3.x
GCC bug 68949 causes tst_QGraphicsGridLayout and tst_QGraphicsLinearLayout
to fail on 5.2.x/5.3.x: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68949.
This change adds aggregate initialization to QSizeF arrays to work around
the bug. The bug was discovered when compiling and running tests on ARM
with GCC 5.3.0.

Change-Id: I9ecf7b032b6ca1477c29dca3bd7d0ec8d69a0454
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-30 06:58:07 +00:00
Sami Nurmenniemi
80f1762a59 Fix tst_QUdpSocket for QEMU
QEMU does not support all syscalls needed for udp socket testing.
Skipped tests that can't pass on QEMU.

Change-Id: I40882207a47cfafbc3becb3dff8e7cead9676255
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-29 14:29:43 +00:00
Timur Pocheptsov
baf7180776 Use HTTP2WasUsedAttribute for HTTP2
Previously we were always setting SpdyWasUsedAttribute for SPDY/HTTP/2/HTTP/1.1
(true/false) which is confusing. Now if HTTP2AllowedAttribute was set to true on
a request, we set HTTP2WasUsedAttribute. Otherwise, as we did before, we're setting
SpdyWasUsedAttribute.

Change-Id: I0c44cfb5469fef0c12719baa951197ee2accee4a
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-03-29 13:54:49 +00:00
Friedemann Kleint
50ab231582 tst_QGuiApplication: Split the quitOnLastWindowClosed() tests
Make it possible to blacklist the (newly created)
quitOnLastWindowClosedMulti() if all else fails.

Task-number: QTBUG-59088
Change-Id: I8c143a2017e7aefaf6cad6ada9c1464d40c952e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-03-29 13:06:21 +00:00
Marc Mutz
46351b4e60 QColor: port to QStringView
... leveraging the existing support for QLatin1String, which is the
char equivalent of QStringView.

The only noteworthy changes here are the port of the low-level
functions to size_t and that the internal template function,
setColorFromString(), can now take its argument by value, since only
views are ever passed to it anymore.

In the test, used new QTest::addRow() to format test names, and
introduced temporaries to avoid re-calculating the same input values
for every check.

Change-Id: Ia3c59e5c435ff753f34993a8d85c0c0b4e8e2b22
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-29 12:29:52 +00:00
Simon Hausmann
b263384589 Fix building of qopengl test on boot2qt
Only test for xcb specific sub-features if xcb is available in
the first place - not the case with Boot2Qt builds.

Change-Id: Iad49648ce1c8781d0c7bb2b2dcd4b7834434d51d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-03-29 12:29:50 +00:00
Marc Mutz
7180236063 QStringView: improve manual overload management
We want to prevent

  QStringView(QChar|QLatin1String|QByteArray|const char*)

from compiling as QStringView(QString(...)), so I added = delete'ed
ctors for these types to QStringView. However, that makes QStringView
participate in overload resolution for these types. Even if the
QStringView ctor will always fail to compile, the presence of these
ctors alone makes calls to functions overloaded on QString and
QStringView ambiguous:

   f(QStringView);
   f(QString);
   f(foo);        // ambiguous
   f(QChar('f'))    // ambiguous
   f(QLatin1String(foo)); // ambiguous
   f(QByteArray(foo));    // ambiguous

Fix by making the QString and QStringRef constructors templates
constrained to accept only these two types. This should also help to
move the QStringView definition to before the QString one (as soon as
we get rid of or start to ignore QString::Null), simplifying a lot of
code in qstring.h down the line.

This should also fix MSVC's accepting of two user-defined conversions
which caused static non-compile-tests to fail in the initial
QStringView patch, and which were therefore removed. This patch brings
them back.

Change-Id: I95ac38c0d31cd8c726f7e952017569d32e484413
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-29 12:29:35 +00:00
Laszlo Agocs
dd38574160 Switch to RGB(A|X)8888[_Premultiplied] for QOpenGLFBO readbacks on GLES
Instead of the never-ending blacklisting of "broken" drivers, simply switch
to always choosing a byte ordered QImage format with OpenGL ES, and keep
on using the (one and only) spec-mandated GL_RGBA/GL_UNSIGNED_BYTE combo.

There is nothing broken with not supporting BGRA for glReadPixels even when
GL_EXT_read_format_bgra (an out of date, pre-2.0 extension that got folded
into the spec to begin with) is present. We do not have a good way to tell
if BGRA_EXT is supported for glReadPixels or not, so just skip the whole
problem altogether.

Task-number: QTBUG-59283
Task-number: QTBUG-59303
Change-Id: I9f0605380923bd3b3ffdeb80f5c172d3e4cc7927
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-03-28 11:17:52 +00:00
Liang Qi
b48a13fd68 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	examples/examples.pro
	tests/auto/corelib/tools/qchar/tst_qchar.cpp
	tests/auto/other/qaccessibility/accessiblewidgets.h

Change-Id: I426696c40ab57d14dc295b8103152cede79f244c
2017-03-28 09:28:31 +02:00
Sami Nurmenniemi
514fff1e39 Fix largefile tests on ARM and QEMU targets
- Test tst_LargeFile::mapFile fails on Qemu for files over 4Gb.
  Fixed by limiting maxSizeBits to 28 (must be n*4 and < 32).
- Bug QTBUG-21175 is also effective on ARM targets. Fixed by
  expecting failure also on ARM.

Change-Id: I9103727e618a17259b4785ec8c284f3bb60ebea7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-28 06:55:32 +00:00
Andy Shaw
9292ea17a0 Use unique table name for the sqlite_enableRegexp test
This change amends 2a3297c726.

Task-number: QTBUG-59317
Change-Id: Ia08b83785f67105a1c7e71c1f4081f1bc755d756
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-03-27 09:07:02 +00:00
Liang Qi
7702fe8602 Merge remote-tracking branch 'origin/5.8' into 5.9
Change-Id: Icdd71e9713725bda9c305e338f5c8b41a92ed8e8
2017-03-27 10:42:08 +02:00
Marc Mutz
59928d23fc Port QLocalePrivate::*ToCode() to QLatin1String
The returned data is in US-ASCII (or else Latin-1), and resides in
consecutive memory. We can therefore return it in a QLatin1String,
which, however, will in general not be NUL-terminated.

Many users use the return value as part of a QStringBuilder
expression, and those which are not are not pessimized further by
this change.

The caller in qtimezoneprivate_icu looks as if it could simply zero
-terminate the return value and use it as-is, as opposed to
converting to UTF-8, but I left the code equivalent to the original
just the same.

Change-Id: I0e628af8c1320fcff8d0aacf160e859681d2b85a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-26 06:44:29 +00:00
Marius Kittler
38550c562d json encoder: Harmonize number serialization with ES6
Ensures that numbers representable as 64-bit integer
are not printed using exponent notation.

Some JSON implementations such as the one of the Go
standard library expect this in the default
conversion to int.

Change-Id: Ic3ac718b7fd36462b4fcabbfb100a528a87798c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-25 14:26:30 +00:00
Olivier Goffart
94e6e8dfc6 tst_moc: fix include guards
Change-Id: I465c035cc741f94cb6737e86e33fbd1589ddaa8e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-25 12:53:09 +00:00
Marc Mutz
8092a01f84 QDebug: add op<<(QStringView)
[ChangeLog][QtCore][QDebug] Added streaming of QStringViews.

Change-Id: Id81fae223b60188d541b255b67bc316f9f1b6bef
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-24 20:43:03 +00:00
Marc Mutz
00a8be85d1 Long live QStringView!
QStringView is a simple container for (const QChar*, int) and (const
char16_t*, size_t). It acts as a replacement interface type for const
QString and const QStringRef, and enables passing all kinds of
string-like types to functions otherwise expecting const QString& -
without the need to convert to QString first.

The use of this new class is guarded by a macro that enables three
levels of QStringView support:

 1. offer QStringView, overload some functions taking QString with
    QStringView

 2. like 1, but remove all overloads of functions taking QStringRef,
    leaving only the function taking QStringView.  Do this only where
    QStringRef overloads tradionally existed.

 3. like 2, but replace functions taking QString, too.

This is done in order to measure the impact of QStringView on code
size and execution speed, and to help guide the decision of which
level to choose for Qt 6.

This first patch adds QStringView with most of its planned
constructors, but not much more than iterators and isNull()/isEmpty().

Further patches will add support for QStringView to QStringBuilder,
add QStringView overloads of functions taking QString, and add the
complete API of const QString to QStringView.

[ChangeLog][QtCore][QStringView] New class, superseding const QString
and QStringRef as function parameters, accepting a wide variety of
UTF-16 string data sources, e.g. u"string", std::u16string{,_view},
and, on Windows, L"string", std::wstring{,_view} without converting to
QString first.

Change-Id: Iac273e46b2c61ec2c31b3dacebb29500599d6898
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-24 18:34:35 +00:00
Edward Welbourne
e5c0371d18 Fix propagation of locale from widget to its children
Fix the condition in QWidgetPrivate::resolveLocale() to decide whether
to propagate locale: make it match setLocale_helper()'s condition when
deciding whether to propagate to descendants.  This lead to a
QDateTimeEdit's calendar popup not getting told what locale to use
correctly, unless we setLocale() on it overtly, which then blocked
propagation of locale changes to it unless QDateTimeEdit manually
propagated the changes.

Fix the documentation of WA_WindowPropagation to mention locale as
also being propagated (which it was in several places, only neglecting
this one in resolveLocale).

[ChangeLog][QWidget][Qt::WA_WindowPropagation] Propagate locale
consistently, along with font and palette, within the widget
hierarchy.  Previously, locale was propagated on ancestral
setLocale(), but not on creation of the descendant.

Task-number: QTBUG-59106
Change-Id: I92270f7789c8eda66a458274a658c84c7b0df754
Reviewed-by: David Faure <david.faure@kdab.com>
2017-03-24 13:57:22 +00:00
Olivier Goffart
d82d2f6716 QSslSocket: fix connection to a international domain name
RFC6125 section 6.4.2 specify we need to convert the IDN to ascii
before comparison. Note that we don't need to toLower anymore
because toAce takes care of it.

Section 7.2 recommands that we dod not attempt to check for wildcard
character embedded within the A-labels or U-labels of an
internationalized domain name. So we reject names that contiains a
'*' but starts with 'xn--'.

Change-Id: Ib0830520a1f82bbf9fd11818718277a479527ee3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-03-23 16:11:15 +00:00
David Faure
83038a7acf QSFPM optimization in dataChanged: don't re-sort if the order didn't change
We can quickly check if the change affects sorting by checking whether
lessThan(N-1, N) and lessThan(N, N+1) are still true. If this is the case
for all changed rows, then we can skip the whole remove+insert+layoutChanged().

Task-number: QTBUG-1548
Change-Id: Ia778b3e8880cc9909eef1f8a016c84235870353d
Reviewed-by: Stephen Kelly <steveire@gmail.com>
2017-03-23 14:19:09 +00:00
Friedemann Kleint
e0becd6a8a tst_QMdiArea::tabBetweenSubWindows(): Improve warning message
The test has been observed to be flaky, printing warnings
"Rubber band has different geometry". Output the geometries.

Task-number: QTBUG-59641
Change-Id: I6c209f2a98a07655e8523c012c5562d602d217ad
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-22 20:04:13 +00:00
Alex Henrie
33492375fb QGroupBox tests: Correct spelling of "release"
Change-Id: I2341cbac0588d1b0fa1fa0dfbc2ee49211ade934
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-22 18:30:14 +00:00
Edward Welbourne
058642eae9 tst_QTimeZone: fix #if-ery to use Q_OS_DARWIN
Avoid using deprecated define in test.

Change-Id: I33550ae6cfb1ebe03550826371c763afa35f1972
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-03-22 17:12:21 +00:00
Ulf Hermann
329385a5d5 Build examples and tests only if their requirements are met
If the respective modules aren't available we cannot build the tests
and examples. We drop the qtConfig(opengl) requirement for the opengl
examples as
a, we would need to make the QtGui configuration available for that to
   work, and
b, we should not add too much detail to the tests and examples build
   configurations. Checking each test and example for every feature it
   uses would be too much.

Task-number: QTBUG-57255
Change-Id: Ifb043c81ec9e5c487765297bd65704812cd281fc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-22 15:55:55 +00:00
Laszlo Agocs
8d72aba9e3 Introduce QVulkanWindow
A convenience subclass of QWindow that provides a Vulkan-capable
window with a double-buffered FIFO swapchain.

While advanced use cases are better served by a custom QWindow
subclass, many applications can benefit from having a convenient
helper that makes getting started easier.

Add also three examples of increasing complexity, and a variant that
shows embeddeding into widgets via QWindowContainer.

[ChangeLog][QtGui] Added QVulkanWindow, a convenience subclass of
QWindow.

Task-number: QTBUG-55981
Change-Id: I6cdc9ff1390ac6258e278377233fd369a0bfeddc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-22 15:40:57 +00:00
Edward Welbourne
c587036dc6 Mark some methods in test code as overrides
CustomTextWidgetIface marked its text() method as an override;
DropOnOddRows marked its canDropMimeData() as an override; each
neglected some other methods that are overrides.  Convert
Q_DECL_OVERRIDE to the keyword in affected classes, to match.

Change-Id: I78b38e20a81e3e6aab282a1cb3d70cdf8a5f4135
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-03-22 14:29:58 +00:00
Marc Mutz
1ebd23a670 tst_QArrayData: fix unused variable warning in reallocate()
Trailing QFETCHes can be dropped.

Change-Id: I4dbc5ff07a6bf418a09822424a8fb036d8349114
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-22 09:22:34 +00:00
Thiago Macieira
cd58abb1db Autotest: make tst_QDir more reliable on tests being run out of order
mkdir(data2) depended on mkdir(data1) being run before, or it would
fail. In addition, the rmdir() test required the equivalent mkdir() test
being run before. So drop these annoying dependencies and make the tests
cleaner by having clear separation of the test data and merging the two
tests into one

The entryList() test still depends on the testdir being clean: it will
fail if mkdirRmdir() previously failed.

Change-Id: Iaddbecfbba5441c8b2e4fffd14a3e35972d2a3d8
Reviewed-by: David Faure <david.faure@kdab.com>
2017-03-22 06:40:59 +00:00
Liang Qi
65faf45655 Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/plugins/platforms/eglfs/eglfs-plugin.pro

Change-Id: Id76cdbb41b7758572a3b8ea4dcb40d49bac968db
2017-03-21 19:07:53 +01:00
Gabriel de Dietrich
6445aa4b06 QCursor: Add equality operators
[ChangeLog][QtGui][QCursor] Added equality operators.

Change-Id: Iedeab4673b2a77ad2e51a0d50297b12bba3b9505
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-21 17:22:41 +00:00
David Faure
05924ddff9 tst_qurl: skip test with ':' in filename, on Windows
Task-number: QTBUG-59622
Change-Id: Ib4b458b5d0fc2dd9ea6758b8517a953f6d768a39
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-03-21 13:15:53 +00:00
Friedemann Kleint
a9383ef99a Diaglib: Output DPI and scale factors
Also pass options to formatWindow().

Change-Id: Ifa506331ea010087bfd7ab8bd3f7dda531f142a8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-03-21 07:16:57 +00:00
Alexander Volkov
8a3e8856e5 qmake: Add test functions for comparing version numbers
qmake really lacks version comparing functions:
users either use ugly constructions to compare versions
by components, such as
greaterThan(QT_CLANG_MAJOR_VERSION, 3)|greaterThan(QT_CLANG_MINOR_VERSION, 4):
or even incorrectly compare versions as strings:
!lessThan(apple_clang_ver, "5.1")|!lessThan(reg_clang_ver, "3.4"):

Add test functions versionAtLeast and versionAtMost which use
QVersionNumber to compare version numbers by components.

Change-Id: I65e6b3c296d0301d544b7e38bf3d44f8d555c7fc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-20 21:56:01 +00:00
Thiago Macieira
99fc96fd37 QMetaType & QVariant: "load" and "save" std::nullptr_t
We don't load and save pointers usually because the pointer value cannot
be guaranteed to remain across program invocations. However, nullptr is
an exception: a null pointer is always a null pointer.

We don't actually have to read or write anything: there's only one value
possible for a std::nullptr_t and it is nullptr.

[ChangeLog][Important Behavior Changes] A QVariant containing a
std::nullptr_t is now streamable to/from QDataStream.

Task-number: QTBUG-59391
Change-Id: Iae839f6a131a4f0784bffffd14aa374f6475d283
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-20 21:53:32 +00:00
Tony Sarajärvi
bd6838d54d Blacklist tst_QPauseAnimation::multipleSequentialGroups on all macOS
Task-number: QTBUG-59218
Change-Id: Ic839a36af1ecab39da0c3394c34181b6717e24e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-20 16:53:16 +00:00
Friedemann Kleint
2c935ef565 Diaglib: Fix WinRT exclusion
Amends change 8deeb6777d.

Change-Id: If403871b1fb117a3f8042e0e2397e6d521d17beb
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-03-20 15:04:25 +00:00
David Faure
035e0eafa6 QUrl::fromUserInput: fix handling of files with a ':' in the name
QUrl::isRelative(str) would be false for such files, so first check for
file existence before doing any URL parsing.

Change-Id: I51b6229251ad94877ac408b2f8018456d3e10a36
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-20 12:55:36 +00:00
Liang Qi
dd613e65ea Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-03-20 10:56:29 +00:00
Eskil Abrahamsen Blomfeldt
391e3aeef4 Fix char format of preedit text in empty text block
When a text block is empty, and we are adding preedit text to it,
we need to merge the format of the preedit text with the current
format of the cursor, otherwise we will use a default format and
then suddenly switch to the proper one when the text is committed.

The reason this becomes a bit complex is that there are no rules
preventing someone from using several ime attributes to specify
formats for isolated parts of the text, and no rules defining the
order of such attributes. So even if the common case is one
text format attribute for the entire string, we need to make sure
we also handle the other cases gracefully, e.g. when we are setting
different formats for different substrings and then providing these
out of order. To make sure we have these corner cases covered, we
also add a set of autotests.

[ChangeLog][Qt Widgets][TextEdit] Fixed initial char format of
input method text as it is in pre-edit mode.

Task-number: QTBUG-59196
Change-Id: I1e37928e3bd1395fec1b5591908d4c69b84eb618
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-20 10:10:26 +00:00
Liang Qi
ae2695535a Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qfilesystemengine_win.cpp
	src/gui/text/qdistancefield.cpp
	src/plugins/platforms/xcb/qxcbconnection.h

Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
2017-03-20 09:00:44 +01:00
Anton Kudryavtsev
1dc4c3817b QStringList: add contains(QLatin1String) overload
... to avoid the expensive conversion from QString to QL1S.

[ChangeLog][QtCore][QStringList] Added contains(QLatin1String) overload.

Change-Id: Ie75839ce9e46e03fe5155a02c7dcf00277b95c8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-20 06:16:59 +00:00
Anton Kudryavtsev
4a97e3b98a QMap, QHash: make key_iterator satisfy the DefaultConstructible concept
Change-Id: Ifc3f481ddb902b26c217516412c93a4a39a32b1c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-20 04:36:42 +00:00
Laszlo Agocs
c1a2f97a3b Set default fbo redirect correctly for QOpenGLWidget viewports
Task-number: QTBUG-59318
Change-Id: Icf2ea4e5ebdeec31750edc8b34a9b9f6bfb64744
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-18 17:37:45 +00:00
Marc Mutz
5c724a6087 QChar: fix ambiguous comparisons with 0, '\0', ... for good
Commit e0ea0f6178 optimized QChar <->
QString(Ref) comparisons by adding more overloads to avoid creating
QStrings from QChars just to compare them.

But these new overloads made existing comparisons to QChar ambiguous.
This was known at the time for QChar/int comparisons.

It has since turned out that also comparing to '\0' is ambiguous,
ie. not comparing to int or char per se is ambiguous, but comparing to
nullptr constants is, because QString(const char*) is just as good a
candidate as QChar(char)/QChar(int).

Since we allow QString/QChar comparisons, it seems logical to solve
the problem by adding QChar<->nullptr overloads.

[ChangeLog][QtCore][QChar] Disambiguated comparisons with nullptr
constants such as '\0', which 5.8.0 broke. As a consequence,
QChar<->int comparisons are no longer deprecated, as this was a failed
attempt at fixing the ambiguity.

Change-Id: I680dd509c2286e96894e13078899dbe3b2dd83bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-17 20:28:32 +00:00
Marc Mutz
93a4bf5c8b Blacklist also tst_QSemaphore::tryAcquireWithTimeout(2s)
It has started failing recently on the CI, too.

Task-number: QTBUG-58745
Change-Id: I4c8834917e6455d00c300549ed448b06da75d5bc
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2017-03-17 20:19:20 +00:00
Marc Mutz
1b73d13975 tst_QMimeDatabase: increase update-mime-database timeout to 4mins
in the vain hope to get the CI unstuck again.

Change-Id: I1b01bb1d59a8850f68d1d80838f5606f4159bcbd
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2017-03-17 20:08:56 +00:00
Laszlo Agocs
f1a23a5467 Basic Vulkan enablers
For Android, Windows and xcb. Verified on Win10 with NVIDIA, Win10
with AMD, Android with Tegra K1, Android aarch64 with Tegra X1, and
Linux aarch64 with Tegra X1 (Jetson TX1, L4T).

Introduce QPA-based Vulkan library loader, core function resolver, and
instance creation support. In addition to creating a new VkInstance,
adopting an existing one from an external engine is supported as well.

The WSI specifics are hidden in the platform plugins. Vulkan-capable
windows use the new surface type VulkanSurface and are associated with
a QVulkanInstance.

On Windows VULKAN_SDK is picked up automatically so finding vulkan.h
needs no additional manual steps once the LunarG SDK is installed.

[ChangeLog][QtGui] Added support for rendering to QWindow via the Vulkan
graphics API.

Task-number: QTBUG-55981
Change-Id: I50fa92d313fa440e0cc73939c6d7510ca317fbc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-17 16:12:03 +00:00
Jesus Fernandez
346cd79192 Make QFile::open fail when using an invalid file name
Fixes the bug in QFile which allowed opening a file with reserved
characters in its name.  If the name is a long file path, CreateFile
opens a file with a truncated name instead of failing, so we have
to catch reserved characters ourselves.

[ChangeLog][Windows] Fixed a bug that caused QFile to create
files with truncated names if the file name was invalid. Now,
QFile::open correctly fails to create such files.

Task-number: QTBUG-57023
Change-Id: I01d5a7132054cecdfa839d0b8de06460039248a3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-17 11:06:43 +00:00
Marc Mutz
208c71768c QChar: add (char16_t) and (wchar_t) ctors
... for better std C++ integration.

[ChangeLog][QtCore][QChar] Added constructors from char16_t and, on
Windows, wchar_t.

Change-Id: I2d18ea3a37e869b8ea9f4036d7200d9d13c7d929
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-17 01:14:54 +00:00
Allan Sandfeld Jensen
3f0ceb91f8 Add lancelot test to exercise tiled non-ARGB32PM bilinear filtering
No test were hitting the code path for tiled non-ARGB32PM bilinear
filtered scaling. In part because we were only using brushes in pixmap
mode which are always converted to RGB32 or ARGB32PM.

Change-Id: Ib466567f31ce6ee894acdf484d44b3af62dad6fc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-03-16 13:46:17 +00:00
Olivier Goffart
a02959bb5b Make QWindow's windowState a QFlags of the WindowState
This reflects QWidget API, and restores some behavior from Qt4.
Some WM can have several state at the same time. On Plasma for example,
when a window is both maximized and minimized, the "maximized" checkbox
is checked from the taskbar entry.

The API of QPlatformWindow was changed to take a QFlag and the platform
plugins were adapted.

 - On XCB: Always send the full state to the WM. And read the full state.

 - On Windows: The code was originally written with '&' in Qt4, and was changed
   to == when porting. Some adaptation had to be made so the states would be
   preserved.

 - On macOS: Only a single state can be set and is reported back for now,
   with the possibly to expand this in the future.

 - Other platforms: Just do as before with the effective state.

Task-number: QTBUG-57882
Task-number: QTBUG-52616
Task-number: QTBUG-52555
Change-Id: I7a1f7cac64236bbd4c591f796374315639233dad
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
2017-03-16 12:55:19 +00:00
Tor Arne Vestbø
5e18f4ce0b Skip tst_MacNativeEvents::testChildDialogInFrontOfModalParent()
Closing the dialog at the end of the test ends the modal session via
QCocoaEventDispatcherPrivate::endModalSession(), but the actual ending
of the session is deferred to cleanupModalSessions(), and that is never called.

The result is that QCocoaWindow::setVisible of the window in testKeyPressOnToplevel
and following tests ends up calling [m_nsWindow orderFront:nil]; instead of
[m_nsWindow makeKeyAndOrderFront:nil];, leaving the window inactive and the
tests failing.

Task-number: QTBUG-58474
Change-Id: If66b2e201f658b627c2ec50a562938f59a5037ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-03-15 13:51:41 +00:00
Filipe Azevedo
7f1a220ee4 Add support for recursive filtering in QSFPM
You can now use the recursiveFiltering property to recurse into
children to find potential matching children to filter in.

Change-Id: I411a2fb29489fd56b9c881b3e6b8d1860cce630c
Reviewed-by: Stephen Kelly <steveire@gmail.com>
2017-03-14 21:34:37 +00:00
Olivier Goffart
7ac100ddd1 tst_QObject: Test if the new connect style works with multiple inheritance
Change-Id: I638630ef84a3aee98688dac000efd3dfa7472175
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-14 13:55:36 +00:00
Liang Qi
0c034a649f Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/widgets/widgets/qpushbutton.cpp

Change-Id: I615de00e6e64540c50f658d4d8ab3e002d701a81
2017-03-14 10:52:24 +01:00
Shawn Rutledge
35c8a21fe4 QTabletEvent manual test: add quit shortcut
Change-Id: I73012ec2d02856e5bbbc27d269f89b3918dd7c2d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-03-14 09:11:59 +00:00
Shawn Rutledge
68009a7d43 QTabletEvent manual test: show keyboard modifiers
Task-number: QTBUG-59415
Change-Id: Ibb7ebc29797712535d82c6eb02c78dc28ad4131d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-03-14 09:11:54 +00:00
Liang Qi
77e71dac16 Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9 2017-03-13 19:45:20 +00:00
Dan Cape
4f324d4655 Fix item keeping hover highlight even when mouse has left it
Made change to clear the hover index when the mouse leaves the widget.
This will ensure the component does not think the item still has the
mouse over it.

Task-number: QTBUG-46785
Change-Id: I34b7f0e171e9cf07ca23150af1b0e6e59a10a58a
Reviewed-by: David Faure <david.faure@kdab.com>
2017-03-13 15:47:10 +00:00
Liang Qi
d51c3ecf8e Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	examples/network/network.pro
	mkspecs/features/mac/default_post.prf
	src/corelib/io/qfilesystemengine_win.cpp
	src/corelib/io/qprocess.cpp
	src/corelib/io/qprocess.h
	src/corelib/io/qprocess_p.h
	src/corelib/io/qprocess_unix.cpp
	src/corelib/io/qprocess_win.cpp
	src/corelib/thread/qmutex.cpp
	src/platformsupport/fontdatabases/windows/windows.pri
	src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
	tests/auto/corelib/io/io.pro

Change-Id: I8a27e0e141454818bba9c433200a4e84a88d147e
2017-03-13 15:55:44 +01:00
Olivier Goffart
16d1ddfc42 moc: Support signals that return movable-only type
By adding std::move where it makes sense.
This is not only good for move-only types, but for any type which
can be moved as it saves copies of the return value in any case.

[ChangeLog][moc] Move-only types are now supported as return types
of signals and slots.

Change-Id: Idc9453af993e7574a6bddd4a87210eddd3da48a9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-13 11:03:47 +00:00
Olivier Goffart
8c0194f763 moc: put the QPrivateSignal argument in the arg array
Even if it is normaly not used, templated code might still try to access it

Task-number: QTBUG-59414
Change-Id: I9f7aadd714843059c8f89cdac48c60a3e2ca7294
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-13 10:28:42 +00:00
Marc Mutz
75f5e2bef2 Deprecate QString::null
It's a Qt 3 compatibility vehicle, and as such inherits the now-alien
property to distinguish empty and null strings. Particularly worrisome
is the following asymmetry:

   QString("") == QString::null          // false
   QString("") == QString(QString::null) // true

Instead of fixing this behavior, recognize that people might use it as
a weird way to call isNull(), albeit one that once was idiomatic, and
simply deprecate everything that deals with QString::null.

[ChangeLog][QtCore][QString] QString::null is now deprecated. When
used to construct a QString, use QString() instead. When used to
compare to a QString, replace with QString::isNull().

Change-Id: I9f7e84a92522c75666da15f49324c500ae93af42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-03-12 17:41:16 +00:00
Olivier Goffart
b52b509ae4 QLockFile: Don't deadlock if the lock file has a mtime in the future
Stale Lock files in the future can happen in some situations. For exemple
two computers with different clocks access the same file system. It could
be that one of the timestamp is totaly off (several years into the future).

[ChangeLog][QtCore][QLockFile] Fixed a deadlock occurring if a corrupted
lock file's modification time is in the future.

Change-Id: I8dac98a0e898c76bcef67f8c195e126c996b6add
Reviewed-by: David Faure <david.faure@kdab.com>
2017-03-10 17:09:24 +00:00
Marc Mutz
1567a7c0f4 Use new QSemaphoreReleaser in tst_QThreadPool
... replacing a hand-rolled version there.

Change-Id: I0db50acd1ecf591d608eb719021a6fcd06aeb226
Reviewed-by: David Faure <david.faure@kdab.com>
2017-03-09 19:04:33 +00:00
Thiago Macieira
ef26467eb2 Reintroduce a directed QMetaType::typeName array
Commit fb376e0fcc removed an array that
facilitated returning the names of built-in types, to avoid the jump tables
from the switch statement. This commit brings it back but makes the array a
compile-time constant string offset table.

The array is created by way of a set of C++11 constexpr functions, so we
require that compiler feature. I've tested that MSVC 2015 does support
it as well as the ICC 17 when masquerading as MSVC 2015, so I've enabled
for that too. The only compiler left out is MSVC 2013.

If we didn't need to support MSVC 2015, this could have been written
more simply with C++14 relaxed constexpr.

This also adds unit tests to confirm that QMetaType::typeName() does
return null when we said it would. We're testing QMetaType::User-1
(which we'll likely never use) and QMetaType::LastWidgetsType-1 to
select something inside the range of the built-in types.

Task-number: QTBUG-58851
Change-Id: I4139d5f93dcb4b429ae9fffd14a33982891e2ac1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-09 14:56:35 +00:00
Oleg Yadrov
175f33ed85 QMacStyle: update QTabBar style
Task-number: QTBUG-58266
Change-Id: I135e4dae44e2e97d73b7c7c97d8e682bcf459d75
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-03-08 18:39:01 +00:00
Olivier Goffart
5675334b6e moc: Add support for C++17 nested namespaces (N4230)
[ChangeLog][moc] Added Support for C++17 nested namespaces

Change-Id: Ib83fc5bf48f66546fa97b49710582fbf9c984503
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-08 17:34:38 +00:00
Olivier Goffart
11d60dcad6 moc: Fix parsing of digit separator
[ChangeLog][moc] Fixed parsing errors in presence of
C++14 digit separators.

Task-number: QTBUG-59351
Change-Id: Iea38ea7388853d84b819c2beb78a59371f57bf7d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-08 12:34:12 +00:00
Thiago Macieira
3a1f4b186d Stop trying to discover the system timer resolution on Windows
Let's take the beginning of the description: WaitForSingleObjectEx can
be up to 16 milliseconds early. This is proven by the fact that there
are tests doing:

    wait(waitTime);
    QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);

and failing.

Task-number: QTBUG-59337
Change-Id: Iae839f6a131a4f0784bffffd14a9a79523d69d94
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-08 05:52:47 +00:00
Marc Mutz
69415638ae QLatin1String: add iterators
[ChangeLog][QtCore][QLatin1String] Added iterators, {c,}{r,}{begin,end}().

Change-Id: I0222a3ff44f2aa827c737e2fa3cfbb8aad69b5a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-07 16:38:58 +00:00
Andy Shaw
7eb11df19e Don't call releaseKey a second time if the insertion fails
When the insertion into the cache fails then it will delete the entry
for us which already calls releaseKey(). So we should not call it a
second time.

Task-number: QTBUG-58259
Change-Id: I816c6f29ef97fe3a245f145c4faf1e0649f72dc5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-03-07 08:15:54 +00:00
Jake Petroules
b181da9885 Remove workaround for potentially unavailable pasteboard in macOS
This was added in 2006 (when Tiger was the latest version of macOS) in
order to work around an issue where the pasteboard would not be
available when running under a non-graphical session. The latest
supported version of macOS is currently 10.10 on which this is not
expected to be an issue, so this workaround and therefore the Carbon
dependency can be removed.

Change-Id: Id5ed0a7e531dda71ce461c8bbbaebd5d4cadbd0e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-03-07 01:04:46 +00:00
Jake Petroules
c1058cfd7b Remove remaining Carbon includes from QtCore, QtGui and QtWidgets
Carbon is deprecated and we should not rely on it at runtime or compile
time. These headers were only included for a small collection of
keyboard key constants which have now been hardcoded instead.

Change-Id: Ia2eaa267584b63be8019be3bbf64cba897a985a8
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-03-07 01:04:40 +00:00
Jake Petroules
e0e956bfc2 Remove Carbon API usage from tst_qmacnativeevents
These code paths are actually never exercised at all.

Change-Id: I95a5cfa0173e265573c30378ec2e03a2ddf954e4
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-03-07 01:04:35 +00:00
Olivier Goffart
6797570a59 Fix UB in QFutureInterface: invalid casts from ResultStoreBase to ResultStore<>
ResultStore never actually exists, only ResutStoreBase does. So casting to
ResultStore<T> and calling its  member functions is UB. Put the type dependent
function as template member functions within ResultStoreBase and so we don't
need QtPrivate::ResultStore anymore.
Same goes for the iterator.

Change-Id: I739b9d234ba2238977863df77fde3a4471a9abd2
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-06 18:32:28 +00:00
Ulf Hermann
a170c974a5 Fix building of various examples and tools with -no-feature-process
We should not check for platforms, but rather for features. Also, if
dbus is available it doesn't automatically mean that QProcess is.

Change-Id: I27ef5863fcb107cca1aa47abba95b734962adc33
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-06 14:16:13 +00:00
Ulf Hermann
d6330a19b2 Use QT_CONFIG(library) instead of QT_NO_LIBRARY
For the windows file system engine, we add an extra macro to use
library loading if configured to do so, but avoid it on WinRT, as
none of the symbols would be found.

We also QT_REQUIRE_CONFIG(library) in the library headers and
exclude the sources from the build if library loading is disabled.
This, in turn, makes it necessary to clean up some header inclusions.

Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-06 11:27:20 +00:00
Marc Mutz
f31dbeb4c7 tst_QVersionNumber: fix Clang warning about superfluous move
Parameters passed by value, like local function variables, are subject
to NRVO/return-by-move already, so adding std::move, even disguised as
qMove(), makes Clang warn about a pessimizing move.

Change-Id: I7d59bfee4cf7ecddee0874ee489367044c702643
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-06 11:13:17 +00:00
Edward Welbourne
a1c27748d2 Make QLocale consistent about special handling of the C locale
QLocale::matchingLocales() simply created each locale using the basic
data, without (unless the matching conditions stipulated Language C)
applying number-options hacks that it applies everywhere else, when
creating the C locale.  Thus the C locale in its returned list (if it
wasn't the only entry) ended up with the default number options,
without omiting separators in numbers.  Thus QLocale::c() didn't
actually appear as an entry in the list.  Discovered while
investigating QTBUG-58947.

Added a dumb autotest that checks various ways of getting the C locale
do actually give us equal locale objects.  Fixed matchingLocales() to
apply the same hack as is used elsewhere for the C locale.

Change-Id: I263f31da623052b63171f5b5a83c65802383df21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-06 09:51:49 +00:00
Paul Olav Tvete
d5fe06a94e Make uic handle -no-feature-shortcut
Change-Id: I0f8c9fdc8b0fe573443cfc126f21e473544ddcba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-06 09:08:34 +00:00
Oleg Yadrov
f2e103296f QMenu: make wide submenu appear on the same screen with its parent menu
On a multi-display system wide submenu might either appear on wrong
screen or not appear at all (depending on the specific display
configuration).

Task-number: QTBUG-56917
Change-Id: I40013b0bee340a01ae1c08a5e074afa63da4dbfd
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
2017-03-04 05:37:30 +00:00
Oleg Yadrov
ad5565b643 Wide QMenu: fix size and position
This patch fixes 2 issues related to wide menus:
1) Menu took on full screen height when menu width was larger than
screen width;
2) On a multi-display system wide menu might appear on wrong monitor
(not the one where show event was triggered).

The idea is we limit parent menu and all its submenus within the screen
where it was opened.

Note that this patch fixes only geometry-related issues and there are
also some style flaws which need to be addressed (for example, currently
the text does not elide if it doesn’t fit to the menu’s width).

Task-number: QTBUG-56917
Change-Id: I7e9ff4a48bf03060d76e34d33a13ad6cc890c133
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-03-04 00:43:50 +00:00
Joerg Bornemann
80145d556e Increase timeout of tst_QProcess::softExitInSlots even more
Commit eab7efd1 increased the timeout for this test, but apparently 10
seconds are still not enough. Set the timeout to a minute.

Task-number: QTBUG-59075
Change-Id: Iebab8e5c73c4858ca90063a82aedfbb2546a62cc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-03-03 16:26:41 +00:00
Marc Mutz
863debd720 Revert "Add expandingListItems property to QListView"
This reverts commit a4c25c0205.

The API is too limited in scope, and a good name is hard to find, as
evidenced in the API review discussion preceding Qt 5.9 beta.

This API will hopefully return as something like setItemAlignment().

[ChangeLog][QtWidgets][QListView] EDIT: REMOVE: Added expandingListItems property.

Conflicts:
	tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp

Change-Id: I397acd8a7a6c716e2d3c96eee45a276eb6d4f9dd
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
2017-03-03 08:34:19 +00:00
Olivier Goffart
1d9270ee42 Fix DPI of QWidget with parent on a different screen
If a floating QWidget has a parent on a different screen, its DPI was
still inherited from the parent instead of taken from the screen.

The only reason we did was in case there is a customDpi set.
(customDpi is a private thing that is only used in designer to change
the appearance of the previewed widget)

So instead of recursing into QWidget::metric for each ancestor, just
use a for loop to find if one parent has a customDpi. If no customDpi
is found, then return the DPI of the right screen.

Task-number: QTBUG-58959
Task-number: QTBUG-48242
Change-Id: Ie6e9e48cdd10234994c0919ba3aea9b0cdb52494
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-02 16:43:38 +00:00
Olivier Goffart
8387d87bdc QDialogButtonGroup: Fix removal of deleted buttons
As the destroyed() signal is emitted from ~QObject, it is not allowed
to use static_cast to a QAbstractButton on that pointer anymore.
And the qobject_cast will also fail which will keep a dangling pointer
in the hash.

Change-Id: If0d22fcc30cde87e771e70914c3afb04ea207289
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-02 10:42:55 +00:00
Liang Qi
71264bae08 Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I84097f8e7b3b2128028bd7693c913d6968b82bfe
2017-03-02 09:04:38 +01:00
Eirik Aavitsland
c4c8886a86 ppm/pgm image formats: fix reading 16bit and limited range
The color values of ppm and pgm images can be either 8 or 16 bits.
They can also be scaled to a smaller max value, and they can be
expressed either binary or ascii. For some of these permutations, Qt's
image handler lacked implementation or would decode the wrong color
value. This commit fixes that.

Task-number: QTBUG-18262
Task-number: QTBUG-35990
Change-Id: I7cf11c2366244f3a9b31c1a565a81e2658bc6a51
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-02 07:59:50 +00:00
Marc Mutz
5e785c0b83 Add a string API symmetry test for mid/left/right
All good.

Change-Id: Iab278c24b4bd462d5e77af0c4f0fefb155d00551
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-01 13:40:12 +00:00
Thiago Macieira
fe2ab724de tst_utf8: Fix one of the overlong sequences to be what we meant
C0 to DF take one continuation byte; E0 to EF take two.

It's invalid UTF-8 anyway, but at least this is what the test row meant:
overlong sequence with 3 bytes of what should have been two.

This updates the comment to match the character that we were actually
testing.

Change-Id: I85a8bd6da2c44f52b4e3fffd14a75df2600487aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-01 12:27:17 +00:00
Kai Koehne
58cf57492c Widgets: Replace LGPL21 with LGPL license header
Also use canonical contact url.

Change-Id: I59ed3d09d2fee877a577a00e7e1cb09782d26512
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-28 15:34:14 +00:00
Kai Koehne
a64c766a3d Network: Use canonical license headers
Replace outdated LGPL21 with LGPL license header.
Use GPL-EXCEPT for all autotests.
Also use canonical contact url.

Change-Id: I6e5cc8a4285569c4f862730a980f492b8a933a72
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-02-28 15:34:01 +00:00
Liang Qi
1a4f0deeb4 Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I7d84cfed0b2a122d334b8a920e6e4f18472d2f11
2017-02-28 13:03:36 +01:00
Thiago Macieira
04b8db3d57 Fix parsing of day-of-week names that start with another name
Task-number: QTBUG-59159
Change-Id: I95c9e502ccc74af3bcf0fffd14a69e0cd27ce96b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-28 10:40:40 +00:00
Simon Hausmann
4a31eca4ce Make it possible to specify the RCC data version format
After commit d207738245 we unconditionally
write version two, but it seems useful to allow users to specify the
version explicitly.

Change-Id: I81d3de3d7f87318653f89bf10e3618becd8329d6
Task-number: QTBUG-58769
Reviewed-by: hjk <hjk@qt.io>
2017-02-28 08:44:50 +00:00
Marc Mutz
49c558eb0d QSizePolicy: inline toControlTypeFieldValue()
The implementation now uses the relaxed-constexpr
qCountTrailingZeroBits() function from QtAlgorithms, making the
QSizePolicy(Policy, Policy, ControlType) constructor constexpr on
C++14 compilers. The explicit check for DefaultType remains to keep
the constructor C++11-constexpr when called with just (Policy,
Policy).

Extend the constExpr tests a bit.

Change-Id: I59690f0921d9bdee08e3615d0d1f4a9b92870c32
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-02-27 23:09:27 +00:00
Robin Burchell
7a717aaf45 QImageWriter: Detect failure due to trying to write a QImage()
This is not a bug in QImageWriter, but caller code. We should be
explicit about what the problem was so it can be fixed.

[ChangeLog][QtGui][QImageWriter] Add QImageWriter::InvalidImageError to
communicate invalid attempts to write a bad QImage (for instance, a null
QImage).

Change-Id: I0333b8263f1da1c672bed17dab48bfd6cafe41a2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-02-27 18:03:33 +00:00
Edward Welbourne
1631384c27 tst_QWMatrix: use lambdas to duplicate messy code less
The cumbersome complex calls to QMatrix were surely easy to write
thanks to copy-and-paste; but this left the reader to either
laboriously check or guess that all the copies were the same (and
notice that there were two, in fact).  DRY.

Since QMatrix wants qreal data, change the float deg angle to a qreal
and work in qreal throughout.  Passing the angle to a function instead
of repeating it obviates the need for a local variable in the calling
code, to hold its value.

Change-Id: I6bb4adf438a893083ca19f27942502c1e5c518aa
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-27 17:45:28 +00:00
Ulf Hermann
44af54419e Properly use the "process" feature
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.

Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-27 15:44:46 +00:00
Laszlo Agocs
dfc338613e Make QPlatformSurface events work with QWindowContainer
Embeddeding a QWindow via QWidget::createWindowContainer() fails to
deliver the SurfaceAboutToBeDestroyed event. This breaks any OpenGL
or Vulkan based QWindow that releases resources upon this event, and
is particularly critical with Vulkan where the only way to do properly
ordered swapchain - surface cleanup is via this event.

In the non-embedded case close() eventually ends up in an explicit
destroy() in QWindow. In the embedded case destroy() only gets called
from ~QWindow. This then silently breaks since the subclass' reimplemented
event() virtual is not getting called anymore.

To remedy the problem, simply add an explicit destroy() to
QWindowContainer.

Task-number: QTBUG-55166
Change-Id: I1671e8f4d39f6c44e19eca7b9387f55fe3788294
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-02-27 12:38:08 +00:00
Laszlo Agocs
5bb4d06494 Add support for custom texture format in QOpenGLWidget
...in order to support sRGB framebuffers.

Add a --srgb option to the qopenglwidget example to allow testing.

[ChangeLog][QtWidgets][QOpenGLWidget] Added support for specifying
custom internal texture formats in QOpenGLWidget in order to make it
possible to have the widget backed by an sRGB-capable framebuffer.

Task-number: QTBUG-50987
Change-Id: I112e2f0ab0b1478c69e601031aa0bafaa87fa847
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-02-26 20:06:07 +00:00
Liang Qi
de49839df8 Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	mkspecs/features/moc.prf

Change-Id: Ia71c8e3b3185f7c999bf226d0675051b10b8740b
2017-02-24 20:01:42 +01:00
Thiago Macieira
07fffa6010 QDateTime: Fix clearing the ShortData flag in setMSecsSinceEpoch
Unlike setTimeSpec, this forgot to clear the bit when detaching. So it's
possible that some further use of the flags could incorrectly conclude
that the data was short and then proceed to corrupt the pointer.

The example from QTBUG-59061 caused this because toUTC() -> toTimeSpec()
calls setMSecsSinceEpoch which left the bit set; then addDays() calls
setDateTime(), which calls checkValidDateTime() and that corrupted the
pointer. This problem was more visible on 32-bit systems because no
QDateTime was short (except for default constructed ones), but it
can happen on 64-bit with sufficiently large dates.

Task-number: QTBUG-59061
Change-Id: Ibc5c715fda334a75bd2efffd14a562a375a4e69b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-24 16:17:03 +00:00
Timur Pocheptsov
09ca03e1aa QNAM - rename Redirect*s*Nnn to RedirectNnn
As discussed in API code-review.

Change-Id: Ib54cfd43d5bef8c7d99a7fb3b09a9d16dc1dc1dc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-23 20:24:17 +00:00
David Faure
9ffc9e306f QUrl::fromUserInput(with cwd) fix handling of files with trailing spaces
The call to trimmed() makes sense for URLs typed in a browser's location bar,
but its use in every code path made it impossible to open a file with a trailing
space in command-line tools that uses fromUserInput(cwd) to handle command-line
arguments, as recommended. For instance kde-open5 "file.txt " would fail.

Change-Id: Ie61182684521d91f077d3e76f95b7240965ab405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 18:12:35 +00:00
David Faure
8cb9314971 tst_qurl: use temp dir and create our own files for testing
This allows to test specific filenames without polluting the current dir.

Change-Id: Ieb99019a2e37e30f294d85c5d80af1de1b919019
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 18:12:13 +00:00
David Faure
11790f41a7 tst_qurl: replace all QDir::currentPath() calls with local variable
Change-Id: I70e4547ba87292c29dfab59950aa1214be8015a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 18:12:06 +00:00
David Faure
90b48a70ff QTextFormatCollection: replace copy ctor and op= with clear()
operator=, which was only used for clearing, wasn't clearing the hash.
This led to a mismatch between the vector and the hash (given that the hash
points into the vector).

Spotted by interrupting kmail in gdb, and it was in this code
iterating over a 2000 entries hash (the first vector entries not matching
the hash, this code keep appending new entries for the same formats).

This fixes QTBUG-8862 again, the initial fix having been accidentally
reverted in 467b15a.

Change-Id: Ia34b3d002a0199e1930431a4bbdb2ec981ed4ffc
Task-number: QTBUG-8862
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-23 18:11:55 +00:00
Daniel Vrátil
30da659af5 Introduce QMetaType::PointerToGadget flag for pointers to gadgets
A Q_GADGET class can be used both as a value class and a pointer, but
right now QMetaType::IsGadget is only set for value types. This change
introduces PointerToGadget metatype flag which is set for pointers.

This allow for better handling of gadgets in code as well as
disambiguating between value types and pointers to value types.

Change-Id: Id3bd9e18a8eec7ca1cc6b1c25ed03cdc8c0a75a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-23 16:58:47 +00:00
Shawn Rutledge
8fd6cef372 add tst_QWidget::tabletTracking autotest
Ensure that tablet moves are delivered iff tabletTracking is true.

Task-number: QTBUG-26116
Change-Id: Iaa360e181f0c6484cfbde6fa5365f2f0dc77433a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-02-23 10:43:03 +00:00
Marc Mutz
62e15093ff Unexport QTimeZonePrivate
It's only used in the autotests, and it private API, so
downgrade from Q_CORE_EXPORT to Q_AUTOTEST_EXPORT.

Fix a use of QTimeZonePrivate functions unprotected by
QT_BUILD_INTERNAL in tst_qtimezone.cpp.

Change-Id: I70eaea06f8fcf2983aeafb6894c3a5d2a4b272a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 10:42:51 +00:00
Marc Mutz
b952bd3605 QSizePolicy: make (Policy,Policy) ctor constexpr
Unfortunately, that ctor also takes a ControlType argument (defaulted),
and calls the non-constexpr, non-inline function setControlType().

In order to make at least the two-arg version constexpr, I added
a use of the ternary operator to check for type == DefaultType,
making all calls of the ctor that use type == DefaultType
constexpr. For init'ing an aggregate type without ctor in the
ctor-init-list, I needed to require uniform initialization, too.

C++11-style constexpr cannot call void functions, so I needed
to extract the transformation part of setControlType() into a
new function that returns the result instead of storing it directly.

Saves a surprising 2K in QtWidgets text size on GCC 4.9, AMD64 Linux
stripped release builds.

Change-Id: Ib4adf5fd6e54d5345dbfe1c298554278faf13c58
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-02-23 05:44:51 +00:00
Lorenz Haas
2a3297c726 REGEXP for SQLite
Since SQLite does not define a regexp function by default, provide a Qt
based implementation which can be enabled using QSQLITE_ENABLE_REGEXP as
an connect option. This way statements like

SELECT * FROM table WHERE col REGEXP '^[a-d]';

work out of the box.

[ChangeLog][QtSql] Add QSQLITE_ENABLE_REGEXP connect option for
QSQLiteDriver. If set a Qt based regexp() implementation is provided
allowing to use REGEXP in SQL statements.

Task-number: QTBUG-18084
Change-Id: I7f0e926fe4c5d6baea509f75497f46a61ca86679
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Sebastian Sauer <sebastian.sauer@kdab.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-02-22 21:14:23 +00:00
Marc Mutz
494ee2aa8d QThreadPool: supersede cancel() with tryTake()
The cancel() function added in 5b11e43e for Qt 5.5 suffers from a
number of problems:

First, if runnable->autoDelete() is true, then the function suffers
from the ABA problem (see documentation written for trytake()).

Second, if runnable->autoDelete() is false, due to cancel() throwing
away crucial information instead of returning it, the caller cannot
know whether the runnable was canceled (and thus has to be deleted),
wasn't found or is currently executing (and thus mustn't be deleted),
or has finished executing (and can be used to extract the result).

Deprecate this dangerous API and replace it with the much more useful
Private::stealRunnable(), promoted to public API and renamed to
tryTake() for consistency with the rest of Qt.

Described the various caveats in the function's documentation.

[ChangeLog][QtCore][QThreadPool] The cancel() function suffers from
several subtle issues and has been replaced with a new tryTake()
function.

Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-22 16:37:07 +00:00
Ulf Hermann
46730ca610 Make the factoryloader test compile without library support
We define QT_STATICPLUGIN for the plugins in this case, so that they
define the factory functions needed to link them directly into the
test.

Change-Id: I0f2de7bf6bec5a6d53ec9ad92536817c1221b7d5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-22 15:53:13 +00:00
Marc Mutz
dbfde461ed tst_QProgressBar: add a case for INT_MIN/INT_MAX to setValueRepaint()
Convert the function to be data-driven, then add cases for ranges with
limits INT_MIN, INT_MAX and zero to check for overflows in the
painting code. Speed up the function by removing the per-iteration
qWait() call and rely solely on the existing QTRY_VERIFY() to do the
right thing.

Change-Id: I6d2a2c2b7637fca7ddb2a9adc5f6550f8255da14
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-22 13:55:51 +00:00
Marc Mutz
7c647edae9 QTypeInfo: don't treat enums and (extended) integral types as complex
We fully specialize QTypeInfo for most C++ built-in types,
but enums and extended integral types (like GCC's int128_t)
were not covered.

Now that we depend on <type_traits>, we can stop pessimizing
enums and extended integral types in QVector and QVLA by
defaulting QTypeInfo::isComplex to true for such types.

Fix a test that checked that enums were complex types. This should
have been a XFAIL test. Enums are not complex types.

Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-22 09:21:57 +00:00
Oswald Buddenhagen
5e2367aaa5 use regular configure mechanism for openssl library references
don't attempt to hand-craft a library export any more. instead, use the
configure system's built-in mechanism, and refer to it via QMAKE_USE.
this also allows us to rely on transitive dependencies in the autotest.

as a side effect, this makes the openssl-linked feature imply the
openssl one.

Change-Id: I5dd209b63bc8fbbc62852f6ffc472d4452ea2e68
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-22 07:45:59 +00:00
Tor Arne Vestbø
3e5d5852dd windowflags: Update preview info when window state changes
Change-Id: I072939cdff0bd58779d9c163cb23e8176f3bc84a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-20 14:19:47 +00:00
Edward Welbourne
3cdf8debd1 Make sure to use C locale during time tests that assume it
Some format and parse tests for time and date-time depended on locale
but had test data for the C locale (so fail if the test-environment
has, e.g., LANG=de_DE@utf8).  So impose the C locale (until Qt 6).

The date-time test did *some* attempts at fixing for locale, but
failed to handle am/pm; and we do have "### Qt 6" comments in
Q(Date|Time)+::fromString indicating that we intend to switch these
methods to use the C locale by default (which shall fix this once and
for all).  So rip out the incomplete localization now and test we work
properly at least when the locale used *is* C.  Add a comment to the
matching QDate test to rip out its (presently adequate) matching code
once we do get to Qt 6 and make fromString() use the C locale.

QDateTimeParser uses systemLocale(), which is initialized the first
time it gets accessed; so we need to frob the locale *early*; doing so
in the test-class constructor is about as early as we conveniently
can; and seems to work (while doing it in individual tests does not).
(There is no point rolling back at the end; the QSystemLocale global
has been set up by then, so the roll-back would merely leave the
global out of sync with setlocale() and the environment.)

Task-number: QTBUG-58728
Change-Id: Ifa6778a80276050a099387a6dab15a1096be7561
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-20 08:48:46 +00:00
Tor Arne Vestbø
5f80a7956e windowflags: Improve compound states handling
Change-Id: Iab5df40b69cf9c0e11f0e495a6b27af9c05fbd94
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-19 23:36:29 +00:00
Liang Qi
bc4cd465dd Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	qmake/Makefile.unix

Change-Id: Ia18e391198222eef34ffa2df6f683e052058d032
2017-02-17 20:10:34 +01:00
David Faure
6c9b558153 QMimeDatabase: fix matching of filenames with different length when lowercase
AİİA.pdf takes 8 QChars, but after lowercasing it takes 10, so the code cannot
assume the length to be the same.

Task-number: QTBUG-58822
Change-Id: Id6fbb99f6afd08ee420099cd66372732d7598d9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-17 18:52:50 +00:00
Jarkko Koivikko
b07f71a53f Widgets: Update micro focus in QLineEdit and friends
QLineEdit, QAbstractSpinBox and QComboBox did not notify micro focus
changes to the input context.

In particular, the updates were missed during pre-edit stage.

This change adds the missing bindings to QWidget::updateMicroFocus().

Change-Id: I9a7fff962f46dbabd8fb02836c206bace115793b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-02-17 17:09:50 +00:00
Eric Lemanissier
c5e687895d Adapt to the C++ SIC introduced by P0012: noexcept overloading
see 5a1b4832a2 for more detail

Task-number: QTBUG-58142
Change-Id: I51851ea9b4fe7b8eeadc452bc3dbb1ea00026d29
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-17 13:57:30 +00:00
Marc Mutz
0e3d6fe4f6 QVarLengthArray: fix appending an already-contained item
Like the lvalue QVector::append() overload, when we reallocate,
we need to take a copy of the function's argument because the
reference will get stale upon reallocation.

Add a test.

[ChangeLog][QtCore][QVarLengthArray] Fixed a bug involving
appending an item already in the container to the container
again.

Change-Id: I06eeed6cb383dd5924e47a302bb3d1666d04c8e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-17 07:35:31 +00:00
Thiago Macieira
d9a2dd8d3b QDir::mkpath: don't try to mkdir in automount filesystems
Automount filesystems like /home on many operating systems (QNX and
OpenIndiana, at least) don't like if you try to mkdir in them, even if
the file path already exists. OpenIndiana even gives you an ENOSYS
error.

So instead, let's try to mkdir our target, if we fail because of ENOENT,
we try to create the parent, then try again.

Task-number: QTBUG-58390
Change-Id: Ibe5b1b60c6ea47e19612fffd149cce81589b0acd
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-16 21:08:32 +00:00
Liang Qi
c577f6edaf Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/corelib/plugin/qlibrary_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp

Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
2017-02-16 21:51:11 +01:00
Marc Mutz
a5febadac5 QString(Ref): make toLatin1()/toLocal8Bit() null handling consistent
Systematic testing in tst_QStringApiSymmetry revealed a bug in
QStringRef::toLatin1(): a null input did not result in a null output,
but an empty one. This is fixed, for consistency with
QString::toLatin1(), and QString(Ref)::toUtf8(), which behaved
correctly already.

The same bug was found in QString(Ref)::toLocal8Bit(), which is
particularly hideous, as it's documented to fall back to toLatin1(),
which preserves null inputs. Fixed, too.

[ChangeLog][QtCore][QString] toLocal8Bit() now preserves nullness of
the input QString (outputs null QByteArray).

[ChangeLog][QtCore][QStringRef] toLocal8Bit() and toLatin1() now
preserve nullness of the input QStringRef (output null QByteArrays).

Change-Id: I7026211922c287e03d07e89edbad2987aa646e51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-15 20:12:36 +00:00
Timur Pocheptsov
b5995afc79 Fix http2 auto-test
After it started to fail (somehow it's only OpenSUSE 42.1) again and again
and after a quick re-evaluation it appears the logic testing SETTINGS|ACK
is incorrect. We (client side) start by sending the preface and then
continue to send our request(s). The other side (server) starts from sending its
SETTINGS frame. These settings must be ACKed, but apparently it can happen,
that server receives a requests and sends a reply before it receives SETTINGS|ACK,
resulting in replyFinished (replyFinishedWithError) signal and event loop stopping.
As a result - QVERIFY(serverGotSettingsACK) fails.

Task-number: QTBUG-58758
Change-Id: I8184cf459b2b88f70c646171e0115c184237fad1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-15 14:11:19 +00:00
Edward Welbourne
2aec5c9b34 Package transient zone setting in test to ensure restore on fail
tst_QDateTime::operator_insert_extract() was setting the time-zone and
taking care to restore it at the end of the test; however, if the test
were to fail, the restore would be skipped.  Package the zone-setting
and restore in a class instance, so that premature return can't bypass
the restore.

Change-Id: I3df63260da17e481ef4d0d107d9f0fdea3e147e7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-15 13:48:37 +00:00
Marc Mutz
b4689401a5 tst_QThreadPool: don't deadlock when a cancel() test fails
We keep the runnables from finishing by having them block
on a QSemaphore::acquire() call inside run().

If we fail a test that precedes the call to sem.release()
further into the test, the early return will cause the
thread pool to be destroyed, which will then attempt to
wait for the runnables to finished, which, in turn wait
for the semaphore to be released.

-> dead lock

Fix by introducing a RAII object to release the semaphore
with a sufficiently large number to unblock all runnables.
That number will in some situations be too large, but that
does not matter.

Change-Id: I1ec7e29b37bc36309e93e6e30708cc7db3c9579c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 11:25:48 +00:00
Marc Mutz
410a14cc76 Wait for runnables to start up in tst_QThreadPool::cancel()
In order to get reproducible runs of the test, we need to
wait in the main thread until all runnables have started
executing. Otherwise, what the cancel() loop below actually
does will vary from run to run.

Change-Id: Ib912b0943e7bbd55c9480ae6fd4011ba20ac457e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 11:25:39 +00:00
Marc Mutz
8087ea67b1 tst_QThreadPool: simplify cancel()
Instead of allocating a statically-sized array on the heap,
use an automatic C array instead.

Replace some magic numbers with named constants.

Change-Id: I17d29a76a67c4a413453ac26a5dee8cd54a8a37d
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-15 11:25:30 +00:00
Marc Mutz
dcf74bdec8 Fix UB (data race) in tst_QThreadPool::cancel()
Manipulating a simple int from multiple threads is a data race,
thus undefined behavior.

Fix by using QAtomicInt and atomic operations instead.

Change-Id: I5418bc260da57fe353a71b8e5c7c1c97adbe7597
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-15 11:25:24 +00:00
Thiago Macieira
cab4d495b2 50 ms isn't enough for the CI, so increase to 100 ms
This should reduce the failure rate. We're still doing qSleep of the
same amount of time, but we now only fail if the slip is over 100 ms.

Task-number: QTBUG-58713
Change-Id: I536c32a88bff44dab37afffd14a1afdf0b2e522a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-15 08:09:57 +00:00
Timur Pocheptsov
5542e772d6 tst_qlocale::macDefaultLocale - remove flaky/incorrect test
currencySymbol == "$" does not mean negative currency values will be formatted
as "($value)". With all locales I have on my mac machines (10.11/10.12) the
result is different from what this test expects. Also, the results are very
different for different locales.  Apparently, we never saw this problem before
since in our CI "macs" we never have US Dollar/en_US selected in System Preferences.

Task-number: QTBUG-58784
Change-Id: Ic2c3a3172bf1e715e99092ddee8f461b216d995a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-15 07:43:26 +00:00
Marc Mutz
1cbf402ea6 tst_QMimeDatabase: increase timeout
The runUpdateMimeDatabase() call was timing out on the CI due to
running out of the default 30s timeout for QProcess::waitForFinished()
(on my machine, that call takes less than 0.5s, reliably...).

Increase to two minutes.

Change-Id: I61b2e060ea9c2508b853847ba7040ad499e0084c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-14 13:51:12 +00:00
Marc Mutz
6c4d75a485 tst_QSemaphore: avoid deadlock on test failures
When one of the QCOMPAREs in Consumer::run() fails, the consumer
returns early, leaving the producer deadlocked in a QSemaphore's
acquire() call. Change these to tryAcquire() with a large timeout,
so the producer, too, eventually leaves run().

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

Change-Id: I36d5453b8cfb5d34511a9b6196d4dc83d5c9f9f6
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2017-02-14 12:42:20 +00:00
Liang Qi
27432d40f2 Merge remote-tracking branch 'origin/5.8' into 5.9
Change-Id: I2bd2e61bae1eab4fc74fa6accd741ed9ae1f0669
2017-02-14 11:33:02 +01:00
Marc Mutz
10ecbc4041 Blacklist tst_QWaitCondition::wakeOne() on Windows
This test was determined to be flaky on the CI.

Task-number: QTBUG-58741
Change-Id: I43196d3a27f726fb96b427f5071e726b571a0404
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-14 06:51:52 +00:00
Marc Mutz
f0ee4ed0a2 Long live QSemaphoreReleaser!
This is a simple RAII class that makes semaphore releasing
reliable in the face of exceptions and early returns.

This code originates from KDTools' KDSemaphoreReleaser[1], but
has been extensively reworked to support C++11 move semantics.

[1] https://docs.kdab.com/kdtools/2.3.0/class_k_d_semaphore_releaser.html

[ChangeLog][QtCore][QSemaphore] Added a new RAII class, QSemaphoreReleaser,
to reliably perform release() calls.

Change-Id: I6aff64d37cc0882b17c4419817bde60b542f34d9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-14 06:46:03 +00:00
Mikkel Krautz
9c765522d1 qsslsocket_mac: handle 'OrLater' SslProtocols in verifySessionProtocol()
The verifySessionProtocol() method in the SecureTransport backend did not
properly handle TlsV1_0OrLater, TlsV1_1OrLater and TlsV1_2OrLater.

This commit teaches verifySessionProtocol() about them.
It also adds TlsV1_0OrLater, TlsV1_1OrLater and TlsV1_2OrLater to the
protocolServerSide() test in tst_qsslsocket.

Change-Id: I394766c75dbea4d89bf3d6b9c3f3c89530ac0749
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-13 21:44:05 +00:00
Tor Arne Vestbø
09e7a994d1 Don't create platform window for QWindows when calling setVisible(false)
We can defer the creation until the window is shown.

Change-Id: I3d5b45ae59ee0925996cf12cd46dd574c8c6ef95
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-02-13 18:30:06 +00:00
Filipe Azevedo
9db8c171e7 Fix QLibrary::isLibrary on Apple platforms
Add proper support for 'so' and 'bundle' suffixes.  Qt wrongly assumes
.so libraries are not versioned on Apple platforms, which is
wrong. Also, the shared library .bundle which is what Apple recommends
instead of .so, are also versioned (not to be confound with the
different Core Foundation bundles, which are directory hierarchy).

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

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

Task-number: QTBUG-50446
Change-Id: Iacd5136397a12d65d83821434f332eb602550b4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-12 18:25:42 +00:00
Erik Verbruggen
268afd8aef Extend QString equality tests with more long strings
Vectorized versions of ucstrncmp work on larger chunks of text
(typically 8 characters and an optional 4 more in some cases), so there
are now 4 extra sets of tests:
- strings of 1-65 characters, all different
- strings of 1-65 characters, all the same
- strings of 1-65 characters, all the same *except* the last character
- strings of 16 characters long, all the same except one, and that one
  is different for every string (i.e. first string differs in first
  char, second in second char, etc)

This should excercise both 1 or more iterations of the vectorized loop,
the detection logic inside the loop, and off-by-one cases.

The input is all ascii, so the ::compare() test will run them for both
QChar-QChar comparisson and for QChar-latin1 comparisson.

Change-Id: Ifaa7e019c63b581d4af5aef6dcfb3e7456c7d360
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-12 12:51:36 +00:00