Commit Graph

61207 Commits

Author SHA1 Message Date
Morten Sørvig
e3c9dce0b6 Use QHighDpiScaling when determining scale factor
The makes sure that the scale factor used by the style
is identical to the scale factor used by Qt Gui, by for
instance taking scale factor rounding into account.

Task-id: QTBUG-109715
Change-Id: Ia0354a7ce0f51eb9fd5f2591ee6c4057291943f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-18 12:42:45 +00:00
Mikolaj Boc
020f03c47e FileDialog: Use well-known DeleteOnClose instead of custom lambda
The custom dialog-deleting lambda in QFileDialog::saveFileContent
is redundant

Change-Id: I03c2fa29ab0502b981460e34674a40a704a22e2d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 13:39:20 +02:00
Vladimir Belyavsky
f6908c4f71 QNetworkInformation[Win]: Improve WinRT exceptions handling
- handle only winrt::hresult_error exceptions, as this is the only
reported cases, so we don't need ellipsis there
- print relevant warnings

Pick-to: 6.5
Change-Id: Ibf18a7eab7862e2c20f5729545387ddc7ca42952
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-18 11:39:20 +00:00
Volker Hilsheimer
ca978e2c12 QStyleSheet: rotate QSizeGrip image around center
Depending on the corner that the size grip lives in, the style sheet
style rotates the painter before rendering the drawable. However, that
needs to be done around the center of the size grip, not around the
origin, as otherwise the image rotates out of the rect.

Use a static array to map the corner to the rotation value, and
translate/rotate/translate back only if there is a rotation.

Pick-to: 6.5
Fixes: QTBUG-112252
Change-Id: I59f69385bd6699ecc8db46390c5f7cc933574ce8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-04-18 13:23:48 +02:00
Fabian Kosmale
cb30e45b9a Avoid capturing same property twice
Avoid capturing the same property multiple times in a binding by
storing them in the BindingEvaluationState. We store them in a
QVarLengthArray array, as the number of properties involved in a binding
is expected to be rather low, so a linear scan is fine.

Avoiding double capture is a good idea in general, as we would otherwise
needlessly reevaluate bindings multiple times, and also needlessly
allocate memory for further observers, instead of using a binding's
inline observer array.

Even more importantantly, our notification code makes assumptions that
notify will visit bindings only exactly once. Not upholding that
invariant leads to memory corruption and subsequent crashes, as
observers allocated by the binding would get freed, even though we would
still access them later.

Fixes: QTBUG-112822
Pick-to: 6.5 6.2
Change-Id: Icdc1f43fe554df6fa69e881872b2c429d5fa0bbc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
2b908ba8f4 QOpenGLWidget: correct the lifetime of the wrapper texture objects
If the QOpenGLFramebufferObject (which owns the OpenGL texture object)
is destroyed, the wrapper QRhiTexture must be destroyed too.

This surfaced with WebAssembly for some reason, likely due to an event
(most likely resize) sending pattern that is different from other
platforms. Sending more resizes likely triggers another recreateFbos()
call which, until now, did not correctly dropped the wrapper
QRhiTextures so those continued to refer to the now-destroyed texture
IDs.

Pick-to: 6.5 6.4
Task-number: QTBUG-111304
Change-Id: Ieed9a11c5c28da0fee497107ebe88da9eb5f45a8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
99c8eca3f4 cube example: make sure the program is bound
...in paintGL. There is nothing saying the current
program (or other state) cannot change between
paintGL calls (or initializeGL and paintGL calls).

Correctly call program.bind(). This eliminates the
WebGL warning with WebAssembly.

