summaryrefslogtreecommitdiffstats
path: root/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp')
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp108
1 files changed, 62 insertions, 46 deletions
diff --git a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
index 84ebd46886..bd55446515 100644
--- a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
+++ b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
@@ -63,18 +63,6 @@ void tst_QtConcurrentFilter::filter()
QCOMPARE(list, QList<int>() << 2 << 4);
}
{
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::filter(linkedList, KeepEvenIntegers()).waitForFinished();
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::blockingFilter(linkedList, KeepEvenIntegers());
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
- {
QVector<int> vector;
vector << 1 << 2 << 3 << 4;
QtConcurrent::filter(vector, KeepEvenIntegers()).waitForFinished();
@@ -100,18 +88,6 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, keepEvenIntegers);
QCOMPARE(list, QList<int>() << 2 << 4);
}
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::filter(linkedList, keepEvenIntegers).waitForFinished();
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::blockingFilter(linkedList, keepEvenIntegers);
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
// bound function
{
@@ -126,6 +102,40 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, keepEvenIntegers);
QCOMPARE(list, QList<int>() << 2 << 4);
}
+
+ // member
+ {
+ QList<Number> list;
+ list << 1 << 2 << 3 << 4;
+ QtConcurrent::filter(list, &Number::isEven).waitForFinished();
+ QCOMPARE(list, QList<Number>() << 2 << 4);
+ }
+ {
+ QList<Number> list;
+ list << 1 << 2 << 3 << 4;
+ QtConcurrent::blockingFilter(list, &Number::isEven);
+ QCOMPARE(list, QList<Number>() << 2 << 4);
+ }
+
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
+ // functor
+ {
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3 << 4;
+ QtConcurrent::filter(linkedList, KeepEvenIntegers()).waitForFinished();
+ QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
+ }
+ {
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3 << 4;
+ QtConcurrent::blockingFilter(linkedList, KeepEvenIntegers());
+ QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
+ }
+
+ // function
{
QLinkedList<int> linkedList;
linkedList << 1 << 2 << 3 << 4;
@@ -139,19 +149,21 @@ void tst_QtConcurrentFilter::filter()
QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
}
- // member
+ // bound function
{
- QList<Number> list;
- list << 1 << 2 << 3 << 4;
- QtConcurrent::filter(list, &Number::isEven).waitForFinished();
- QCOMPARE(list, QList<Number>() << 2 << 4);
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3 << 4;
+ QtConcurrent::filter(linkedList, keepEvenIntegers).waitForFinished();
+ QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
}
{
- QList<Number> list;
- list << 1 << 2 << 3 << 4;
- QtConcurrent::blockingFilter(list, &Number::isEven);
- QCOMPARE(list, QList<Number>() << 2 << 4);
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3 << 4;
+ QtConcurrent::blockingFilter(linkedList, keepEvenIntegers);
+ QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
}
+
+ // member
{
QLinkedList<Number> linkedList;
linkedList << 1 << 2 << 3 << 4;
@@ -164,6 +176,9 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(linkedList, &Number::isEven);
QCOMPARE(linkedList, QLinkedList<Number>() << 2 << 4);
}
+
+QT_WARNING_POP
+#endif
}
void tst_QtConcurrentFilter::filtered()
@@ -219,19 +234,6 @@ void tst_QtConcurrentFilter::filtered()
QCOMPARE(f.results(), QList<int>() << 2 << 4);
}
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered(linkedList, KeepEvenIntegers());
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QFuture<int> f = QtConcurrent::filtered(linkedList, KeepEvenIntegers());
- QCOMPARE(f.results(), QList<int>() << 2 << 4);
- }
-
// function
{
QFuture<int> f = QtConcurrent::filtered(list, keepEvenIntegers);
@@ -352,6 +354,10 @@ void tst_QtConcurrentFilter::filtered()
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
// same thing on linked lists
QLinkedList<int> linkedList;
@@ -517,6 +523,9 @@ void tst_QtConcurrentFilter::filtered()
&Number::isEven);
QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
}
+
+QT_WARNING_POP
+#endif
}
void tst_QtConcurrentFilter::filteredReduced()
@@ -952,6 +961,10 @@ void tst_QtConcurrentFilter::filteredReduced()
QCOMPARE(sum, 6);
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
// same as above on linked lists
QLinkedList<int> linkedList;
linkedList << 1 << 2 << 3 << 4;
@@ -1378,6 +1391,9 @@ void tst_QtConcurrentFilter::filteredReduced()
QCOMPARE(sum, 6);
}
+QT_WARNING_POP
+#endif
+
// ### the same as above, with an initial result value
}