summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-08-06 12:29:56 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-09-02 14:13:07 +0200
commitef504af2d7e24df215a8a6ce6ed2cd60d0ce2a8f (patch)
tree18bd17b991693dcfbd5b9fcb16e18d14ce8cdc0a /tests
parentcd3bf862f7c749dd6e7d8b27b248ec4b24b1e514 (diff)
qlocale_win: Fix non-standalone month names
We have previously been using the standalong (nominative) month names both when asked for that and when asked for the plain (genitive) month name, probably because there was no LCTYPE value for the latter. However, MS's docs for the standalone values do contain a comment telling us how to get the genitive names. Rename the old monthName() to standaloneMonthName() and add a monthName() that calls GetDateFormat() suitably, as described by the MS doc. Fixes: QTBUG-92018 Fixes: QTBUG-86279 Change-Id: I27f63198c3a15b792683f476d2019078b0860f99 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 38ec2c830b849ad44ca7e16bd9c4722e0bcdb61f)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index 43698e5a19..33fcb156b6 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -2477,6 +2477,10 @@ void tst_QLocale::dateFormat()
const QLocale ir("ga_IE");
QCOMPARE(ir.dateFormat(QLocale::ShortFormat), QLatin1String("dd/MM/yyyy"));
+
+ const auto sys = QLocale::system(); // QTBUG-92018, ru_RU on MS
+ const QDate date(2021, 3, 17);
+ QCOMPARE(sys.toString(date, sys.dateFormat(QLocale::LongFormat)), sys.toString(date));
}
void tst_QLocale::timeFormat()
@@ -2535,18 +2539,21 @@ void tst_QLocale::monthName()
// 'de' locale doesn't have narrow month name
QCOMPARE(de.monthName(12, QLocale::NarrowFormat), QLatin1String("D"));
- QLocale ru("ru_RU");
+ const QLocale ru("ru_RU");
QCOMPARE(ru.monthName(1, QLocale::LongFormat),
QString::fromUtf8("\321\217\320\275\320\262\320\260\321\200\321\217"));
QCOMPARE(ru.monthName(1, QLocale::ShortFormat),
QString::fromUtf8("\321\217\320\275\320\262\56"));
QCOMPARE(ru.monthName(1, QLocale::NarrowFormat), QString::fromUtf8("\320\257"));
+ const auto sys = QLocale::system();
+ if (sys.language() == QLocale::Russian) // QTBUG-92018
+ QVERIFY(sys.monthName(3) != sys.standaloneMonthName(3));
- QLocale ir("ga_IE");
+ const QLocale ir("ga_IE");
QCOMPARE(ir.monthName(1, QLocale::ShortFormat), QLatin1String("Ean"));
QCOMPARE(ir.monthName(12, QLocale::ShortFormat), QLatin1String("Noll"));
- QLocale cz("cs_CZ");
+ const QLocale cz("cs_CZ");
QCOMPARE(cz.monthName(1, QLocale::ShortFormat), QLatin1String("led"));
QCOMPARE(cz.monthName(12, QLocale::ShortFormat), QLatin1String("pro"));
}