Commit Graph

227 Commits

Author SHA1 Message Date
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
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
Edward Welbourne
91fedd50f0 tst_QDateTime constructor: adapt the year check to vary year
We check three sample dates, in different years, so don't compare
their year() to 1970, but to their respective actual years. In the
process, package the arrays iterated for these checks into a constexpr
struct array and reverse them so that, instead of reverse-iterating
and indexing, we can use a ranged-for loop.

Change-Id: I214685346c637875a4ea31125c324851eb4308db
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:02 +02:00
Edward Welbourne
9aa87643d7 tst_QDate::startOfDay_endOfDay(): rename variables, add comments
The name final is suboptimal, given that it's also a keyword.
Rename initial at the same time.

The local-time parts of the test are apt to fail if local time
coincides with the zone being tested, as previously noted. Document
known cases of such coincidences, to help someone studying a failure
to know why it happened.

Change-Id: I1f1f302f161373a154066df210e03725b9a5f9ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:02 +02:00
Edward Welbourne
c8c5b8ac1a tst_QDateTime::addMSecs(): check for failure after calling helper
When the test failed, it did so in triplicate.

Pick-to: 6.5
Change-Id: Ia871aed0a5960120a2659a6778c10dccd4b2953a
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:01 +02:00
Edward Welbourne
ac653abc41 Name a numeric_limits locally to save verbose repetition
Change-Id: I443eb1f5a38e79a28827ac3e664100e6a23a9ef2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-04-14 15:19:01 +02:00
Ahmad Samir
94a01cd6ec QDate: remove an old comment
QDateTime::addMsecs does check for overflow. I don't know when this
 has changed, but it doesn't matter.

Change-Id: I44c6ba5e88cce544c0d1ef33fa38a528a96b0b7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:23:22 +02:00
Ahmad Samir
d1140235e2 QDate: reformat a unittest
Change-Id: I323975db23f40fe2e7fc5062fbc8102dedbaaf5a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:21:51 +02:00
Edward Welbourne
db5279825c Corelib: s/Q_OS_MAC/Q_OS_DARWIN/wg except for doc and definition
I got tired of being told off by the inanity 'bot for faithfully
reflecting existing #if-ery in new #if-ery. Retain only the
documentation and definition of the deprecated define.

Change-Id: I47f47b76bd239a360f27ae5afe593dfad8746538
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-20 19:18:52 +01:00
Ahmad Samir
41fea4f5fa QDate: add epochDate() helper to unittests
Drive-by change: add an assert for JULIAN_DAY_FOR_EPOCH.

Change-Id: I891ef253f1f16b1efb8354d1b179f319b3553feb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-16 17:52:20 +02:00
Ahmad Samir
96e031edd7 QDateTimeParser: add more unittests for the unquote() static helper
Test documented behavior and serv as a baseline for future changes.

Change-Id: I36a914694d5244c89f28f3e403e11d65492a5eef
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-02-22 17:41:20 +02:00
Friedemann Kleint
97bfacf1e2 tests: Remove remains of qmake conversion from CMakeLists.txt files
Pick-to: 6.5
Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-02-17 21:56:49 +01:00
Edward Welbourne
b62ac40987 Move qtLocalTime() to qtenvironmentvariables.cpp as qLocalTime()
The new name better matches the names of existing functions there.
A comment on the old code noted that such a move should really be
done, so as to correctly share the environment-mutex locking.

In the process, move the (now three) time-related internal functions
from qglobal_p.h to a new qtenvironmentvariables_p.h since that's the
natural place for them given where they're defined (and the fact that
they're for internal use only).

Change-Id: Ib028baebaf31a806a2c0c97caaaba0a466c11cea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-03 14:45:31 +01:00
Tatiana Borisova
676a2fe36f Fix RTA test build for INTEGRITY
In case of QT_FEATURE_timezone=OFF test should not be built

Change-Id: If667b9edb1d670b9ed8a62f301a7e5e21e7d2b4c
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-01-09 11:47:37 +01:00
Edward Welbourne
8c8d6ff7b6 Deprecate QDateTime methods using plain Qt::TimeSpec
As foreshadowed when QDateTime adapted to route all QTimeSpec use
through QTimeZone, this commit deprecates the old API in favor of the
newly more capable QTimeZone-based API.