Pick-to: 6.5 6.4
Task-number: QTBUG-111304
Change-Id: I19792f5f193dcdb305473a939780df33deb1f8e1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
1645ce9a4a rhi: Fix offscreen manual test's Vulkan init
Pick-to: 6.5
Change-Id: Iaf7da78fd0c1c1265b05bfd4c7ced5d94ae963fe
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-18 13:23:48 +02:00
Joerg Bornemann
24fe86ebe7 CMake: Store unsanitized plugin type names in module .json files
The module information .json gained a "plugin_types" key in 6.5.0.
Unfortunately, this contained the "sanitized" version of plugin types,
meaning dashes converted to underscores. For plugin types that contain
dashes, e.g. wayland-decoration-client, the file contained
wayland_decoration_client, which doesn't match its plugin directory
name.

Since "unsanitizing" plugin names is hard and "sanitizing" is easy, we
now store the unsanitized plugin names and burden the consumer of the
module .json files with the sanitation task.

[ChangeLog][CMake] The module information JSON files now contain the
unsanitized plugin types of a module, e.g. wayland-decoration-client
instead of wayland_decoration_client. Consumers of the module
information file must sanitize plugin types themselves if necessary.

Pick-to: 6.5
Fixes: QTBUG-112872
Change-Id: I09cc9406b360779087086707abee3d5219a24452
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-18 09:29:33 +02:00
Jan Moeller
ffdfafc4b4 Ignore removed/changed screens if no QIOSIntegration instance exists
QIOSTracker registers itself as handlers for system notifications about
changes of the screen environment. If no QIOSIntegration instance
exists, newly detected screens are not added to the list of known
screens (see screenConnected()). This, in turn, will result in a crash
if a screen is disconnected and removed in screenDisconnected() as it
is not known to qtPlatformScreenFor() and the function returns a
nullptr.

Consider the QIOSIntegration also whenever a screen is "changed". This
is more of a safety measure do avoid crashes for unknown screens.

This situation occurs if an iOS device is used to mirror the display
via AirPlay and no actual QGuiApplication exists, e.g. Qt is only
embedded in a Framework.

Pick-to: 6.5 6.2
Fixes: QTBUG-106701
Change-Id: Id778fc5afa7c284b0536ee02b1ba2c10321cc5b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
2023-04-18 09:22:46 +02:00
Volker Hilsheimer
c4449c040c Add helper template for metacall event creation
Setting up the args and types arrays is cumbersome and error prone, and
we do it at least twice in qtbase. Provide a central implementation as a
variadic template function, and make it exception-safe with a unique_ptr
(the destructor of QMetaCallEvent will destroy the cloned arguments).

Change-Id: I5ff400467928446264eaedddb394691e9e23d22e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-18 00:11:13 +02:00
Christian Ehrlicher
db7dc35897 SQL: replace qPrintable() / toLocal8Bit() with unicode versions
Replace qPrintable() and toLocal8Bit() with qUtf16Printable()

Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 00:11:05 +02:00
Volker Hilsheimer
fd879a38cc Fix another warning when comparing size_t and qsizetype
Amends 07f7ed2bad.

Change-Id: I0644e47e8e9ccd0bcaf074adf99e7481c692b5c1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-18 00:10:56 +02:00
Amir Masoud Abdol
bafe9dfc61 Pass native path in qt-internal-configure-tests
In the previous patch, I did not account for how we usually use the
qt-internal-configure-test.bat in our CI. This should be a more robust
script, where we search for the source path, -S <PATH>, make it native,
and put it back.

Amend 389b3a131a

Pick-to: 6.5
Change-Id: Ic59de2eb1e6720de150a9e15a4b38fae4d871815
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-17 23:32:34 +02:00
Yuhang Zhao
97ee38eb52 SQL plugins: add mimer to the help text
Change-Id: Icd080131924ad1e3fb42fc39327621faac0b1659
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 05:32:34 +08:00
Joerg Bornemann
0aa9b08536 qmake: Fix infinite make loop if RESOURCES contains nonexistent .qrc
If RESOURCES contained a non-existent .qrc file, qmake produced
Makefiles that resulted in an infinite loop when running GNU Make.

