Commit Graph

11981 Commits

Author SHA1 Message Date
Marc Mutz
3f8896d77e QSet: add missing insert-with-hint
Since QHash is missing the overload, too, just ignore the hint for
now, but provide the STL-compatible signature so generic code can use
QSet as a normal sequential container.

[ChangeLog][QtCore][QSet] Added insert() overload taking an insertion
hint, for STL compatibility.

Change-Id: I9fe41877343ebff721b650fb7b9cd4e06b6608d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-11-25 22:08:09 +01:00
Volker Hilsheimer
cd2f29891f Fix compiler warning from deprecated function
Make the string into a list and call setFontFamilies.

Pick-to: 6.0
Change-Id: I1b70db784fd6e495b48917141d07bacd1e883882
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-11-25 22:08:09 +01:00
Giuseppe D'Angelo
bfe77a21fb QVLA: do not include QtTest
The right include is QTest, QtTest drags in all of QtCore.

Change-Id: Icc2964ccdb85fe1bfc9fe8f43351a4605a34329b
Pick-to: 6.0 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-25 03:48:09 +01:00
Alexey Edelev
2548438e32 CMake: Change generated resources naming
Align generated resources .qrc file naming to qmake naming.
Update tests.

Fixes: QTBUG-88581
Pick-to: 6.0
Change-Id: Id8a2f91f23c257e5b8bd371748c2151ec54a6418
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-24 21:51:29 +01:00
Andreas Buhr
824de3850e Fix tst_qfiledialog2 in case directory ~/foo exists
One test in tst_qfiledialog2 only succeeded if the directory "~/foo"
did not exist. This patch changes the path used to "~/Vugiu1co"
which has hopefully a much lower probability of existing.
The string "Vugiu1co" is taken from a call to "pwgen".

Pick-to: 6.0
Change-Id: Ia82b07902a91eb908a74aa90cdbdf4761d432d9a
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-11-24 21:50:55 +01:00
Andreas Buhr
1dff26dd95 Fix tst_qlibrary after rebuild
tst_qlibrary depends on a library (targets mylib and mylib2) to be
built. They create a library with the same name, in two versions.
This is done in order to test versioned library loading.
However, those two libraries were fighting over the creation of
"libmylib.so". In a fresh build, mylib2 wins, as intended. But after
a rebuild, mylib won, which led to failing unit tests.
This patch changes the situation. With this change, mylib no longer
tries to create "libmylib.so". Thus no fighting and no problem.

Pick-to: 6.0
Change-Id: Id89baa5503c9f078a8737ff0b8616edf09044f72
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-11-24 21:50:46 +01:00
Alexandru Croitor
47435572fb Blacklist authenticationCacheAfterCancel on Ubuntu 20.04
It flaky fails integrations.

Amends 2b49b01aa3

Task-number: QTBUG-88417
Change-Id: I6aad6ee7a70e580da64e75f69e8c9cab1cb78cd7
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 143d619ba33c693fbbf9fbc3587921a44ae87435)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-24 20:50:42 +00:00
Andy Shaw
8302ca22f4 Return a QString() if the families list is empty
Fixes: QTBUG-88781
Change-Id: Iafed2be29e2e0c3029e832986ba58d19446214eb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-11-24 21:49:54 +01:00
Andreas Buhr
764fbb1c01 Skip QSystemTrayIcon unit test for offscreen platform
When we are using the offscreen plugin, there might or might not
be a working system tray icon. This patch disables the unit test in
that case as we do not know what to expect.

Change-Id: I34fded516300cc9aab1eb67644dcef8631ecfdf1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-11-24 18:54:45 +01:00
Ivan Solovev
d8579826ed QMessageAuthenticationCode: extend tests
- Add test for static hash() method
- Add tests for addData() overloads
- Add input data for sha384 and sha512

Task-number: QTBUG-88183
Change-Id: I7e16419b3a582468fd1de15613e1157af428bc4c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-11-24 18:54:44 +01:00
Andreas Buhr
f9d172f5a1 Fix tst_qlibrary by telling CMake about required libraries
tst_qlibraries needs to test libraries to be built in order to run
successfully. However, these libraries were not mentioned as
dependencies in CMake.
This patch fixes that.

