Commit Graph

11385 Commits

Author SHA1 Message Date
Allan Sandfeld Jensen
0792188440 Add float->qfloat16 rounding and fix the tests
Our hardware optimized conversions of float to qfloat16 rounds to even
where our table based conversion truncated to zero.

The rounding is not in this patch exactly round to even like the
hardware implementation but much closer.

Change-Id: I4c5e72c15fef9079d3660680b2727ff7ba4e768a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 16:50:30 +02:00
Linus Jahn
5d69aa3ee1 QCryptographicHash: Add BLAKE2b and BLAKE2s hashing algorithms
BLAKE2 does not specify requirements about specific hash sizes and
since QCryptographicHash does not support dynamic hash sizes, only the
most common hash sizes could be covered by this.

The supported hash sizes were chosen to match the ones supported by the
Linux kernel.

The new hashing algorithms for QCryptographicHash are:
 * BLAKE2b (160 bit, 256 bit, 384 bit, 512 bit)
 * BLAKE2s (128 bit, 160 bit, 224 bit, 256 bit)

[ChangeLog][QtCore][QCryptographicHash] Added BLAKE2b and BLAKE2s
hashing algorithms.

Fixes: QTBUG-78198
Change-Id: Id9e0180a974093982fdf1cdd6180988a2e5e9f4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 15:05:18 +02:00
Laszlo Agocs
c5da2e6f06 Remove old qsb versions from qshader autotest
Only keep 3, 4, and 5 because 3 is the lowest version where binary JSON
is not used anymore.

Change-Id: Id0319e8eceb845017ed493d0ef6902b53050d5a6
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-07-31 12:57:06 +02:00
Fabian Kosmale
cb80720287 Expose QMetaTypeInterface::alignof in QMetaType
We already have the information in the QMetaTypeInterface, and provide
functions to access sizeof. Adding alignof support seems natural, and
should make it easier to handle over-aligned types.
This should also be helpful in QVariant.

Change-Id: I166be76f4b7d2d2e524a3a1e513bd2f361e887c1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 09:46:54 +02:00
Tor Arne Vestbø
47cb6ad698 Don't capture this explicitly in tests
Some compilers implicitly captures, and will warn about the unused capture.

Change-Id: Ib5e1cc3956c7eb0dc87cee834cce8a2b3dd0d30b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 18:34:16 +00:00
Alex Trotsenko
8969070cfd QEventDispatcherWin32: redesign event notifiers activation
The previous implementation multiplexed callback-based event
notification into a single proxy event (cf. 85403d0af), which was
in turn object-waited for (this was the case since the beginning
of public qt history). It makes more sense to multiplex into a
posted message, because that also works with foreign event loops
that do not know anything about our event objects.

Task-number: QTBUG-64443
Change-Id: I97945ac8b5d7c8582701077134c0aef4f3b5a18f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 18:34:34 +03:00
Laszlo Agocs
071fc289c4 Re-enable tst_qrhi on Linux
Not sure why this was disabled in the first place.

Change-Id: I66329b55fd46d03fd96818c6c7004718ddea5c79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-29 15:04:19 +02:00
Tor Arne Vestbø
e7ade60925 Add missing override in tst_QSortFilterProxyModel
Change-Id: I8ffe92cd5a68bf86688e1d942d079ac6ff115d11
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:48 +02:00
Tor Arne Vestbø
b535a67910 Fix warning when comparing qsizetype to size_t
Change-Id: I4ea7ccb4daf05c735c831964f94c120d179521dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 12:33:33 +00:00
Tor Arne Vestbø
9023791a45 Fix warnings about unused expression results in tests
Change-Id: I401ec8a3742a5bb51a1b8b291c53395c3880117c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:29 +02:00
Tor Arne Vestbø
6f17509ad9 Fix warnings about unused members in tests
Change-Id: I741cf08c26f8a2e297926cc01968ff09e70462a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:24 +02:00
Tor Arne Vestbø
dfeedc17a2 Disable deprecation warnings in some tests
The tests are testing deprecated functionality, which we
still want to test.

