summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-10-04 11:51:31 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-05 03:04:31 +0200
commit7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 (patch)
tree5df8fca668dace17eea7b6c5ed82db8e87180105 /tests/auto/corelib/tools/qstring
parentc46f59fadf63b661d8611e5896f09fb85c17a00c (diff)
Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9 Reviewed-on: http://codereview.qt-project.org/5942 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qstring')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp60
1 files changed, 29 insertions, 31 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index dc912f786e..fdfc5e1f2e 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -74,8 +74,10 @@ public slots:
void init();
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();
@@ -156,7 +158,9 @@ 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();
@@ -197,8 +201,10 @@ 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();
@@ -222,8 +228,12 @@ 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();
@@ -823,12 +833,10 @@ 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", SkipSingle);
-#endif
-#ifndef QT_NO_STL
#ifndef QT_NO_CAST_TO_ASCII
QString qt( "QString" );
@@ -877,10 +885,8 @@ void tst_QString::STL()
QCOMPARE(s, QString::fromLatin1("hello"));
QCOMPARE(stlStr, s.toStdWString());
#endif
-#else
- QSKIP( "Not tested without STL support", SkipAll);
-#endif
}
+#endif
void tst_QString::truncate()
{
@@ -3142,12 +3148,10 @@ 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", SkipSingle);
-#endif
-#if !defined(QT_NO_STL)
std::string stroustrup = "foo";
QString eng = QString::fromStdString( stroustrup );
QCOMPARE( eng, QString("foo") );
@@ -3155,15 +3159,13 @@ void tst_QString::fromStdString()
std::string stdnull( cnull, sizeof(cnull)-1 );
QString qtnull = QString::fromStdString( stdnull );
QCOMPARE( qtnull.size(), int(stdnull.size()) );
-#endif
}
+#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", SkipSingle);
-#endif
-#if !defined(QT_NO_STL)
QString nord = "foo";
std::string stroustrup1 = nord.toStdString();
QVERIFY( qstrcmp(stroustrup1.c_str(), "foo") == 0 );
@@ -3177,8 +3179,8 @@ void tst_QString::toStdString()
QString qtnull( qcnull, sizeof(qcnull)/sizeof(QChar) );
std::string stdnull = qtnull.toStdString();
QCOMPARE( int(stdnull.size()), qtnull.size() );
-#endif
}
+#endif
void tst_QString::utf8()
{
@@ -4228,6 +4230,10 @@ 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
@@ -4325,9 +4331,6 @@ 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.", SkipAll);
-# endif
QFETCH(ulong, locale);
#else
QFETCH(QString, locale);
@@ -4352,8 +4355,6 @@ 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)", SkipAll);
#elif defined(QT_USE_ICU)
QLocale::setDefault(QLocale(locale));
#else
@@ -4429,6 +4430,7 @@ void tst_QString::localeAwareCompare()
setlocale(LC_ALL, "");
#endif
}
+#endif
void tst_QString::split_data()
{
@@ -5073,12 +5075,9 @@ 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", SkipAll);
-#endif
-
QString s = QString::fromLatin1("i");
QCOMPARE(s.toUpper(), QString::fromLatin1("I"));
@@ -5111,10 +5110,12 @@ 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);
@@ -5131,11 +5132,8 @@ void tst_QString::literals()
QVERIFY(str2.constData() == s);
QVERIFY(str2.data() != s);
-
-#else
- QSKIP("Only tested on c++0x compliant compiler or gcc", SkipAll);
-#endif
}
+#endif
void tst_QString::reserve()
{