diff options
author | Zeno Albisser <zeno.albisser@nokia.com> | 2011-02-16 13:18:22 (GMT) |
---|---|---|
committer | Zeno Albisser <zeno.albisser@nokia.com> | 2011-02-22 11:54:16 (GMT) |
commit | aa9bc750eb72a180f15be144d2cc6621289f59f5 (patch) | |
tree | b562ff99bb9d7d201d75e66948c7dd9caab02a1b /tests/auto/qlocale | |
parent | 42ce38bc4db41ece082fba963f483a4ebfd78a01 (diff) | |
download | Qt-aa9bc750eb72a180f15be144d2cc6621289f59f5.zip Qt-aa9bc750eb72a180f15be144d2cc6621289f59f5.tar.gz Qt-aa9bc750eb72a180f15be144d2cc6621289f59f5.tar.bz2 |
Implemented QLocale::quoteString(...)
Reviewed-by: Denis Dzyubenko
Task-number: QTBUG-17096
Diffstat (limited to 'tests/auto/qlocale')
-rw-r--r-- | tests/auto/qlocale/tst_qlocale.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 3217e5e..250aac9 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -141,6 +141,7 @@ private slots: void ampm(); void currency(); + void quoteString(); private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; @@ -1122,6 +1123,8 @@ void tst_QLocale::macDefaultLocale() QCOMPARE(locale.dayName(7), QString("Sunday")); QCOMPARE(locale.monthName(1), QString("January")); QCOMPARE(locale.monthName(12), QString("December")); + QCOMPARE(locale.quoteString("string"), QString::fromUtf8("\xe2\x80\x9c" "string" "\xe2\x80\x9d")); + QCOMPARE(locale.quoteString("string", QLocale::AlternateQuotation), QString::fromUtf8("\xe2\x80\x98" "string" "\xe2\x80\x99")); } @@ -2153,5 +2156,18 @@ void tst_QLocale::currency() QCOMPARE(de_DE.toCurrencyString(double(-1234.56)), QString::fromUtf8("-1234,56\xc2\xa0\xe2\x82\xac")); } +void tst_QLocale::quoteString() +{ + const QString someText("text"); + const QLocale c(QLocale::C); + QCOMPARE(c.quoteString(someText), QString::fromUtf8("\x22" "text" "\x22")); + QCOMPARE(c.quoteString(someText, QLocale::AlternateQuotation), QString::fromUtf8("\x27" "text" "\x27")); + + const QLocale de_CH("de_CH"); + QCOMPARE(de_CH.quoteString(someText), QString::fromUtf8("\xc2\xab" "text" "\xc2\xbb")); + QCOMPARE(de_CH.quoteString(someText, QLocale::AlternateQuotation), QString::fromUtf8("\xe2\x80\xb9" "text" "\xe2\x80\xba")); + +} + QTEST_APPLESS_MAIN(tst_QLocale) #include "tst_qlocale.moc" |