Change-Id: Iad6ed35800896170c17fe019c7a6ecda22398ac3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:23 +02:00
Tor Arne Vestbø
57337f21c7 Add missing braces when constructing BigConvertible in tst_qvariant
Change-Id: Ia571e8950aa28721080dc7434921b79ffda913f4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:20 +02:00
Tor Arne Vestbø
f8d1e16da0 Add missing enumeration case in tst_QMacStyle::setSize
Change-Id: Iade36b03c6f8bdaa8feb82ef89744a399f92e21d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:19 +02:00
Allan Sandfeld Jensen
d782df4861 Make qfloat16 helper functions consistent with float/double versions
Infinite is only when the mantissa is 0, everything else is NaN.

std::isnormal returns false on zero.

Pick-to: 5.15
Change-Id: I897fc0dc3b8a9c557bb1922ea7ca8df501e91859
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 18:12:07 +02:00
Friedemann Kleint
2405aa9d67 Windows QPA: Move mime-type related classes to the new interface
Move QWindowsMime (which was a public class in Qt 4 and moved to the QPA
plugin in Qt 5) to the platform namespace and add register functions to the
native application.

Move in test code from QtWinExtras.

Task-number: QTBUG-83252
Change-Id: Iaac440e2d5cb370110919921b1eeb779600b5b65
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-28 13:20:23 +02:00
Timur Pocheptsov
1482739002 QHostAddress: resolve API issues marked with ##Qt6
Also, remove the deprecated function and its auto-test.

Change-Id: If04a54c4b91e0f76523960c7b1a5bcb8fe883ac6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 12:38:15 +02:00
Peng Wenhao
59e3073b1c Close memory leak in QTestLib support for string to numeric testing
QTest::toString allocates memory by calling qstrdup; that memory must
be freed by the caller.

Change-Id: I9724db0c617884cf08592968b1411f002ef23204
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 13:36:31 +08:00
Edward Welbourne
f4323889f1 QLine: purge deprecated API
Since 5.14: intersect(), angle().  Also removed definition of M_2PI
from test, since its last use was in the tests being removed.

Change-Id: Ie3a12247e3760e8bfdd3a659cd06245c86b198c2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-07-27 11:26:08 +02:00
Edward Welbourne
d3c8757731 Purge redundant recoding of URL fragments from QByteArray
QUrl::fromEncodedComponent_helper() only existed to support some old
methods deprecated since 5.0, that I recently removed.
It was the only caller of qt_urlRecodeByteArray() aside from that
function's own autotest.
Both were private.

Task-number: QTBUG-85700
Change-Id: I5d09fd44e768847ce51a1ae7043150922cb5314c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-27 11:25:49 +02:00
Edward Welbourne
f144507829 Clean up manual network stress-test
Don't attempt the remote test if we don't have a remote server.
Don't add error returns from read to byteCounter.
Don't cast from ASCII to QString in URL components.
Don't waste time encoding a path for which it's a no-op
(especially as I recently deleted the method used to do it).

Name the time-out, both for clarity and to give anyone who needs to
debug the test only one line to edit so as to increase the time-out
enough to make debugging practical.

Change-Id: I378aa96c0501f7033ca4abb82734b03b8c807f08
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-27 11:25:11 +02:00
Edward Welbourne
02c2c930f0 Fix some compiler errors caused by bit-rot in manual tests
Two methods that have gone away or been renamed,
an enum that now doesn't support being assigned from int.
QTime should no longer be used as a timer.
Removed a test of deprecated code that's gone away.

Task-number: QTBUG-85700
Change-Id: Idc6d59542625d22b9937084411b54b0d8aa87f00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-27 11:20:35 +02:00
Edward Welbourne
2059170b33 Fix misplaced nullptr, used for a flag value
Task-number: QTBUG-85700
Change-Id: I34b1aa8430842d96eb515d709b49de4e60976ac9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-07-27 11:20:14 +02:00
Tor Arne Vestbø
9a8fe34e4d tst_qicon: Enable lowdpi test using qt_add_test argument
Change-Id: I98f850c668a45d127abb1c2af5915f2cbcbd1cdb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-26 20:12:47 +02:00
Tor Arne Vestbø
bd3088ceb3 Fix warnings about unused variables and functions in tests
Change-Id: Ia758a91384083c13fb4d743f500fef7a6629dfd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 18:06:46 +02:00
Tor Arne Vestbø
f418a96f9b Disable warning about self-move and self-assign-overload
Change-Id: I1d20d3f424eced5cc5787934663b9d243f75d46e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 18:06:34 +02:00
Tor Arne Vestbø
d1fd2ff11f Fix warning when comparing qsizetype to result of sizeof
warning: comparison of integers of different signs: 'qsizetype' (aka 'long long') and 'unsigned long'

