Test: remove QSKIP from tst_qtconcurrent
Instead omit the whole tests when appropriate. Change-Id: I3a22d010b658e54d7d234b786173c62977a50c7d Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
parent
048b697c07
commit
c5ec39b6cc
@ -60,8 +60,12 @@ private slots:
|
|||||||
#ifndef QT_NO_EXCEPTIONS
|
#ifndef QT_NO_EXCEPTIONS
|
||||||
void exceptions();
|
void exceptions();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Q_COMPILER_DECLTYPE
|
||||||
void functor();
|
void functor();
|
||||||
|
#endif
|
||||||
|
#ifdef Q_COMPILER_LAMBDA
|
||||||
void lambda();
|
void lambda();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void light()
|
void light()
|
||||||
@ -398,6 +402,8 @@ void tst_QtConcurrentRun::exceptions()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_COMPILER_DECLTYPE
|
||||||
|
// Compiler supports decltype
|
||||||
struct Functor {
|
struct Functor {
|
||||||
int operator()() { return 42; }
|
int operator()() { return 42; }
|
||||||
double operator()(double a, double b) { return a/b; }
|
double operator()(double a, double b) { return a/b; }
|
||||||
@ -412,9 +418,6 @@ struct Functor {
|
|||||||
// This tests functor without result_type; decltype need to be supported by the compiler.
|
// This tests functor without result_type; decltype need to be supported by the compiler.
|
||||||
void tst_QtConcurrentRun::functor()
|
void tst_QtConcurrentRun::functor()
|
||||||
{
|
{
|
||||||
#ifndef Q_COMPILER_DECLTYPE
|
|
||||||
QSKIP("Compiler does not support decltype");
|
|
||||||
#else
|
|
||||||
Functor f;
|
Functor f;
|
||||||
{
|
{
|
||||||
QFuture<int> fut = QtConcurrent::run(f);
|
QFuture<int> fut = QtConcurrent::run(f);
|
||||||
@ -435,14 +438,13 @@ void tst_QtConcurrentRun::functor()
|
|||||||
QtConcurrent::run(f, 1,2,3,4).waitForFinished();
|
QtConcurrent::run(f, 1,2,3,4).waitForFinished();
|
||||||
QtConcurrent::run(f, 1,2,3,4,5).waitForFinished();
|
QtConcurrent::run(f, 1,2,3,4,5).waitForFinished();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_COMPILER_LAMBDA
|
||||||
|
// Compiler supports lambda
|
||||||
void tst_QtConcurrentRun::lambda()
|
void tst_QtConcurrentRun::lambda()
|
||||||
{
|
{
|
||||||
#ifndef Q_COMPILER_LAMBDA
|
|
||||||
QSKIP("Compiler does not support lambda");
|
|
||||||
#else
|
|
||||||
QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45);
|
QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45);
|
||||||
QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15);
|
QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15);
|
||||||
QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
|
QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
|
||||||
@ -456,8 +458,8 @@ void tst_QtConcurrentRun::lambda()
|
|||||||
QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
|
QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QTEST_MAIN(tst_QtConcurrentRun)
|
QTEST_MAIN(tst_QtConcurrentRun)
|
||||||
#include "tst_qtconcurrentrun.moc"
|
#include "tst_qtconcurrentrun.moc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user