diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-04-11 18:06:11 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-12 10:39:22 +0200 |
commit | 1035c93245ef299c2f29be5b119b736430e81dc3 (patch) | |
tree | baee9d1c9d1edf1ba8d73f60c7d88081e4301a73 /tests/auto/corelib/tools/qstringlist | |
parent | 3127f23e3aded5cd70440e401e0915f5d6112329 (diff) |
make QStringList::sort() to take a Qt::CaseSensitivity param
Task-number: QTBUG-12892
Change-Id: I402e6fb12ff24ac26c5a8103bf81547946f9cc58
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qstringlist')
-rw-r--r-- | tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index d02e649bdf..16a329f1dd 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp @@ -44,10 +44,13 @@ #include <qregularexpression.h> #include <qstringlist.h> +#include <locale.h> + class tst_QStringList : public QObject { Q_OBJECT private slots: + void sort(); void filter(); void replaceInStrings(); void removeDuplicates(); @@ -199,6 +202,23 @@ void tst_QStringList::filter() QCOMPARE( list5, list6 ); } +void tst_QStringList::sort() +{ + QStringList list1, list2; + list1 << "alpha" << "beta" << "BETA" << "gamma" << "Gamma" << "gAmma" << "epsilon"; + list1.sort(); + list2 << "BETA" << "Gamma" << "alpha" << "beta" << "epsilon" << "gAmma" << "gamma"; + QCOMPARE( list1, list2 ); + + char *current_locale = setlocale(LC_ALL, "C"); + QStringList list3, list4; + list3 << "alpha" << "beta" << "BETA" << "gamma" << "Gamma" << "gAmma" << "epsilon"; + list3.sort(Qt::CaseInsensitive); + list4 << "alpha" << "beta" << "BETA" << "epsilon" << "Gamma" << "gAmma" << "gamma"; + QCOMPARE( list3, list4 ); + setlocale(LC_ALL, current_locale); +} + void tst_QStringList::replaceInStrings() { QStringList list1, list2; |