Fixes: QTBUG-108199
Change-Id: I9a3f9f94d4a5d8cc229db72b3e4731a9e318a076
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-10 06:39:33 +01:00
Edward Welbourne
3f282e8896 Adapt corelib to use QTimeZone in place of Qt::TimeSpec
This saves (mostly in corelib/time/) some complications that used to
arise from needing different code-paths for different time-specs.

Task-number: QTBUG-108199
Change-Id: I5dbd09859fce7599f1ba761f8a0bfc4633d0bef9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-09 16:16:48 +01:00
Edward Welbourne
e4a1705a8d Expand testing of QDateTime to exploit QTimeZone's handling of specs
For now, just addDays() and the springForward() test, as proofs of
concept for future work to be more systematic.

Change-Id: Id2c4e9ad304d3aef6fdfb48ae6328df8c638c934
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-09 16:16:47 +01:00
Edward Welbourne
f46c18c627 Adapt QDateTime to route QTimeSpec uses via QTimeZone
Free most APIs using QTimeZone from feature timezone and route all
APIs taking a naked QTimeSpec via these, in preparation for their
eventual deprecation. Since qtimezone.h includes qdatetime.h (and MSVC
blocks our ability to remove the need for that), qdatetime.h's
declarations can't use a default value for QTimeZone parameters; so
add overloads taking no zone (or spec) to handle that.

[ChangeLog][QtCore][QDateTime] All QDateTime APIs involving a
Qt::TimeSpec can now be routed via QTimeZone's lightweight time
description support, saving the need to have different code paths for
different time specs. In the process, QDateTime gains a
timeRepresentation() method to return a QTimeZone reporting the
(possibly lightweight) time description it uses. (The older timeZone()
method always returns a non-lightweight QTimeZone, whose timeSpec() is
Qt::TimeZone.)

Task-number: QTBUG-108199
Change-Id: I23e43401eb2dbe9b7b534ca6401389920dd96b3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-09 16:16:47 +01:00
Edward Welbourne
ae6186c7e8 Adapt QTimeZone to handle Qt::TimeSpec machinery
[ChangeLog][QtCore][QTimeZone] QTimeZone is now always defined;
feature timezone now controls most of its prior API and some new API
is added, most of it always present, to enable QTimeZone to package a
Qt::TimeSpec and, for Qt::OffsetFromUTC, its offset. Prior to this
change, APIs using Qt::TimeSpec had to provide a separate function
taking a QTimeZone alongside a function taking a Qt::TimeSpec and
optional offset; it will now be possible to unify these into a single
function taking a QTimeZone. Adaptation of other Qt classes to do so
shall follow.

Task-number: QTBUG-108199
Change-Id: If5ec3cc63920af882ebb333bf69cde266b1f6ad7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-09 16:16:47 +01:00
Edward Welbourne
de1895f423 tst_QDateTime: explain one test-case more carefully
In the process, split some long lines. The test relies on omitting the
hour (so as to get the default, 0) from both the format string and the
string parsed, so as to test that the parser correctly handles the
corner case where the zone skips the first hour of the day. This was
not entirely obvious when reading the row data, so make it explicit in
a comment.

Change-Id: I919b292b78bd399a8749806a0e913d43f5b414e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-07 14:58:41 +01:00
Edward Welbourne
33bb8fcae9 Add to test-cases for tst_QDateTime::fromStringStringFormat()
Test a few more cases are correctly handled.

Change-Id: I7f286ba93f59bf0168cac789cd30590f40e98cee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:41 +01:00
Edward Welbourne
0522443f4b tst_QDateTime::operator_insert_extract() Correct handling of 4.0's spec
The spec deseralized isn't a Qt::TimeSpec; handle it correctly instead
of taking for granted that QDateTimePrivate::Spec's values happen to
match.

