qt5base-lts/tests/auto
Edward Welbourne 50c63446f5 Fix problems with offset-derived ids for QTimeZone
When creating a time-zone from a UTC+offset name that isn't known to
the system, QTimeZone (since the fix to QTBUG-77738 in 5.15.0) falls
back to constructing a suitable UTC-offset backend; however, the id of
this is not guaranteed to match the id passed in to the constructor.
In all other cases, the id of a QTimeZone does match the id passed to
its constructor.

Some utcOffsetId testcases had different id() than the id passed to
the constructor, due to mismatches where a zone was constructed using
the fall-back but the generated id included its minutes (as :00) or
omitted its seconds. The omission of seconds is clearly a bug, but we
also don't want to include :00 for seconds when it's not needed. So
change QTimeZonePrivate::isoOffsetFormat() to accept a
QTimeZone::NameType to configure how much we include in an id. Its
callers other than the relevant constructor (from offset) still get
minutes, even when :00, but will also get seconds added if that isn't
zero; and the constructor from offset now gets the short form obtained
by omitting all trailing zeros.

Since all valid whole-hour offset names that do include :00 for the
minutes field are in fact known standard offset names, the elision of
minutes will only affect zones created by ID in the case of a
whole-hour offset given without :00 minutes specifier, so these shall
necessarily in fact get the ID passed to the constructor. Creating by
UTC-offset with a name that specifies zero seconds will result in a
QTimeZone instance whose id() differs from what was passed to its
constructor (eliding the :00 seconds and potentially also minutes, if
also zero) but this should be the only case where a QTimeZone's id
doesn't match the one passed to the constructor, when constructed by
id.

Fixed inconsistency between the offset-constructor's declaration
(taking offset as int) and definition (taking qint32) in the process.
Added an id check to the utcOffsetId() testcase. Amended two tests of
offset-derived time-zones' IDs, added comments to make clear how one
of those differs from a matching standard name test and converted two
uses of QCOMPARE(, true) to QVERIFY().

[ChangeLog][QtCore][QTimeZone] QTimeZone instances created by offset
from UTC (in seconds) shall now only include minutes in their ID when
the offset is not a whole number of hours. They shall also include the
seconds in their ID when the offset is not a whole number of minutes.

Pick-to: 6.0 5.15
Task-number: QTBUG-87435
Change-Id: I610e0a78e2aca51e12bfe003497434a998e93dc7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-18 15:55:05 +01:00
..
cmake Remove the qmake project files 2021-01-07 15:32:28 +01:00
concurrent Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
corelib Fix problems with offset-derived ids for QTimeZone 2021-01-18 15:55:05 +01:00
dbus Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
gui rhi: Stop hardcoding the Vulkan backend's desired instance extensions 2021-01-18 13:21:15 +01:00
guiapplauncher Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00
network Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
opengl Remove the qmake project files 2021-01-07 15:32:28 +01:00
other Fix lancelot GL painting test for GLES 2021-01-18 07:42:31 +01:00
printsupport Remove the qmake project files 2021-01-07 15:32:28 +01:00
shared Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
sql QODBC: Preserve the whole value when using HighPrecision 2021-01-14 07:02:43 +00:00
testlib QTestlib/JUnit XML: Log most messages to standard output instead of error output 2021-01-15 18:05:40 +01:00
tools Hardcode a special case of using qOverload for slots without arguments 2021-01-15 17:39:46 +01:00
widgets Windows: Fix dialog moving up after closing/reshowing 2021-01-15 18:05:19 +01:00
xml tst_qdom: clean-up the code enabled only before Qt 6 2021-01-15 15:22:08 +01:00
CMakeLists.txt CMake: Fix building with -DQT_FEATURE_gui=OFF 2020-09-15 20:05:32 +02:00
network-settings.h Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00