diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-01-17 11:00:24 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-14 14:52:08 +0200 |
commit | bb6a73260ec8272647265f42180963604ad0f755 (patch) | |
tree | a85d2f1f0a2e11eaa9ed8dcb2e7d3032faa4acf2 /tests/auto/corelib/text | |
parent | 19ed60d703f9071d183760a8ce1c50009c780bf8 (diff) |
Support digit-grouping correctly
Read three more values from CLDR and add a byte to the bit-fields at
the end of QLocaleData, indicating the three group sizes. This adds
three new parameters to various low-level formatting functions. At the
same time, rename ThousandsGroup to GroupDigits, more faithfully
expressing what this (internal) option means.
This replaces commit 27d139128013c969a939779536485c1a80be977e with a
fuller implementation that handles digit-grouping in any of the ways
that CLDR supports. The formerly "Indian" formatting now also applies
to at least some locales for Bangladesh, Bhutan and Sri Lanka.
Fixed Costa Rica currency formatting test that wrongly put a separator
after the first digit; the locale (in common with several Spanish
locales) requires at least two digits before the first separator.
[ChangeLog][QtCore][Important Behavior Changes] Some locales require
more than one digit before the first grouping separator; others use
group sizes other than three. The latter was partially supported (only
for India) at 5.15 but is now systematically supported; the former is
now also supported.
Task-number: QTBUG-24301
Fixes: QTBUG-81050
Change-Id: I4ea4e331f3254d1f34801cddf51f3c65d3815573
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text')
-rw-r--r-- | tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 551d63c269..1d43e35959 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -2682,7 +2682,9 @@ void tst_QLocale::currency() const QLocale es_CR(QLocale::Spanish, QLocale::CostaRica); QCOMPARE(es_CR.toCurrencyString(double(1565.25)), - QString::fromUtf8("\xE2\x82\xA1" "1\xC2\xA0" "565,25")); + QString::fromUtf8("\xE2\x82\xA1" "1565,25")); + QCOMPARE(es_CR.toCurrencyString(double(12565.25)), + QString::fromUtf8("\xE2\x82\xA1" "12\xC2\xA0" "565,25")); const QLocale system = QLocale::system(); QVERIFY(system.toCurrencyString(1, QLatin1String("FOO")).contains(QLatin1String("FOO"))); @@ -3135,9 +3137,7 @@ void tst_QLocale::numberGroupingIndia() void tst_QLocale::numberFormatChakma() { - // Initially India's flavour, since the number formatting is currently only - // done right for India. Should change to Bangladesh once that's fixed. - const QLocale chakma(QLocale::Chakma, QLocale::ChakmaScript, QLocale::India); + const QLocale chakma(QLocale::Chakma, QLocale::ChakmaScript, QLocale::Bangladesh); const uint zeroVal = 0x11136; // Unicode's representation of Chakma zero const QChar data[] = { QChar::highSurrogate(zeroVal), QChar::lowSurrogate(zeroVal), |