diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-02-25 15:08:57 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-02-25 17:51:26 (GMT) |
commit | 0c2ec3cef9f0a91b08d5103ac0bafd173f2a20df (patch) | |
tree | 76f7d93f5babfaae6fbeef8f62f26866c8b4108f /tests/auto/qlocale | |
parent | 08868df5e94a5b89d9f8ce904e97b43a48313fc1 (diff) | |
download | Qt-0c2ec3cef9f0a91b08d5103ac0bafd173f2a20df.zip Qt-0c2ec3cef9f0a91b08d5103ac0bafd173f2a20df.tar.gz Qt-0c2ec3cef9f0a91b08d5103ac0bafd173f2a20df.tar.bz2 |
Improved currency value to string conversion in QLocale.
Added a second, optional, argument to QLocale::toCurrencyString() that
represents a currency symbol that is supposed to be added to the formatted
string.
Task-number: QTBUG-17100
Reviewed-by: Zeno Albisser
Reviewed-by: Olivier Goffart
Diffstat (limited to 'tests/auto/qlocale')
-rw-r--r-- | tests/auto/qlocale/tst_qlocale.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index d1b7193..7a3e339 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -2159,9 +2159,15 @@ void tst_QLocale::currency() const QLocale de_DE("de_DE"); QCOMPARE(de_DE.toCurrencyString(qulonglong(1234)), QString::fromUtf8("1234\xc2\xa0\xe2\x82\xac")); + QCOMPARE(de_DE.toCurrencyString(qulonglong(1234), QLatin1String("BAZ")), QString::fromUtf8("1234\xc2\xa0" "BAZ")); QCOMPARE(de_DE.toCurrencyString(qlonglong(-1234)), QString::fromUtf8("-1234\xc2\xa0\xe2\x82\xac")); + QCOMPARE(de_DE.toCurrencyString(qlonglong(-1234), QLatin1String("BAZ")), QString::fromUtf8("-1234\xc2\xa0" "BAZ")); QCOMPARE(de_DE.toCurrencyString(double(1234.56)), QString::fromUtf8("1234,56\xc2\xa0\xe2\x82\xac")); QCOMPARE(de_DE.toCurrencyString(double(-1234.56)), QString::fromUtf8("-1234,56\xc2\xa0\xe2\x82\xac")); + QCOMPARE(de_DE.toCurrencyString(double(-1234.56), QLatin1String("BAZ")), QString::fromUtf8("-1234,56\xc2\xa0" "BAZ")); + + const QLocale system = QLocale::system(); + QVERIFY(system.toCurrencyString(1, QLatin1String("FOO")).contains(QLatin1String("FOO"))); } void tst_QLocale::quoteString() |