qt6-bb10/tests/auto/corelib
Ivan Solovev 612b67cf13 QTimer: do not set active state when setting a negative interval
QObject::startTimer() returns 0 in case of failure, for example when
someone tries to register a timer with a negative interval.

However, QTimer internally uses -1 as an invalid timer id.
This could lead to a situation when the timer was not really started,
but QTimer::isActive() returned true.

This patch fixes it in two ways:
- check the return value of QObject::startTimer() and treat 0 as an
  error.
- do not treat 0 as a valid timer id when calculating the active state.

As a drive-by: move the `using namespace std::chrono_literals;`
declaration to the top of tst_qtimer.cpp, so that we do not need to
repeat it in each test case.

Fixes: QTBUG-122087
Pick-to: 6.7 6.6 6.5
Change-Id: I0e21152b2173ebb5fb0dada1b99a903a321ca9c4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-02-12 23:49:54 +01:00
..
animation Change license for tests files 2024-02-04 09:56:42 +01:00
global Change license for tests files 2024-02-04 09:56:42 +01:00
io QUrl IDNA: Update to Unicode 15.1 2024-02-08 17:43:58 +01:00
ipc Change license for tests files 2024-02-04 09:56:42 +01:00
itemmodels Change license for tests files 2024-02-04 09:56:42 +01:00
kernel QTimer: do not set active state when setting a negative interval 2024-02-12 23:49:54 +01:00
mimetypes Change license for tests files 2024-02-04 09:56:42 +01:00
platform Change license for tests files 2024-02-04 09:56:42 +01:00
plugin Remove extra semi-colons 2024-02-06 20:17:18 +09:00
serialization Deprecate QDataStream::readBytes(char *&, uint &) instead of removing it 2024-02-07 15:02:19 +01:00
text QStringConverter: add a test for missing drain 2024-02-12 19:12:25 +01:00
thread Change license for tests files 2024-02-04 09:56:42 +01:00
time QIcuTimeZonePrivate constructor: save iteration over all zone IDs 2024-02-08 15:40:03 +01:00
tools QMap: add missing qHash() overload 2024-02-09 20:33:05 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00