Fixes: QTBUG-88445
Pick-to: 6.0
Change-Id: Ic335e46664edd98217bd55a9bca5a58a39cffe66
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-23 21:11:42 +01:00
Timur Pocheptsov
95cbce3e6e QPasswordDigestor - improve code coverage
By extending (a bit) an auto-test to cover paths found by LCOV. All of them
is just to trigger the code that checks input parameters.

Pick-to: 5.15
Pick-to: 6.0
Change-Id: I62f9a9045038ff8d123fd1396f4bfd85e75c6d8f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-23 18:38:53 +01:00
Timur Pocheptsov
1157167a5c QSslConfiguration - improve code coverage
By adding auto-tests that were missing/not triggering the paths found
by LCOV.

Pick-to: 5.15
Pick-to: 6.0
Change-Id: I472f59e8e7292786c80d7c8dcebde53a2982e1ec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-23 18:38:53 +01:00
Volker Hilsheimer
e59ab8b590 Fix compiler warning about discarded return value
Not testing the result of the copying, just verifying that it doesn't
assert.

Pick-to: 6.0
Change-Id: Ib51129134b74c17eada7e3819ccfff10bb9affbf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-11-23 12:51:41 +01:00
Fabian Kosmale
5806ecf5cb QMetaType: Track whether type is QML list type
This information is required in the QML engine to handle list properties
(instances of QQmlListproperty<T> and list<T> types from QML).

Pick-to: 6.0.0 6.0
Change-Id: I1e30572f1c91f58b290cb9b4b07433af99a1db6f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-11-23 09:57:00 +01:00
Ivan Solovev
54875be84d Add convenience functions for QFuture creation
[ChangeLog][QtCore][QFuture] Add convenience functions to create
a ready QFuture and a QFuture with an exception

Task-number: QTBUG-86713
Change-Id: Ic7f9ca590a8ea8a9696b84f35bad074780794461
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-11-23 09:50:21 +01:00
Allan Sandfeld Jensen
f61f8bb966 Replace qt_make_unique with std::make_unique
We can depend on C++14 now.

Change-Id: Iee9796cd22dbfbb70d4bdb25f0eee1662a026d6d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-23 09:50:21 +01:00
Alex Trotsenko
ed8b8ffde4 tst_QProcess: fix compilation on Windows
Suppress warning:

..\tst_qprocess.cpp:272:13: warning: 'void childProcessModifier(int)'
    defined but not used ...

Change-Id: Idf601df78be256cfbee0ca80252d1c364c712c8e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-11-22 23:14:25 +02:00
Giuseppe D'Angelo
8ae9431c79 QMargins(F): add support for structured binding
[ChangeLog][QtCore][QMargins] QMargins is usable in a structured
binding.

[ChangeLog][QtCore][QMarginsF] QMarginsF is usable in a structured
binding.

Change-Id: I0c501847b9377c47bd0e63da3735792075bd0079
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-22 02:22:20 +01:00
Andreas Buhr
ae2c309420 Add unit test for QAnyStringView::compare
Coverage tests revealed that
QAnyStringView::compare(QAnyStringView, QAnyStringView, CaseSensitivity)
was not tested in our unit tests. This patch adds a test for this.

Pick-to: 6.0
Change-Id: Id8e0d8af87e7e7ab192fb7554a278ddbb890fb14
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-21 06:11:55 +01:00
Andreas Buhr
146a2a21b1 Fit tst_qprinterinfo in case there are printers in local network
tst_qprinterinfo compared the output of "lpstat -p" with the
result of a call to "cupsGetDests". "lpstat -p" only returns local
printers, "cupsGetDests" also returns printers on the local network.
This patch fixes the test by using "lpstat -e", which also
shows printers on the local network.

Pick-to: 6.0
Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-11-21 06:11:37 +01:00
Eskil Abrahamsen Blomfeldt
1d14067680 Fix weight when reading old serialized QFonts
The QFont::fromString() needs to differ between strings
produced before and after Qt 6.0 when interpreting the
weight value, since in older strings this will be the legacy
scale.

