Akin to the successful tst_QStringApiSymmetry, add such a test for
generic containers, too. Yes, we have tst_collections, but it's a
cut'n'paste mess that makes it hard to systematically perform
cross-class checks for consistency. This new test, still in its
infancy, uses templates and thus ensures that exactly the same checks
are run on all containers.
Starting out with front()/back(), which the string classes were found
to lack, we will build this test up, as we did and continue to do with
the string API one.
Change-Id: I07323340b5612ecc658232b2776d788018010d0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Currently when doing comparison with pair-like classes the fallback
toString method is called which returns a Q_NULLPTR thus not allowing
proper diagnostic of the values that triggered an error. This patch
adds support for QPair and std::pair to improve the tests output
readability.
[ChangeLog][QtTest][QCOMPARE] Now outputs contents of QPair and
std::pair on failure.
Change-Id: Ib0b4aad7640590d56275b6f1306fb9fb39fa81bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use the new overload directly in QXmlStream*.
Saves 129B in QtCore text size on optimized GCC 6.1 Linux AMD64
builds, even though we added two more functions.
[ChangeLog][QtCore][QString] Added arg(QStringView),
arg(QLatin1String) overloads.
Change-Id: Idf7236dcab763824593f34182e4e0b16b5ed4321
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Nothing changes, we've just given 'QIntegerForSizeof<size_t>::Signed'
a better name in qglobal.h and now use it in QStringView API and
users.
Change-Id: Ibea1ae26e95b3a96708400fd4b0cd120459d57b6
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
With sufficient enable_if magic, the array ctor can overload the
pointer ctor and statically determine the size of the array passed.
Consequently, remove the sizeof in QStringViewLiteral again.
Change-Id: I486baa3cafefde60ccc5f2b47eb94ee53cefe63c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Pretty straightforward, as the implementation already used only
an iterator range internally.
Change-Id: I6e6b809329e2e2548bba6db414a3d107d09637d1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The new overloads do not accept parameters for the invoked function, this
use case is handled by using lambda.
Overloads for non member function pointers and functors are separated as
the return type is not retrieved in the same way.
Move QSlotObjectBase, QSlotObject and QFunctorSlotObject from
qobject_impl.h to qobjectdefs_impl.h in order to make them available in
qobjectdefs.h.
Update autotests of previous overloads because of a soft break in source
compatibility: passing null literals (0, NULL, nullptr, etc.) for the
second parameter of invokeMethod() is not supported anymore.
[ChangeLog][QtCore] Added QMetaObject::invokeMethod() overloads for function
pointers.
Task-number: QTBUG-37253
Change-Id: I6fb67e086d315ae393ce32743c4eb1abd6cc9139
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Starting a detached process with a custom process environment can now be
achieved by:
QProcess p;
p.setProgram("foo");
p.setProcessEnvironment(myEnv);
p.startDetached();
[ChangeLog][QtCore][QProcess] Added the ability to set a custom process
environment for detached processes.
Task-number: QTBUG-2284
Change-Id: I49406dffb64fa2aed41ea05cb271bd42eeabb729
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: If1d2cf175d51b3c02881e21937b0a2d33b78aadd
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Remove most of the std::equal() tests that were used to determine
equality in pre-relational-operator-times again.
Amends a1421e4787.
Change-Id: Iff64808f5ac60861caee899d594b512b58046636
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Two changes are needed to pass tst_Selftest on QEMU
1. Pass QEMU specific env variables to the subtests
2. Ignore output on stderr on some tests when running on QEMU
Change-Id: Ie1f722fd183aac5973e87d408005e06cbafcde17
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
tst_QWidget::updateWhileMinimized has been failing on Ubuntu 14.04
and was already blacklisted there. Now we extend it to cover Ubuntu
16.04.
Task-number: QTBUG-46116
Change-Id: I6758657cca46bb4c76cddb0298f9b87b8a43655b
Reviewed-by: Liang Qi <liang.qi@qt.io>
Mixing different protocols on client-server sockets works differently
on 10.11, making previously successful handshakes failing now.
Failure is specific to 10.11 with SecureTransport.
Change-Id: I35374b40fa3d167802775b526cf6465ae78749cf
Task-number: QTBUG-48860
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
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>
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>
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>
... 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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>