Introduce a new extra compiler CONFIG value "remove_no_exist" that
removes non-existent extra compiler input. This value is now used in the
extra compiler that handles the RESOURCES variable.

The difference to the existing CONFIG value "ignore_no_exist" is that
qmake still prints a warning about the non-existent file.

Pick-to: 6.5
Fixes: QTBUG-112743
Change-Id: I3293af75b75f217e1a1738b49da0af1117cfdecb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-17 23:32:34 +02:00
Friedemann Kleint
69d4ecd6ef Remove unused documentation code snippets
Modules:
- Core
- Gui
- Widgets
- Open(Widgets)
- PrintSupport
- Sql
- Network
- Concurrent
- Testlib

Pick-to: 6.5
Change-Id: I63e58c01bec4bd162486020f0085227fdaa83b18
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-17 21:02:32 +02:00
Timothée Keller
94279afff8 Windeployqt: change MinGW dll's import location
The MinGW runtimes were imported through the PATH, which creates
mismatches with the expected libraries that are installed directly
through Qt. Check if those can be used instead, and issue a warning
(and default to PATH) if not.

Fixes: QTBUG-112448
Pick-to: 6.5
Change-Id: I061baabb6d6188bd0817b68c39a5d9f04ff391b5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-17 16:24:59 +02:00
Kai Köhne
a03fdd65ee Doc: Fix dead link in QCA::translate()
There's no 2nd translate() method. Instead, link to the section about
I18N in the summary.

Pick-to: 6.5
Change-Id: I7c3177cee91eeb550eb24b6f272a175b5c0e5487
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-04-17 16:23:24 +02:00
Laszlo Agocs
5f3c3044a5 rhi: d3d12: Implement debug markers
As usual this is only doing anything when launched with
QSG_RHI_PROFILE=1. Otherwise the debugMark* functions are
no-ops.

Uses the old PIX API (pix.h) since that is what is available in the
Windows SDK. This works well with RenderDoc. The strings show up
in PIX captures as well although that will warn that the pix.h stuff
is deprecated. Unfortunately using the PIX3 API involves headers and
libraries not part of the Windows SDK so we do not want to open that
can of worms now.

Problem is, pix.h may not be present in some SDKs as shown in the CI.
So use __has_include and lose the whole feature if the header is not
present at build time.

