summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qlocale
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/corelib/tools/qlocale
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qlocale')
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index dfcce2683e..b65cd44308 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -83,17 +83,11 @@ public:
tst_QLocale();
private slots:
-#ifdef Q_OS_WIN
void windowsDefaultLocale();
-#endif
-#ifdef Q_OS_MAC
void macDefaultLocale();
-#endif
void ctor();
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void emptyCtor();
-#endif
void unixLocaleName();
void double_conversion_data();
void double_conversion();
@@ -360,10 +354,14 @@ void tst_QLocale::ctor()
#undef TEST_CTOR
}
-// Uses unsupported Windows CE QProcess functionality (std streams, env).
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QLocale::emptyCtor()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Uses unsupported Windows CE QProcess functionality (std streams, env)");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
#define TEST_CTOR(req_lc, exp_str) \
{ \
/* Test constructor without arguments. Needs separate process */ \
@@ -434,8 +432,8 @@ void tst_QLocale::emptyCtor()
TEST_CTOR("123456", defaultLoc);
#undef TEST_CTOR
-}
#endif
+}
void tst_QLocale::unixLocaleName()
{
@@ -1069,9 +1067,12 @@ void tst_QLocale::toDateTime()
QCOMPARE(l.toDateTime(string, QLocale::LongFormat), result);
}
-#ifdef Q_OS_MAC
void tst_QLocale::macDefaultLocale()
{
+#ifndef Q_OS_MAC
+ QSKIP("This is a Mac OS X-only test");
+#endif
+
QLocale locale = QLocale::system();
if (locale.name() != QLatin1String("en_US"))
QSKIP("This test only tests for en_US");
@@ -1147,8 +1148,8 @@ void tst_QLocale::macDefaultLocale()
QList<Qt::DayOfWeek> days;
days << Qt::Monday << Qt::Tuesday << Qt::Wednesday << Qt::Thursday << Qt::Friday;
QCOMPARE(locale.weekdays(), days);
+
}
-#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -1203,11 +1204,14 @@ public:
QString m_decimal, m_thousand, m_sdate, m_ldate, m_time;
};
+
#endif
-#ifdef Q_OS_WIN
void tst_QLocale::windowsDefaultLocale()
{
+#ifndef Q_OS_WIN
+ QSKIP("This is a Windows test");
+#else
RestoreLocaleHelper systemLocale;
// set weird system defaults and make sure we're using them
setWinLocaleInfo(LOCALE_SDECIMAL, QLatin1String("@"));
@@ -1242,8 +1246,8 @@ void tst_QLocale::windowsDefaultLocale()
QCOMPARE(locale.toString(QDateTime(QDate(1974, 12, 1), QTime(1,2,3)), QLocale::LongFormat),
QString("1@12@1974 1^2^3"));
QCOMPARE(locale.toString(QTime(1,2,3), QLocale::LongFormat), QString("1^2^3"));
-}
#endif
+}
void tst_QLocale::numberOptions()
{