Change-Id: I67f3c960f3a3b90cdad3c1eca673f7ec8fd10b82
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:41 +01:00
Edward Welbourne
49af4d48d1 tst_QDateTime: check a few more details
Mostly pedagogic checks in operator_insert_extract(), but also
sanity-checking, to confirm spec conversions produce results equal to
what each came from.

In daylightTransitions(), verify the spring forward goes from standard
time to daylight-saving time.

Change-Id: Ieb9c603ee2eadecea055da4e8889528161f4d999
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:41 +01:00
Edward Welbourne
5a1fbef109 tst_QDateTime: Modernize some comparisons
Use QCOMPARE(a, b) in place of QVERIFY(a == b), similar with
QCOMPARE_LT() and QCOMPARE_LE(); and use a scope-guard to emit a
message on failure instead of incurring the cost of building a string
for the message, even when the passing test doesn't need it.

Change-Id: I3884bc40e89a4b1ba881968b99faab27d4b1abc9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
ddd686775c Elide parameters passed as their default
Principally to get Qt::LocalTime mentions out of the way ahead of the
QTimeZone work on Qt::TimeSpec, but also mop up trailing 0 parameters
to QTime for seconds and milliseconds.

Change-Id: I51041582faae100894a567c9e5ae96a60a3b2d8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
c9889d1f61 Prefer QDate::startOfDay() over QDT(date, QTime(0, 0), ...)
Change-Id: If02186791c2b8004b407b88393c132dc6d28a5ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
ccedfd063e tst_QDateTime::fromMSecsSinceEpoch(): remove a stray debug statement
Left over from long ago, making confused use of Qt::hex.

Change-Id: I7f411e4888ee1a637d2212fd6976dd003f8da9ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
a24e131ee5 tst_QDateTime: split some data table rows across lines more tidily
Several were overlong (or soon to get so by being made longer); others
were inconsistent with neighbors; one was inconsistent with itself.

Change-Id: I272680499605a757e4827d27021bf234a91cf77a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:40 +01:00
Edward Welbourne
2dd83a0778 tst_QDateTime: Inline some trivial delegations by _data() functions
Change-Id: Ib174a3ef1e4e913c6dc433b17854295cf529ad8f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:40 +01:00
Edward Welbourne
e3321cf599 Suppress output of debug message only produced to test against crash
As a result, also make sure the test will fail if output to debug
stream doesn't produce the expected result.

Change-Id: I9914c9c41c8d8b79f32dfb8e0c735f12e2d59f5e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:40 +01:00
Edward Welbourne
3f0fda3783 tst_QDateTime::timeZone(): use QVERIFY() to test bool
Comparing to true and false doesn't enrich the output.

Change-Id: Ie26a3f3d584f88310b8d4a31cad07be8dc8cb646
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-07 14:58:39 +01:00
Marc Mutz
1c6bf3e09e Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:

    const std::string o = "object";

    auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };

    auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
        auto exprOfDeclaredType = [&](auto decl) {
            return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
        };
        return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
    };

    auto renameMethod = [&] (ArrayRef<StringRef> classes,
                            StringRef from, StringRef to) {
        return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
                            callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
                        changeTo(cat(access(o, cat(to)), "()")),
                        cat("use '", to, "' instead of '", from, "'"));
    };

    renameMethod(<classes>, "count", "size");
    renameMethod(<classes>, "length", "size");

except that the on() matcher has been replaced by one that doesn't
ignoreParens().

a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.

Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().

Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-03 14:59:24 +01:00
Edward Welbourne
2ffc36c24a tst_QTime: fix two duplicated test data tags
Names for data rows should be distinct.

Change-Id: I2ee1c4f362222d448278a90fc0a1cc9731e30976
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
565a827170 tst_QDateTime: eliminate some duplicate test-cases
Change-Id: I588494f2a79340599cafc48b3f4f4a79e6ca0a19
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
18439a449f Support serializing time-zone fields in date-times more flexibly
[ChangeLog][QtCore][QDateTime] The 't' format character in a
toString() template can now be repeated to get alternatives to the
(unparseable) zone abbreviation. Thus 'tt' now gets the zone offset
without colon, [+-]hhmm; 'ttt' gets the same with colon, [+-]hh:mm,
and 'tttt' gets the zone name. Previously, each 't' was replaced by
another copy of the abbreviation.