Change-Id: I03acb1f7aed782169a0a42cd8afc84b85991cd1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 18:06:21 +02:00
Tor Arne Vestbø
d96193b0ec Fix warning when printing of qsizetype
warning: format specifies type 'int' but the argument has type 'qsizetype' (aka 'long long')

Change-Id: I6099b53efecea46d191d5dc019c986f99e49c1f1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 17:39:31 +02:00
Friedemann Kleint
f06dfb60b9 QtGui: Add Windows conversion functions for to QImage
Add conversions from/to HBITMAP, HICON to QImage. Split the pixmap
conversion functions apart to use them.

Task-number: QTBUG-81876
Change-Id: Ic0c41a402a1f6e9bec572fc4d691357bd48e6423
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-24 22:51:46 +02:00
Volker Hilsheimer
c692f41ae5 Mark QIcon test as not supporting high-DPI pixmaps
As of 951d490750, high-DPI support
for pixmaps is enabled by default, which makes this test fail
when running on a local system with a high-DPI display.

Change-Id: I3fe4674d19a57bf82aa32b01d470c714092f7e62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-24 13:54:00 +02:00
Allan Sandfeld Jensen
c562c1fc19 Fix buffer overflow in XBM parser
Avoid parsing over the buffer limit, or interpreting non-hex
as hex.

This still leaves parsing of lines longer than 300 chars
unreliable

Change-Id: I1c57a7e530c4380f6f9040b2ec729ccd7dc7a5fb
Pick-to: 5.15 5.12
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-07-24 10:06:57 +02:00
Tor Arne Vestbø
af7a3430ed testlib: Add start time and test duration to JUnit XML
As defined by https://llg.cubic.org/docs/junit/

Change-Id: Ic7683f3d49c529674f8467d591528d4a65d3add8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-24 00:52:01 +02:00
Tor Arne Vestbø
67c877562b testlib: Output JUnitXML attributes in right order
The attributes are, like the elements, maintained in reverse
order in the underlying QTestCoreList, so we need to iterate
them backwards when printing out the resulting XML to reflect
the order they were added.

This results in e.g.:

  <testcase name="passingBenchmark" result="pass">

Instead of:

  <testcase result="pass" name="passingBenchmark">

Change-Id: Ic2eeab8de05ffedd0c41977358d5b40ff77878b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-24 00:51:54 +02:00
Tor Arne Vestbø
a4be2bd723 testlib selftest: Actually report failures as non-zero exit code
Palm, meet face.

Change-Id: I01cd4088c8f43f7fe66398c27f5d8333468620ad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-23 14:27:15 +02:00
Tor Arne Vestbø
e85c531c51 testlib selftest: Don't pass TESTARGS to Catch2
It doesn't understand the arguments we usually pass to testlib.

Change-Id: Iea83d1d8c31a510b2bc442cbfc810eac631322e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-23 11:08:15 +02:00
Edward Welbourne
f16ab166bc QLogging: purge deprecated qInstallMsgHandler(QtMsgHandler)
Deprecated since 5.0.  Renamed a function in a manual test that no
longer needs to say it's Qt5-specific.

Change-Id: I6f2159c702f389d378a0e4d86bd4fe633298b100
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-07-23 11:05:53 +02:00
Tor Arne Vestbø
cd16858823 tst_QGraphicsSceneIndex::clear: Don't assume only one repaint
Change-Id: I037b51ebad525ced536945b2c39b0f59280e6bad
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-23 10:04:01 +02:00
Tor Arne Vestbø
81d83d5672 testlib selftest: include 'keyboard' test in generate_expected_output.py
Change-Id: Ia1d759454b2931ca838942cf9b08f8b62dfd61ce
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:27 +02:00
Tor Arne Vestbø
e5761061f2 testlib selftest: Only warn about missing test expectation if none was found
Change-Id: I55e19d0a7b9b58ceeee4f25612f4a1d9ec66eb76
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:24 +02:00
Tor Arne Vestbø
e7371c19d9 testlib: Defer signal dumper start until tests are ready to run
We don't want the signal dumper to pick up signals that our own
test machinery produces, such as the ones emitted from the watchdog
thread startup and shutdown. This would otherwise produce:

 tst_Signaldumper::initTestCase() Signal: QThread(7fc969e0d870) started ()