Luckily the number of tokens in the string can be used for this
purpose, since many tokens were added in Qt 6.0.

This broke KDE, where font settings are stored in QSettings
and serialized using QFont::toString() from Qt 5.

Fixes: QTBUG-88589
Pick-to: 6.0.0 6.0
Change-Id: I199737fed61917f8b9d8f86176ead29a89eb8e0c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-11-20 20:29:00 +00:00
Assam Boudjelthia
4713298b98 Android: exclude qarraydata::dataPointerAllocate() from CI tests
Task-number: QTBUG-88705
Task-number: QTBUG-87025
Pick-to: 6.0
Change-Id: If2dc0e650e5104d00a097e6195dd117d6cfd64e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 21:38:02 +02:00
Ivan Solovev
1a0ae4e32d Extend tests for QMargins
- Add check for QT_NO_DATASTREAM macro
- Add tests for QDebug operator<<

Task-number: QTBUG-88183
Change-Id: I346777a3237986f7f950f157e50cae846b077e11
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-11-20 15:02:11 +01:00
Giuseppe D'Angelo
fb6b7869e8 QPoint(F): add support for structured binding
QPoint(F) are "naturally" destructurable in their x/y
counterparts (hello Mac/Carbon users, we don't live in 1999
any more, it's x and then y, and not vice versa...).

[ChangeLog][QtCore][QPoint] QPoint is usable in a structured
binding.

[ChangeLog][QtCore][QPointF] QPointF is usable in a structured
binding.

Change-Id: I8718a4e80be4ce03f37f012034f1fba009304b32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 16:01:14 +02:00
Timur Pocheptsov
1d7189f5b3 tst_qocsp: improve code coverage
By simply extending the basic test to trigger qHash, isEqual and
a bunch of getters.

Pick-to: 6.0
Pick-to: 5.15
Change-Id: Ib1d88fc6d2ad623743cea77ac286ae6ac819dfd1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-11-20 14:46:33 +01:00
Andreas Buhr
b02147788b Add unit test for YearMonthDate
Coverage analysis showed that QCalendar::YearMonthDate was not
rigorously tested. This patch adds a unit test.

Pick-to: 6.0
Change-Id: I0af485d13c4883764b61ea1e35455905cc77b966
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-11-20 14:43:33 +01:00
Andreas Buhr
7b0fd20775 Add unit test for QString::insert(negativeint, QChar)
QString::insert(qsizetype, QChar) can insert at negative positions,
then counting from the end of the string. Coverage analysis revealed we
do not have a unit test for this. This patch adds a unit test.

Pick-to: 6.0
Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-11-20 14:42:49 +01:00
Andreas Buhr
756c4faccb Add unit test reproducing integer overflow in QDateTime::fromString
Task-number: QTBUG-88656
Change-Id: I05b9ad1dfa9b3f02480d8e99a523371342bdba9b
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2020-11-20 14:42:32 +01:00
Timur Pocheptsov
1a2e2921d2 QSslCipher - improve its code coverage and auto-tests
tst_qsslcipher was quite useless - now we test that default constructed
QSslCipher reports expected values. Test the non-default from the
different auto-test,  where we are sure we have really useful
ciphersuites (with different parameters obtained from a TLS backend,
where it's possible).

Pick-to: 6.0
Pick-to: 5.15
Change-Id: Iff14a0580fed889cf9e0873bee01d968773626db
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-11-20 14:38:59 +01:00
Giuseppe D'Angelo
37808ee55a Remove QScopedSharedPointer
It's private and unused since ~2012.

Change-Id: Iea11af27f7eebf3eae2467b22b68cd4c26885edd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 14:34:14 +01:00
Timur Pocheptsov
4111d8e8e7 tst_QTcpSocket::connectToHostError - handle possible timeouts
... instead of failing the test. On Ubuntu 20.04 when calling
'connect' with 0.0.0.1 we get EINPROGRESS and nothing else,
since our own internal timer has 30 s. timeout, the event loop
in the test stops before this and no socket error detected yet.
Handle such situation without failing a test.

Fixes: QTBUG-88042
Change-Id: Id6add27fcf9bbbe5fbf83a193652edf08fbad8d6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-20 14:34:04 +01:00
Sona Kurazyan
289f909621 Test conversion of ulonglong variant to JSON
Make sure ulonglong variant converts to a double JSON value when the
value is greater than 2^63.

Change-Id: I4d4392b05de29c220624056d5d0d4664fb2c08b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 14:31:49 +01:00
Andy Shaw
d8602ce58b QFont: Prefer setFamilies() over setFamily()
By depending on setFamilies() then we can be sure that font names with
spaces, commas, quotes and so on are correctly handled without being
misinterpreted. For now it will split on the comma when a string
containing one is passed to setFamily. But from Qt 6.2 this will be
removed to preserve the family string as a convenience function.

[ChangeLog][QtGui][QFont] Indicated that setFamilies/families is
preferred over setFamily/family to ensure that font family names are
preserved when spaces, commas and so on are used in the name.

Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-11-20 14:30:22 +01:00
Kai Koehne
ce29ce586f Revert "Allow QWindowsPipe{Reader,Writer} to work with foreign event loops"
This reverts commit ee122077b0.

Reason for revert: This causes QProcess::readAll() to sometimes
return nothing after the process has ended.

Fixes: QTBUG-88624
Change-Id: I34fa27ae7fb38cc7c3a1e8eb2fdae2a5775584c2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 23100ee61e33680d20f934dcbc96b57e8da29bf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-20 13:28:31 +00:00
Shawn Rutledge
5509449daf Add tst_QHighDpi::mouseVelocity()
Ensure the values are reasonable regardless of screen DPI.  Velocity
is supposed to be in logical pixels / second.

Task-number: QTBUG-88252
Task-number: QTBUG-88346
Change-Id: Ic209887f8ed0381c033a9ff04ae48b072c444df4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-11-20 10:45:11 +01:00
Andreas Buhr
06f58a909b Add unit test for QString::replace with out-of-bounds position
QString::replace(pos, len, *unicode, size) can handle positions
which are outside of the this-string. In that case, it is a no-op.
Coverage analysis revealed we do not have a unit test for this.
This patch adds one.

Change-Id: Id4a407e860fff0d5c7c0a200c379e5e3961c86d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-19 23:56:15 +01:00
Andreas Buhr
ebaae45ea1 Fix logic error in QString::replace(ch, after, cs)
Coverage analysis showed that an if-branch marked "Q_LIKELY" was never
taken. It turns out the code was incorrect, but behaved correctly.
This patch fixes the logic and adds a unit test.

Pick-to: 5.15
Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-19 20:28:27 +01:00
Edward Welbourne
28e4a8421c Fuzzing: Add a test for QDateTime::fromString
This patch adds a basic fuzzing test for
QDateTime::fromString.

Task-number: QTBUG-87104
Pick-to: 5.15
Change-Id: Icc51386f06f6d4d2a4495734f7fa45de80c6e065
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2020-11-19 12:28:45 +01:00
Lars Knoll
b4c1747612 Make QMetaTypeInterface constexpr on Windows
This was so far problematic as it gave various link errors. The solution
to that seems to be to make the default constructor of QPairVariantInterfaceImpl
constexpr to get around one set of problems.

The other problem to solve where undefined references to metaobjects. The
reason for that is apparently that QMetaTypeInterface contains a direct
pointer to the meta object, something the linker doesn't like. Adding a
level of indirection by using a function that returns the pointer seems
to solve that problem.

Fixes: QTBUG-88468
Change-Id: I5612ae807ea3b7e49bc40349d8d1fca1be9bd7ee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-11-19 12:28:45 +01:00
Andreas Buhr
98666c8afc Change QString formatting of negative numbers in non-base-10
For bases other than 10, negative numbers have been converted
to QString by casting them to an unsigned number and
converting that. Thus QString::number(-17, 16) returned
"0xffffffffffffffef", for example.
This patch changes the behavior so that
negative numbers are converted like positive numbers.
Additinally, this patch adds unit tests for QString::number.

[ChangeLog][Important Behavior Changes]
Changed QString::number(integer, base) for negative numbers
and bases other than 10 to return the string corresponding
to the absolute value, prefixed by "-".

Fixes: QTBUG-53706
Change-Id: I0ad3ca3f035d553860b262f5bec17dc81714d8ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-19 11:28:44 +00:00
Wang ChunLin
8455bfee76 Fix QSFPM not emitting dataChanged when source model is set
QSortFilterProxyModel did not emit dataChanged when calling
setSourceModel() after modifying the source model.
QSortFilterProxyModel::setSourceModel and
QSortFilterProxyModelPrivate::_q_sourceReset(), _q_clearMapping
is called to delete the source_index_mapping. They also need to
call create_mapping function to re-create it.

Fixes: QTBUG-87781
Pick-to: 5.15
Change-Id: Idbe34696c9d3a2fbf354b653c870bac61378811d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-18 20:57:48 +01:00
Allan Sandfeld Jensen
34304e3100 Get rid of Q_COMPILER_CONSTEXPR checks
Is required now.

Change-Id: I62e95929d1649ea1390392230b619bd56d2a0349
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-17 21:28:11 +01:00
Alex Trotsenko
1e9dc3ec2f CMake: fix QLocalSocket benchmark to use new qt_internal_ API
Amends ee122077b.

Change-Id: I9b750eb88ac9c83da26da4e5921cb147716c5eb6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-11-17 21:34:04 +02:00
Timur Pocheptsov
4f6c5d83d0 Network self-test: make it work with docker/containers
Fixes: QTBUG-87740
Pick-to: 5.15
Change-Id: Idfe73708784774188afd40048f81406aa720a554
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-17 19:56:06 +01:00
Edward Welbourne
26e41291bb Test QTimer's isSingleShot() and timerType()
Previously neglected in testing.

Task-number: QTBUG-88183
Change-Id: Iacfca6f8c590af6dccb126cf3e43387ed50dbf06
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-17 19:55:05 +01:00
Edward Welbourne
06c898d7a9 Add some tests for various qmath.h functions
Previously untested.

Task-number: QTBUG-88183
Change-Id: I9e94308471651e447f35a21329e43a363fb23961
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-17 19:55:04 +01:00
Edward Welbourne
c0829d6131 Improve qFloatDistance() test coverage
Four code-paths that weren't tested are simply those with the
parameters swapped from code-paths we did test.  In any case, the
float-distance between values should be symmetric, so test that.

Task-number: QTBUG-88183
Change-Id: I2060eb77b1abada5b0fd5f4557dbb1761c5cfd02
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-17 19:55:04 +01:00
Shawn Rutledge
f5010c49a3 QTest: don't wait before sending mouse event: increment the timestamp
Tests can run faster now, but we still expect calculations based on
the timestamp (such as QEventPoint::velocity()) to be correct.

Change-Id: Ie962604c9ebd139384dcd89a157de66b4b773cc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-17 19:55:04 +01:00
Ivan Solovev
1d8dd9a02c Track progress range in QFutureInterface::setProgressValue
Previously QFutureInterface::setProgressValue was silently ignoring
the progress range and allowed to set any progress value.
Also no checks were performed in QFutureInterface::setProgressRange,
which allowed the user to set minimum > maximum.

Add checking of the current progress range, when settings the
progress value.
Add checks for minimum and maximum values while setting the progress
range.
The implementation of the checks is mostly based on the logic
that is used in QProgressBar.
- If maximum is smaller than minimum, minimum becomes the only legal
value.
- If the current progress value falls outside the new range, the
progress value is set to be minimum.
- If both progressMinimum() and progressMaximum() return 0, the
current progress range is considered to be unused, and any progress
value can be set.
- When setting the value using setProgressValue(), if the value falls
out of the progress range, the method has no effect.

Task-number: QTBUG-84729
Change-Id: I29cf4f94b8e98e1af30dd46fbdba39c421cf66bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-11-17 16:16:31 +01:00