Fix failures in tst_qdatetime under non-english locales
QDateTime::toString uses the C locale since 5ba66c5622
So don't expect locale specific day- and month-names.
Task-number: QTBUG-80441
Change-Id: I08f53b6b33ed9e7eaaa58df4ca6a966c4ba9ef24
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
d263ab6af5
commit
348b86d976
@ -4019,8 +4019,7 @@ QString QDateTime::toString(Qt::DateFormat format) const
|
|||||||
If the datetime is invalid, an empty string will be returned.
|
If the datetime is invalid, an empty string will be returned.
|
||||||
|
|
||||||
\note If localized month and day names are desired, please switch to using
|
\note If localized month and day names are desired, please switch to using
|
||||||
QLocale::system().toString() as QDateTime methods shall change to use
|
QLocale::system().toString() as QDateTime methods use English (C locale) names.
|
||||||
English (C locale) names at Qt 6.
|
|
||||||
|
|
||||||
\sa fromString(), QDate::toString(), QTime::toString(), QLocale::toString()
|
\sa fromString(), QDate::toString(), QTime::toString(), QLocale::toString()
|
||||||
*/
|
*/
|
||||||
|
@ -892,8 +892,8 @@ void tst_QDateTime::toString_textDate_data()
|
|||||||
QTest::addColumn<QDateTime>("datetime");
|
QTest::addColumn<QDateTime>("datetime");
|
||||||
QTest::addColumn<QString>("expected");
|
QTest::addColumn<QString>("expected");
|
||||||
|
|
||||||
QString wednesdayJanuary = QLocale::system().dayName(3, QLocale::ShortFormat)
|
const QString wednesdayJanuary = QLocale::c().dayName(3, QLocale::ShortFormat)
|
||||||
+ ' ' + QLocale::system().monthName(1, QLocale::ShortFormat);
|
+ ' ' + QLocale::c().monthName(1, QLocale::ShortFormat);
|
||||||
|
|
||||||
QTest::newRow("localtime") << QDateTime(QDate(2013, 1, 2), QTime(1, 2, 3), Qt::LocalTime)
|
QTest::newRow("localtime") << QDateTime(QDate(2013, 1, 2), QTime(1, 2, 3), Qt::LocalTime)
|
||||||
<< wednesdayJanuary + QString(" 2 01:02:03 2013");
|
<< wednesdayJanuary + QString(" 2 01:02:03 2013");
|
||||||
|
Loading…
Reference in New Issue
Block a user