summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring/tst_qstring.cpp
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/qstring/tst_qstring.cpp
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/qstring/tst_qstring.cpp')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp60
1 files changed, 31 insertions, 29 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index a51667e459..5d29b9c67e 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -69,10 +69,8 @@ public:
public slots:
void cleanup();
private slots:
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void fromStdString();
void toStdString();
-#endif
void check_QTextIOStream();
void check_QTextStream();
void check_QDataStream();
@@ -153,9 +151,7 @@ private slots:
void constructor();
void constructorQByteArray_data();
void constructorQByteArray();
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void STL();
-#endif
void isEmpty();
void isNull();
void acc_01();
@@ -196,10 +192,8 @@ private slots:
void integer_conversion();
void tortureSprintfDouble();
void toNum();
-#if !defined(Q_OS_MAC) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
void localeAwareCompare_data();
void localeAwareCompare();
-#endif
void split_data();
void split();
void split_regexp();
@@ -223,12 +217,8 @@ private slots:
void QTBUG10404_compareRef();
void QTBUG9281_arg_locale();
-#ifdef QT_USE_ICU
void toUpperLower_icu();
-#endif
-#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
void literals();
-#endif
void reserve();
void toHtmlEscaped_data();
@@ -818,10 +808,12 @@ void tst_QString::constructorQByteArray()
QCOMPARE( strBA, expected );
}
-// This test crashes on HP-UX with aCC.
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void tst_QString::STL()
{
+#ifdef Q_CC_HPACC
+ QSKIP("This test crashes on HP-UX with aCC");
+#endif
+#ifndef QT_NO_STL
#ifndef QT_NO_CAST_TO_ASCII
QString qt( "QString" );
@@ -868,8 +860,10 @@ void tst_QString::STL()
QCOMPARE(s, QString::fromLatin1("hello"));
QCOMPARE(stlStr, s.toStdWString());
#endif
-}
+#else
+ QSKIP( "Not tested without STL support");
#endif
+}
void tst_QString::truncate()
{
@@ -3082,10 +3076,12 @@ void tst_QString::setRawData()
QVERIFY(cstr.data_ptr() != csd);
}
-// This test crashes on HP-UX with aCC.
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void tst_QString::fromStdString()
{
+#ifdef Q_CC_HPACC
+ QSKIP("This test crashes on HP-UX with aCC");
+#endif
+#if !defined(QT_NO_STL)
std::string stroustrup = "foo";
QString eng = QString::fromStdString( stroustrup );
QCOMPARE( eng, QString("foo") );
@@ -3093,13 +3089,15 @@ void tst_QString::fromStdString()
std::string stdnull( cnull, sizeof(cnull)-1 );
QString qtnull = QString::fromStdString( stdnull );
QCOMPARE( qtnull.size(), int(stdnull.size()) );
-}
#endif
+}
-// This test crashes on HP-UX with aCC.
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void tst_QString::toStdString()
{
+#ifdef Q_CC_HPACC
+ QSKIP("This test crashes on HP-UX with aCC");
+#endif
+#if !defined(QT_NO_STL)
QString nord = "foo";
std::string stroustrup1 = nord.toStdString();
QVERIFY( qstrcmp(stroustrup1.c_str(), "foo") == 0 );
@@ -3113,8 +3111,8 @@ void tst_QString::toStdString()
QString qtnull( qcnull, sizeof(qcnull)/sizeof(QChar) );
std::string stdnull = qtnull.toStdString();
QCOMPARE( int(stdnull.size()), qtnull.size() );
-}
#endif
+}
void tst_QString::utf8()
{
@@ -4163,10 +4161,6 @@ void tst_QString::tortureSprintfDouble()
#include <locale.h>
-// Setting the locale is not supported on OS X (you can set the C locale,
-// but that won't affect CFStringCompare which is used to compare strings).
-// On Windows other than Win CE, we cannot set the system or user locale.
-#if !defined(Q_OS_MAC) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
void tst_QString::localeAwareCompare_data()
{
#ifdef Q_OS_WIN
@@ -4264,6 +4258,9 @@ void tst_QString::localeAwareCompare_data()
void tst_QString::localeAwareCompare()
{
#ifdef Q_OS_WIN
+# ifndef Q_OS_WINCE
+ QSKIP("On others than Win CE, we cannot set the system or user locale.");
+# endif
QFETCH(ulong, locale);
#else
QFETCH(QString, locale);
@@ -4288,6 +4285,8 @@ void tst_QString::localeAwareCompare()
QCOMPARE(locale, GetThreadLocale());
# endif
+#elif defined (Q_OS_MAC)
+ QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)");
#elif defined(QT_USE_ICU)
QLocale::setDefault(QLocale(locale));
#else
@@ -4362,7 +4361,6 @@ void tst_QString::localeAwareCompare()
setlocale(LC_ALL, "");
#endif
}
-#endif
void tst_QString::split_data()
{
@@ -5007,9 +5005,12 @@ void tst_QString::QTBUG9281_arg_locale()
QLocale::setDefault(QLocale::C);
}
-#ifdef QT_USE_ICU
void tst_QString::toUpperLower_icu()
{
+#ifndef QT_USE_ICU
+ QSKIP("Qt was built without ICU support");
+#endif
+
QString s = QString::fromLatin1("i");
QCOMPARE(s.toUpper(), QString::fromLatin1("I"));
@@ -5042,12 +5043,10 @@ void tst_QString::toUpperLower_icu()
// the cleanup function will restore the default locale
}
-#endif
-// Only tested on c++0x compliant compiler or gcc.
-#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
void tst_QString::literals()
{
+#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
QString str(QStringLiteral("abcd"));
QVERIFY(str.length() == 4);
@@ -5064,8 +5063,11 @@ void tst_QString::literals()
QVERIFY(str2.constData() == s);
QVERIFY(str2.data() != s);
-}
+
+#else
+ QSKIP("Only tested on c++0x compliant compiler or gcc");
#endif
+}
void tst_QString::reserve()
{