Change-Id: I8606d151f75a492071bf0c8d98b16026ff94d45c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-17 16:06:17 +02:00
Liang Qi
14feb6792e tests: blacklist tst_QGraphicsEffect::draw() on Wayland
Task-number: QTBUG-109779
Pick-to: 6.5
Change-Id: I21ecd4910ba3d699e44d9ea922093e98e0b8a335
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2023-04-17 16:05:24 +02:00
Ahmad Samir
044a29bc66 corelib/global/*.h: use static_assert instead of Q_STATIC_ASSERT_X
qtconfigmacros:
Otherwise we'd need to include <QtCore/qassert.h> before using
QT_REQUIRE_CONFIG. It cannot be added here as qassert.h itself uses
QT_CONFIG, i.e. qassert.h needs to include this header. And
Q_STATIC_ASSERT_X is only kept around to keep old code working.

_Static_assert is deprecated in C23:
https://en.cppreference.com/w/c/language/_Static_assert

Change-Id: Ie60a02274cc5be8bd1c6dc3819ccfbc2e7864a21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-16 22:17:51 +02:00
Giuseppe D'Angelo
3b81d04bc6 QMetaType: more doc tidies for the flags
Change-Id: I354b2dc901ecb1b2baa717c74e265e9201d8e63e
Pick-to: 6.5 6.2 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-16 12:00:24 +02:00
Giuseppe D'Angelo
ecfa13bdac QMetaType::IsGadget: doc tidies
Although undocumented (which is weird, as other docs refer to it),
fix the spelling and the formatting.

Change-Id: Ief8b04e3b9272386c663c463c3659e8b837260f5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-04-16 12:00:17 +02:00
Ahmad Samir
c1e1d133c4 mimetypes/: port to qsizetype
Fixes compiler warnings about narrowing conversions.

Found by compiling with clang and -Wshorten-64-to-32.

Drive-by changes:
- use range-for instead of an iterator based loop
- use strlen("*.") instead of magic number 2

Pick-to: 6.5
Task-number: QTBUG-102461
Change-Id: I0bf2299049c0411ed496468238ca30b69946ffc2
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-15 17:21:10 +02:00
Christian Ehrlicher
8ca2d6ba09 CommonStyle/QSpinBox: fix rendering up/down symbols in high-dpi mode
The previous patch for QTBUG-112019 could lead to an uneven length which
in results in an incorrect center. Fix it by making sure that the length
(and width) of the two rectangles are even so we always get a proper
center without fiddling around with float values. Also honor
PM_ButtonShiftHorizontal/Vertical now (was forgotten in the last patch).

Pick-to: 6.5
Fixes: QTBUG-112019
Fixes: QTBUG-112861
Change-Id: Ifc19b863c761ae545208b996ba60d1f33bceb2b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-15 13:56:27 +02:00
Christian Ehrlicher
d9bd46b2b8 SQL/Tests: make sure created procedures are cleaned up on exit
Similar to TableScope - create a helper class to make sure the
procedures are cleaned up on exit so they don't affect the result during
the next test run.

Change-Id: Ic5b02ca63e03f330392797ed22313767557fc548
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-15 13:56:21 +02:00
Frederik Gladhorn
db346e711c Fix accessibility on XCB when running as root
Accessibility actually works when running applications as root, but we
would never properly connect, since the enabledChanged signal would be
emitted from the constructor in this case. So after connecting the
signal, check the value by hand to make sure not to miss the
notification.

Only applications running as root would be affected, because all other
applications would go through the asynchronous pattern of getting the
bus address from dbus instead.

[ChangeLog][QtGui][Accessibility] On XCB applications running as root are
now accessible.

Pick-to: 6.5
Fixes: QTBUG-43674
Change-Id: I82cdc35f00693a8366dfcdab2f2c3c6dc5f5b783
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-15 05:48:27 +02:00
Vladimir Belyavsky
5564b166a3 QNetworkInformation[Win]: Catch potential WinRT exceptions
Some Windows SDKs seem to throw an exception from winrt::check_hresult()
We need to handle this accordingly. Catch the exception and print relevant warning.

Fixes: QTBUG-110408
Pick-to: 6.5
Change-Id: I1434ec425f0d0e597308b53f25f4f15049640060
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-14 21:26:29 +03:00
Volker Hilsheimer
79ac430537 Test for QWindow getting enter/leave events when secondary window shows/hides
Equivalent to the test added to the QWidget test case, but since QtWidgets
code contains logic to both synthesize and compress/filter enter/leave
events, we can only verify that the QWindow does get the events.

The test is very flaky on Windows, so blacklisting it right away.

Change-Id: Ic1da9439f60f619a76a3653a23fef8e9ebc0e75d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-14 20:13:41 +02:00
Christian Ehrlicher
d71dc36f47 QSQLDatabase: avoid some code duplication
Avoid some code duplication and enhance the documentation about
thread-safeness of QSQLDatabase::cloneDatabase()

Fixes: QTBUG-60505
Change-Id: I6ca6b9f47d818d49ca51395da14051e40317cef6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 19:25:55 +02:00
Amir Masoud Abdol
6de26ae531 Exclude thread/qwaitcondition_unix.cpp from the Unity Build
Temporary exclude `qwaitcondition_unix.cpp` from the unity build, until
either of the mentioned change sets get merged.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Iaacd090647ba007e0ab714dc674e67552f85c350
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-14 18:34:06 +02:00
Amir Masoud Abdol
389b3a131a Add drive letter to source paths when calling qt-internal- scripts
Like qt-configure-module.bat, when building with unity build, CMake
needs to know the full path of the source directory to be able to
correctly generate its `*_cxx.cxx` files. So far, this seems to only
affect Windows' LLVM/MinGW builds. By this patch, I make sure that we
pass the full path to CMake.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ida2da127ecba95856b6e0091936c471c2a116936
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-14 18:34:05 +02:00
Amir Masoud Abdol
38d56e2b72 Add [[maybe_unused]] attribute to an unused variable
Otherwise, it could break the unity build.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ic1b3ac51b8a9e8bb93a3b1a4d6717fa45099e91b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-14 18:34:05 +02:00
Edward Welbourne
76075aa3a9 QDate: enable {start,end}OfDay() to make second-adjustments
Previously it only got the answer correct to the minute. That's good
enough for most transitions, but those involving local solar mean time
(LMT) may have second deviations. So check the second before or after,
that'll usually be the other side of the transition; if it isn't, do a
further binary chop on seconds to hit the correct value.

Most zones' canonical locations are only specified to the size of a
city, so second precision is all anyone cares about; a few hundred
metres difference in location would change that. The one exception is
Europe/Amsterdam, which had its own Royal Observatory and time
standard, hence had an offset known to greater precision; but the IANA
DB duly approximates that, too, so we won't have data with millisecond
precision even in that case, so don't try to refine beyond second.

Change-Id: I20fb355f8113c32387ed8a84fbf5a41004273978
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-04-14 13:23:50 +00:00
Edward Welbourne
b906796af6 Fix QDateTime tests in zones whose side of UTC varies
The classification of local time as ahead of UTC, behind it or equal
to it gets complicated by zones near the prime meridian - some of
which have varied which side of it they nominally are - or the
international date line, which a few zones have crossed.

So, instead of having one classifying variable, split to having three,
one for the distant past (when using local solar mean time), one for
the epoch and one for the distant future.

Change-Id: I7c0da376e1625372086dc51afa815756f0bde442
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:23:09 +02:00
Edward Welbourne
462d3547f7 Add a manual test helper script, foreachzone
This makes it possible, on a system with /usr/{lib,share}/zoneinfo/,
to systematically run a command with TZ set to each system-supported
zone. For example, it can be used to verify that a corelib/time/ test
passes regardless of the valid setting of TZ.

Change-Id: I6ea9a64d8bcb745aea80ab9ae431602d3e3265a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:22:27 +02:00
Edward Welbourne
9f11574a7d Explain the cases where we must exclude some QDTE test cases
The stepIntoDSTGap() hour cases were already conditioned on hour > 0,
explain why. The month and year tests need similar checks for kindred
reasons; add and document those checks.

Pick-to: 6.5
Change-Id: Ibcb69449fcd572ee94306a805fd680e9b5155322
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:22:16 +02:00
Edward Welbourne
ee46c645a6 Skip some tests that fail in the Indian/Cocos timezone
The zone had a transition at the start of 1900, so QDTP's default date
ends up being 1900-01-01 at 00:02:20 instead of at 00:00:00; and any
parsing of date-time strings that doesn't set the minutes and seconds
consequently ends up "wrong" (about a field that wasn't specified).

Change-Id: If4b9864616fa08bc023a6974dae255f96ca90f83
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:21:50 +02:00
Edward Welbourne
90d4957c12 tst_QDateTimeParser::intermediateYear(): adapt for Indian/Cocos zone
The zone had a transition at the start of 1900, used as default date
by the parser. This leads to the default minutes and seconds being 2
and 20, rather than 0. Since this test is parsing a date-only string,
only check the date of the result, to avoid failing in Cocos.

Pick-to: 6.5
Change-Id: Ifb307eadb747097988bcf0afc6f307835ff2c8ec
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:21:39 +02:00
Edward Welbourne
b81515c58a Correct a test's precondition on the system zone
America/Sao_Paulo was not alone in starting 2008-10-19 with a spring
forward. Include the other affected zones in the check to tune the
expected start-of-day time. See [0] for details.

[0] https://github.com/eggert/tz/blob/main/southamerica

Pick-to: 6.5
Change-Id: If251d8b715090319441790696983273637765d2e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:21:22 +02:00
Edward Welbourne
bab9af5891 Fix where possible, else avoid, failures in western Mexico
Some QDateTime tests get tripped up by a transition at the epoch in
Baja Mexico. For the operator_eq() and time-difference test, simply
using startOfDay() instead of QTime(0, 0) - which was skipped - solves
the problem. For addDays() and fromStringDateFormat(), skip the
affected tests.

Change-Id: I3620f0d1e4b05d9f799662eea96a40c8284de331
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:08 +02:00
Edward Welbourne
ca4aa06523 Add new test-case for startOfDay_endOfDay() for Baja Mexico
The zones in Baja Mexico had a transition at the epoch.

Change-Id: Ic70e23bcc980bf371e925fcb8fb83ca5ef000c9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:03 +02:00
Edward Welbourne
919d2e0c5a Correct time zone in tst_QDateTimeEdit::stepIntoDSTGap()
Given that QDTE only supports local time and UTC, using Europe/Oslo as
zone was disconnected from reality, especially as various QDateTime()s
were constructed using local time. Use the system zone.

Pick-to: 6.5 6.2
Change-Id: I95b3a6a6acf9ffc2b8c7f05d3dd9440ff173abfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 13:19:03 +00:00
Edward Welbourne
d43391422a Correct the start of a QDTE::stepIntoDSTGap() test
The test wants to start shortly after the transition, then step an
hour backwards, into it, to check we land safely on the other side.
However, it assumed the gap witdh was an hour, which is not reliable.
Use the gapWidth already used in computing springGap instead.

The -3590 seconds in the result time is correct, as it's the ten extra
seconds we started beyond the gap, minus the hour we step backwards.

Pick-to: 6.5
Change-Id: I4399af7e54a60bd55ea51d054d3cd2ecfcb0e354
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:19:03 +02:00
Edward Welbourne
5432a8040f tst_QDateTimeEdit::springForward(): use u'0' instead of QLatin1Char('0')
Pick-to: 6.5
Change-Id: I0c13c6b658cac3472d21b8d92b1e5eb73c094a7c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
4e69b6de4b Correct row names in tst_QDateTimeEdit::springForward_data()
The "{forward,back} to %s, correct to nearest" tests were reporting
the time of the transition as %s but, like the jump test, were using
the middle of the gap as the time to set. So compute that mid-time's
string once and use it in all three test names. Also renamed some
local variables to accommodate the new one for this text.

Pick-to: 6.5
Change-Id: Ic6c40c470fc74ae8bcfc0dc9d1596af06318a883
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
28c6868611 tst_QDateTimeEdit: correct computation of width of gap
Although the zone's daylight time offset is usually the width of the
gap, it's possible the transition is (or includes) a change to
standard time; so determine the actual gap width by comparing the
difference between time a day earlier and later to the usual duration
of two days. Also skip the test if the transition isn't really a gap.

Pick-to: 6.5
Change-Id: I56e381c9f74cfa1806d43b3ed5e4637436ebdf57
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
f06cc22509 tst_QDateTimeEdit: Use correct zone for findSpring()'s transition
The function is passed a zone to work in, so setting the transition to
local time made no sense; set to the given zone's time, instead.

Pick-to: 6.5
Change-Id: Icaa0955fe5fcd5bc257322afcb7e25e932dedd1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
a076fdfec6 tst_QDateTime: Remove two duplicate test cases
Pick-to: 6.5 6.2
Change-Id: I36541b5c6f7c35deee9678e2f736e1db9f36039f
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-04-14 15:19:02 +02:00