Task-number: QTBUG-95966
Change-Id: Iccccd11f06fa732ed27c0e5d4e40a3d4b5f79f8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 14:42:56 +02:00
Edward Welbourne
0bc92c01e3 Support parsing time-zone specifiers more selectively
[ChangeLog][QtCore][QDateTime] The 't' format used in fromString() can
now be repeated to restrict parsing to particular forms. Thus 'tt' now
matches the [+-]hhmm offset format (no colon), 'ttt' the [+-]hh:mm
offset format (with colon), and 'tttt' matches an actual zone
name. When used singly, 't' still matches anything the parser knows
how to interpret as a zone specifier.

[ChangeLog][QtCore][QLocale] The 't' format in toDateTime() now has
repeated forms, as for QDateTime::fromString().

Task-number: QTBUG-95966
Change-Id: I73753145cb66a56bc25a5c2dd5cb051ba982fa2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 14:42:55 +02:00
Edward Welbourne
6d10ecc699 Tidy up tst_QTimeZone
Its debug member can be set where it's declared, making the
constructor redundant.

Change-Id: Ic1195108766a6a86c3392a5bcf7f197ea31e8068
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-14 17:46:39 +02:00
Edward Welbourne
411b17150e Make time parsing accept zz as equivalent to z
Expand a test to cover millsecond format variants more thoroughly,
including a test for the new usage of zz. This applies to parsing the
complement to commit 0a36a7c1db173089c25ea09029505a589a1c59e5's change
to serialization. Fixed minor glitch in the serialization's doc, too.

[ChangeLog][QtCore][QDateTime] When parsing a datetime, the 'zz'
format specifier is now equivalent to 'z', as for serialization.

Change-Id: I1c5700064738d9c92d5e8ce10bff8050131e190f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-13 17:10:04 +02:00
Sona Kurazyan
b077c419ea Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.h
And include qcore_mac_p.h where needed.

Task-number: QTBUG-99313
Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-01 13:26:30 +02:00
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Tatiana Borisova
6a3509baa2 Put code related to timezone functionality under QT_CONFIG(timezone)
Pick-to: 6.4 6.3
Change-Id: I0d1573dbb4ae4f9740fc19546950ae4316aa4c0c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-18 18:05:09 +00:00
Marc Mutz
5ff7163796 qputenv: port to QByteArrayView
The vast majority of in-tree users pass simple and short C string
literals as the value. By porting to QByteArrayView, we document that
we'll accept non-NUL-terminated data, and do the NUL-termination
internally, using SSO'ed std::string, saving memory allocations in the
common case of short strings.

I didn't bother to check which direction std::string takes for
nullptrs these days (there was a change accepted in that area for
C++20 or 23), so play it safe and protect against them.

Follow-up to

Task-number: QTBUG-105302
Change-Id: I2369acc62f1d5cbc26135396cfe0602d8c75300c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-06 14:21:46 +00:00
Edward Welbourne
a9b46b79dd Rearrange the skipping of a test to give a better message
When tst_QDateTime::fromStringStringFormat_localTimeZone_data() skips
due to feature timezone being undefined, it should report that as the
issue, rather than claiming the system doesn't support the particular
zones used in the test.

Change-Id: I9837ac95c6d92317fbec7fcca184f7b7e6f81441
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-03 18:38:53 +02:00
Edward Welbourne
0a36a7c1db Make 'zz' format an alias for 'z' in time format strings
Also document the (seldom helpful) handling of over-long repeats of a
format. Add test to QDateTime and amend QLocale test.

[ChangeLog][QtCore][QDateTime] Doubling the 'z' format in a date-time
or time format string now produces the same output as a single 'z'.
Previously, this would have produced two copies of the milliseconds
field (eliding any trailing zeros in each). Contrast with 'zzz', which
produces the full milliseconds field, including any trailing zeros.

Change-Id: I4c60462b062fee4079370096d745c191c1939506
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-03 18:38:53 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Alexandru Croitor
4d22405e48 CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers
Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-28 14:46:53 +02:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00