At startup, and at shutdown even more confusingly:

 tst_Signaldumper::UnknownTestFunc() Signal: QThread(7fc969e0d870) finished ()

Change-Id: I9e81fa168eaa92551d38d5576973bbf95ac23364
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-22 23:23:16 +02:00
Tor Arne Vestbø
304ec18a1a testlib selftest: rebaseline benchlibcallgrind results
The logic was changed in eb52d78e90 to only produce a single
result for all the benchmark iterations, but only the plain text
output was rebaselined. This was not caught by the test since we
only run this test with the plain test logger. Regenerating the
results with the python script however runs it with all loggers,
so let's fix the baseline.

Change-Id: I9ebe8a59ac3ab36694a739f98dbfffbae9a08552
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-22 23:23:12 +02:00
Tor Arne Vestbø
61b1146e5a testlib selftest: check blacklisted test for test failures
Change-Id: Ifcd1155f7627f6a9f8b379fb9e87425f9d9f2877
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:09 +02:00
Tor Arne Vestbø
b33c056a61 testlib selftest: unify xml quoted asserts that include line numbers
Change-Id: If66303bab10c23dd212a6abcdff3f145630e2401
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:05 +02:00
Tor Arne Vestbø
f1c16139e3 testlib selftest: rebaseline tap results to not include line numbers
Change-Id: I6271ac1984a3829ba1c8dcc9d6419940cb89c62b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:01 +02:00
Friedemann Kleint
32a26f1714 Manual touch test: Add a settings dialog for windows
Exercise the touch settings of the native interface.

Task-number: QTBUG-41433
Task-number: QTBUG-48849
Task-number: QTBUG-83252
Change-Id: I5ae95a79c00b55236dbbed9d8549f4fdf5b10b8e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-22 19:46:09 +02:00
Friedemann Kleint
a54639acd2 Fix the touch manual test to compile
Task-number: QTBUG-72167
Change-Id: I9074fc21ae8fccf66140fb38bfbd35e526506c36
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-22 12:20:16 +02:00
Richard Moe Gustavsen
76d9d86907 qnsview: don't active QWindows inside NSWindows that are not key
A QWindow should only become Active when it's inside an
NSWindow that is Key. If the NSWindow is not key, we need
to wait for it to be so, and handle window activation
from QCocoaWindow::windowDidBecomeKey() instead. Otherwise
Qt will report a QWindow as Active when, in reality, it
is not.

Change-Id: Ib7e63b374f26af527a668c7f7d863c4168a4446d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-22 09:08:32 +02:00
Tor Arne Vestbø
15a5d1996f tst_QPluginLoader: Fix MachO stub tests
The -arch_blank argument to lipo is no longer supported.

Pick-to: 5.15
Pick-to: 5.12
Change-Id: I47efcb3633f23b7a18d66211bc16d5c9dbc067c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-22 02:04:15 +02:00
Friedemann Kleint
d25589e052 QTestlib: Enable comparing QList against initializer lists/arrays
It is unnecessary to create a QList container just for comparison.

Split out helpers for comparing sequence sizes and sequences from
qCompare(QList) and add a template for an array with a non-type template
parameter for the size.

One can then write something like:

const int expected[] = {10, 12,...};
QCOMPARE(QFontDatabase.pointSizes(...), expected)

Unfortunately, any commas in such an array will be misread by macro expansion
as macro argument separators, so any expected array with more than one entry
needs an extra macro expanding __VA_ARGS__.

Change-Id: Ie7c8dc20bf669bbb25f6d7f8562455f8d03968c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-21 22:01:20 +02:00
Edward Welbourne
e4e4bb78b7 tst_QLine: use qmath.h's constants instead of local versions
Change-Id: I41313f7e7caf3c364ae900a0b100c661aafb290d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-07-21 17:05:01 +02:00