summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2012-06-19 11:19:28 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-26 04:03:48 +0200
commitbf05abddfd542a0568138d533d1f401d32b65e8c (patch)
tree783b1f5ebe5e3d5ba22f99e55f15287ee8fe3915
parent5fe1574725830e56aa37875e82936459d0802830 (diff)
Fix qstringlist autotest build for WinCE.
WinCE does not have setlocale, used SetUserDefaultLCID correspondingly as it is done in qstring autotest for WEC7. Change-Id: I7866bf0f365c7c6efbf3b439cdd9a281c6a1b2e0 Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
-rw-r--r--tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
index 4763f11c48..2c4ec62936 100644
--- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
@@ -45,6 +45,9 @@
#include <qstringlist.h>
#include <locale.h>
+#ifdef Q_OS_WINCE
+#include <windows.h> // needed for GetUserDefaultLCID
+#endif
class tst_QStringList : public QObject
{
@@ -212,13 +215,23 @@ void tst_QStringList::sort()
list2 << "BETA" << "Gamma" << "alpha" << "beta" << "epsilon" << "gAmma" << "gamma";
QCOMPARE( list1, list2 );
+#ifdef Q_OS_WINCE
+ DWORD oldLcid = GetUserDefaultLCID();
+ // Assume c locale to be english
+ SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
+#else
char *current_locale = setlocale(LC_ALL, "C");
+#endif
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 );
+#ifdef Q_OS_WINCE
+ SetUserDefaultLCID(oldLcid);
+#else
setlocale(LC_ALL, current_locale);
+#endif
}
void tst_QStringList::replaceInStrings()