summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-03-04 15:21:40 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-03-06 09:50:35 +0100
commit249a2e3271c3cc36edb88c993d277d93de2cf1c0 (patch)
tree1ccbc0c79da459d8ada8a399129b92c3589f2b97
parent1a9c29289a76454e8b361430dd7f025f8fdc3061 (diff)
Disable warnings for the deprecated QLinkedList
QLinkedList has been deprecated, but we still need to test it. Suppress the warnings for QLinkedList used in tests. Note, that I had to move some of the test code, to avoid repeating QT_WARNING_PUSH/QT_WARNING_POP everywhere. Change-Id: I4203b3ef50045c4f45475a08638dbdc60f68761d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp108
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp1201
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp5
-rw-r--r--tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp87
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp52
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp50
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp15
7 files changed, 908 insertions, 610 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
}
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 383de0b2ce..ad62f6cdf1 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -164,6 +164,9 @@ void tst_QtConcurrentMap::map()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
// Linked lists and forward iterators
{
QLinkedList<int> list;
@@ -195,6 +198,8 @@ void tst_QtConcurrentMap::map()
QtConcurrent::map(numberList.begin(), numberList.end(), &Number::multiplyBy2).waitForFinished();
QCOMPARE(numberList, QLinkedList<Number>() << 4 << 8 << 12);
}
+QT_WARNING_POP
+#endif
#if 0
// not allowed: map() with immutable sequences makes no sense
@@ -296,6 +301,9 @@ void tst_QtConcurrentMap::blocking_map()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
// Linked lists and forward iterators
{
QLinkedList<int> list;
@@ -327,6 +335,8 @@ void tst_QtConcurrentMap::blocking_map()
QtConcurrent::blockingMap(numberList.begin(), numberList.end(), &Number::multiplyBy2);
QCOMPARE(numberList, QLinkedList<Number>() << 4 << 8 << 12);
}
+QT_WARNING_POP
+#endif
#if 0
// not allowed: map() with immutable sequences makes no sense
@@ -424,12 +434,8 @@ void tst_QtConcurrentMap::mapped()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// functor
{
@@ -447,22 +453,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QList<int> list2 = QtConcurrent::mapped(linkedList, MultiplyBy2()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
-
- QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- MultiplyBy2()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
-
- QList<int> list4 =
- QtConcurrent::mapped(QLinkedList<int>(linkedList), MultiplyBy2()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
- }
// function
{
@@ -480,22 +470,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QList<int> list2 = QtConcurrent::mapped(linkedList, multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
-
- QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
-
- QList<int> list4 =
- QtConcurrent::mapped(QLinkedList<int>(linkedList), multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
- }
// bound function
{
@@ -513,23 +487,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QList<int> list2 = QtConcurrent::mapped(linkedList, multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
-
- QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
-
- QList<int> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList), multiplyBy2)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
- }
// const member function
{
@@ -551,25 +508,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(numberList, QList<Number>() << 1 << 2 << 3);
QCOMPARE(numberList4, QList<Number>() << 2 << 4 << 6);
}
- {
- QList<Number> numberList2 = QtConcurrent::mapped(numberLinkedList, &Number::multipliedBy2)
- .results();
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberList2, QList<Number>() << 2 << 4 << 6);
-
- QList<Number> numberList3 = QtConcurrent::mapped(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::multipliedBy2)
- .results();
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberList3, QList<Number>() << 2 << 4 << 6);
-
- QList<Number> numberList4 = QtConcurrent::mapped(QLinkedList<Number>(numberLinkedList),
- &Number::multipliedBy2)
- .results();
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberList4, QList<Number>() << 2 << 4 << 6);
- }
// change the value_type, same container
@@ -592,24 +530,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QList<double> list2 = QtConcurrent::mapped(linkedList, IntToDouble()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- IntToDouble())
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList),
- IntToDouble())
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
- }
// function
{
@@ -628,23 +548,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QList<double> list2 = QtConcurrent::mapped(linkedList, intToDouble).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList), intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
- }
// bound function
{
@@ -666,25 +569,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QList<double> list2 = QtConcurrent::mapped(linkedList, intToDouble).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
-
-
- QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList),
- intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
- }
// const member function
{
@@ -704,24 +588,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<QString>() << "1" << "2" << "3");
}
- {
- QList<QString> list2 = QtConcurrent::mapped(numberLinkedList, &Number::toString).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<QString>() << "1" << "2" << "3");
-
- QList<QString> list3 = QtConcurrent::mapped(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toString)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<QString>() << "1" << "2" << "3");
-
- QList<QString> list4 = QtConcurrent::mapped(QLinkedList<Number>(numberLinkedList),
- &Number::toString)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<QString>() << "1" << "2" << "3");
- }
// change the value_type
{
@@ -780,18 +646,183 @@ void tst_QtConcurrentMap::mapped()
.results();
QCOMPARE(list2, QList<int>() << 1 << 2 << 3);
}
+
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3;
+ QLinkedList<Number> numberLinkedList;
+ numberLinkedList << 1 << 2 << 3;
+
+ // functor
+ {
+ QList<int> list2 = QtConcurrent::mapped(linkedList, MultiplyBy2()).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
+
+ QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
+ linkedList.constEnd(),
+ MultiplyBy2()).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
+
+ QList<int> list4 =
+ QtConcurrent::mapped(QLinkedList<int>(linkedList), MultiplyBy2()).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
+ }
+
+ // function
+ {
+ QList<int> list2 = QtConcurrent::mapped(linkedList, multiplyBy2).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
+
+ QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
+ linkedList.constEnd(),
+ multiplyBy2).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
+
+ QList<int> list4 =
+ QtConcurrent::mapped(QLinkedList<int>(linkedList), multiplyBy2).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
+ }
+
+ // bound function
+ {
+ QList<int> list2 = QtConcurrent::mapped(linkedList, multiplyBy2).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
+
+ QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
+ linkedList.constEnd(),
+ multiplyBy2)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
+
+ QList<int> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList), multiplyBy2)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
+ }
+
+ // const member function
+ {
+ QList<Number> numberList2 = QtConcurrent::mapped(numberLinkedList, &Number::multipliedBy2)
+ .results();
+ QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
+ QCOMPARE(numberList2, QList<Number>() << 2 << 4 << 6);
+
+ QList<Number> numberList3 = QtConcurrent::mapped(numberLinkedList.constBegin(),
+ numberLinkedList.constEnd(),
+ &Number::multipliedBy2)
+ .results();
+ QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
+ QCOMPARE(numberList3, QList<Number>() << 2 << 4 << 6);
+
+ QList<Number> numberList4 = QtConcurrent::mapped(QLinkedList<Number>(numberLinkedList),
+ &Number::multipliedBy2)
+ .results();
+ QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
+ QCOMPARE(numberList4, QList<Number>() << 2 << 4 << 6);
+ }
+
+ // change the value_type, same container
+
+ // functor
+ {
+ QList<double> list2 = QtConcurrent::mapped(linkedList, IntToDouble()).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
+
+ QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
+ linkedList.constEnd(),
+ IntToDouble())
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
+
+ QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList),
+ IntToDouble())
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
+ }
+
+ // function
+ {
+ QList<double> list2 = QtConcurrent::mapped(linkedList, intToDouble).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
+
+ QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intToDouble)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
+
+ QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList), intToDouble)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
+ }
+
+ // bound function
+ {
+ QList<double> list2 = QtConcurrent::mapped(linkedList, intToDouble).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
+
+ QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intToDouble)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
+
+
+ QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList),
+ intToDouble)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
+ }
+
+ // const member function
+ {
+ QList<QString> list2 = QtConcurrent::mapped(numberLinkedList, &Number::toString).results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<QString>() << "1" << "2" << "3");
+
+ QList<QString> list3 = QtConcurrent::mapped(numberLinkedList.constBegin(),
+ numberLinkedList.constEnd(),
+ &Number::toString)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<QString>() << "1" << "2" << "3");
+
+ QList<QString> list4 = QtConcurrent::mapped(QLinkedList<Number>(numberLinkedList),
+ &Number::toString)
+ .results();
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<QString>() << "1" << "2" << "3");
+ }
+QT_WARNING_POP
+#endif
}
void tst_QtConcurrentMap::blocking_mapped()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// functor
{
@@ -809,21 +840,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, MultiplyBy2());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- MultiplyBy2());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), MultiplyBy2());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
- }
// function
{
@@ -841,21 +857,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
- }
// bound function
{
@@ -873,21 +874,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
- }
// const member function
{
@@ -906,22 +892,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(numberList, QList<Number>() << 1 << 2 << 3);
QCOMPARE(numberList4, QList<Number>() << 2 << 4 << 6);
}
- {
- QLinkedList<Number> numberLinkedList2 = QtConcurrent::blockingMapped(numberLinkedList, &Number::multipliedBy2);
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberLinkedList2, QLinkedList<Number>() << 2 << 4 << 6);
-
- QLinkedList<Number> numberLinkedList3 = QtConcurrent::blockingMapped<QLinkedList<Number> >(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::multipliedBy2);
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberLinkedList3, QLinkedList<Number>() << 2 << 4 << 6);
-
- QLinkedList<Number> numberLinkedList4 = QtConcurrent::blockingMapped(QLinkedList<Number>(numberLinkedList),
- &Number::multipliedBy2);
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberLinkedList4, QLinkedList<Number>() << 2 << 4 << 6);
- }
// change the value_type, same container
@@ -942,22 +912,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, IntToDouble());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
- linkedList.constEnd(),
- IntToDouble());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList),
- IntToDouble());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
- }
// function
{
@@ -975,21 +929,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList), intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
- }
// bound function
{
@@ -1009,23 +948,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
-
- QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList),
- intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
- }
// const member function
{
@@ -1045,23 +967,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<QString>() << "1" << "2" << "3");
}
- {
- QLinkedList<QString> linkedList2 =
- QtConcurrent::blockingMapped<QLinkedList<QString> >(numberLinkedList, &Number::toString);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<QString>() << "1" << "2" << "3");
-
- QLinkedList<QString> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<QString> >(numberLinkedList.constBegin(),
- numberLinkedList.constEnd()
- , &Number::toString);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<QString>() << "1" << "2" << "3");
-
- QLinkedList<QString> linkedList4 =
- QtConcurrent::blockingMapped<QLinkedList<QString> >(QLinkedList<Number>(numberLinkedList), &Number::toString);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<QString>() << "1" << "2" << "3");
- }
// change the value_type
{
@@ -1218,6 +1123,162 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list5, QVector<int>() << 1 << 2 << 3);
#endif
}
+
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3;
+ QLinkedList<Number> numberLinkedList;
+ numberLinkedList << 1 << 2 << 3;
+
+ // functor
+ {
+ QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, MultiplyBy2());
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
+
+ QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
+ linkedList.constEnd(),
+ MultiplyBy2());
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
+
+ QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), MultiplyBy2());
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
+ }
+
+ // function
+ {
+ QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, multiplyBy2);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
+
+ QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
+ linkedList.constEnd(),
+ multiplyBy2);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
+
+ QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), multiplyBy2);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
+ }
+
+ // bound function
+ {
+ QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, multiplyBy2);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
+
+ QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
+ linkedList.constEnd(),
+ multiplyBy2);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
+
+ QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), multiplyBy2);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
+ }
+
+ // const member function
+ {
+ QLinkedList<Number> numberLinkedList2 = QtConcurrent::blockingMapped(numberLinkedList, &Number::multipliedBy2);
+ QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
+ QCOMPARE(numberLinkedList2, QLinkedList<Number>() << 2 << 4 << 6);
+
+ QLinkedList<Number> numberLinkedList3 = QtConcurrent::blockingMapped<QLinkedList<Number> >(numberLinkedList.constBegin(),
+ numberLinkedList.constEnd(),
+ &Number::multipliedBy2);
+ QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
+ QCOMPARE(numberLinkedList3, QLinkedList<Number>() << 2 << 4 << 6);
+
+ QLinkedList<Number> numberLinkedList4 = QtConcurrent::blockingMapped(QLinkedList<Number>(numberLinkedList),
+ &Number::multipliedBy2);
+ QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
+ QCOMPARE(numberLinkedList4, QLinkedList<Number>() << 2 << 4 << 6);
+ }
+
+ // change the value_type, same container
+
+ // functor
+ {
+ QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, IntToDouble());
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+
+ QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
+ linkedList.constEnd(),
+ IntToDouble());
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+
+ QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList),
+ IntToDouble());
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+ }
+
+ // function
+ {
+ QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, intToDouble);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+
+ QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intToDouble);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+
+ QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList), intToDouble);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+ }
+
+ // bound function
+ {
+ QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, intToDouble);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+
+ QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intToDouble);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+
+
+ QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList),
+ intToDouble);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
+ }
+
+ // const member function
+ {
+ QLinkedList<QString> linkedList2 =
+ QtConcurrent::blockingMapped<QLinkedList<QString> >(numberLinkedList, &Number::toString);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<QString>() << "1" << "2" << "3");
+
+ QLinkedList<QString> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<QString> >(numberLinkedList.constBegin(),
+ numberLinkedList.constEnd()
+ , &Number::toString);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<QString>() << "1" << "2" << "3");
+
+ QLinkedList<QString> linkedList4 =
+ QtConcurrent::blockingMapped<QLinkedList<QString> >(QLinkedList<Number>(numberLinkedList), &Number::toString);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<QString>() << "1" << "2" << "3");
+ }
+
+QT_WARNING_POP
+#endif
}
int intSquare(int x)
@@ -1240,12 +1301,8 @@ void tst_QtConcurrentMap::mappedReduced()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// test Q_DECLARE_OPERATORS_FOR_FLAGS
QtConcurrent::ReduceOptions opt = (QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce);
@@ -1277,6 +1334,164 @@ void tst_QtConcurrentMap::mappedReduced()
intSumReduce);
QCOMPARE(sum6, 14);
}
+
+ // function-functor
+ {
+ int sum = QtConcurrent::mappedReduced<int>(list, intSquare, IntSumReduce());
+ QCOMPARE(sum, 14);
+ int sum2 = QtConcurrent::mappedReduced<int>(list.constBegin(),
+ list.constEnd(),
+ intSquare,
+ IntSumReduce());
+ QCOMPARE(sum2, 14);
+
+ int sum3 = QtConcurrent::mappedReduced<int>(QList<int>(list), intSquare, IntSumReduce());
+ QCOMPARE(sum3, 14);
+ }
+
+ // functor-function
+ {
+ int sum = QtConcurrent::mappedReduced(list, IntSquare(), intSumReduce);
+ QCOMPARE(sum, 14);
+ int sum2 = QtConcurrent::mappedReduced(list.constBegin(),
+ list.constEnd(),
+ IntSquare(),
+ intSumReduce);
+ QCOMPARE(sum2, 14);
+
+ int sum3 = QtConcurrent::mappedReduced(QList<int>(list), IntSquare(), intSumReduce);
+ QCOMPARE(sum3, 14);
+ }
+
+ // function-function
+ {
+ int sum = QtConcurrent::mappedReduced(list, intSquare, intSumReduce);
+ QCOMPARE(sum, 14);
+ int sum2 = QtConcurrent::mappedReduced(list.constBegin(),
+ list.constEnd(),
+ intSquare,
+ intSumReduce);
+ QCOMPARE(sum2, 14);
+
+ int sum3 = QtConcurrent::mappedReduced(QList<int>(list), intSquare, intSumReduce);
+ QCOMPARE(sum3, 14);
+ }
+
+ // functor-member
+ {
+ QList<int> list2 = QtConcurrent::mappedReduced(list,
+ IntSquare(),
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
+
+ QList<int> list3 = QtConcurrent::mappedReduced(list.constBegin(),
+ list.constEnd(),
+ IntSquare(),
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
+
+ QList<int> list4 = QtConcurrent::mappedReduced(QList<int>(list),
+ IntSquare(),
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
+ }
+
+ // member-functor
+ {
+ int sum = QtConcurrent::mappedReduced<int>(numberList, &Number::toInt, IntSumReduce());
+ QCOMPARE(sum, 6);
+ int sum2 = QtConcurrent::mappedReduced<int>(numberList.constBegin(),
+ numberList.constEnd(),
+ &Number::toInt,
+ IntSumReduce());
+ QCOMPARE(sum2, 6);
+
+ int sum3 = QtConcurrent::mappedReduced<int>(QList<Number>(numberList),
+ &Number::toInt,
+ IntSumReduce());
+ QCOMPARE(sum3, 6);
+ }
+
+ // member-member
+ {
+ QList<int> list2 = QtConcurrent::mappedReduced(numberList,
+ &Number::toInt,
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list2, QList<int>() << 1 << 2 << 3);
+
+ QList<int> list3 = QtConcurrent::mappedReduced(numberList.constBegin(),
+ numberList.constEnd(),
+ &Number::toInt,
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list3, QList<int>() << 1 << 2 << 3);
+
+ QList<int> list4 = QtConcurrent::mappedReduced(QList<Number>(numberList),
+ &Number::toInt,
+ &QList<int>::push_back, OrderedReduce);
+ QCOMPARE(list4, QList<int>() << 1 << 2 << 3);
+ }
+
+ // function-member
+ {
+ QList<int> list2 = QtConcurrent::mappedReduced(list,
+ intSquare,
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
+
+ QList<int> list3 = QtConcurrent::mappedReduced(list.constBegin(),
+ list.constEnd(),
+ intSquare,
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
+
+ QList<int> list4 = QtConcurrent::mappedReduced(QList<int>(list),
+ intSquare,
+ &QList<int>::push_back,
+ OrderedReduce);
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
+ }
+
+ // member-function
+ {
+ int sum = QtConcurrent::mappedReduced(numberList,
+ &Number::toInt,
+ intSumReduce);
+ QCOMPARE(sum, 6);
+ int sum2 = QtConcurrent::mappedReduced(numberList.constBegin(),
+ numberList.constEnd(),
+ &Number::toInt,
+ intSumReduce);
+ QCOMPARE(sum2, 6);
+
+ int sum3 = QtConcurrent::mappedReduced(QList<Number>(numberList),
+ &Number::toInt,
+ intSumReduce);
+ QCOMPARE(sum3, 6);
+ }
+
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3;
+ QLinkedList<Number> numberLinkedList;
+ numberLinkedList << 1 << 2 << 3;
+
+ // functor-functor
{
int sum = QtConcurrent::mappedReduced<int>(linkedList, IntSquare(), IntSumReduce());
QCOMPARE(sum, 14);
@@ -1305,18 +1520,6 @@ void tst_QtConcurrentMap::mappedReduced()
// function-functor
{
- int sum = QtConcurrent::mappedReduced<int>(list, intSquare, IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced<int>(list.constBegin(),
- list.constEnd(),
- intSquare,
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced<int>(QList<int>(list), intSquare, IntSumReduce());
- QCOMPARE(sum3, 14);
- }
- {
int sum = QtConcurrent::mappedReduced<int>(linkedList, intSquare, IntSumReduce());
QCOMPARE(sum, 14);
int sum2 = QtConcurrent::mappedReduced<int>(linkedList.constBegin(),
@@ -1331,18 +1534,6 @@ void tst_QtConcurrentMap::mappedReduced()
// functor-function
{
- int sum = QtConcurrent::mappedReduced(list, IntSquare(), intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced(list.constBegin(),
- list.constEnd(),
- IntSquare(),
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced(QList<int>(list), IntSquare(), intSumReduce);
- QCOMPARE(sum3, 14);
- }
- {
int sum = QtConcurrent::mappedReduced(linkedList, IntSquare(), intSumReduce);
QCOMPARE(sum, 14);
int sum2 = QtConcurrent::mappedReduced(linkedList.constBegin(),
@@ -1357,18 +1548,6 @@ void tst_QtConcurrentMap::mappedReduced()
// function-function
{
- int sum = QtConcurrent::mappedReduced(list, intSquare, intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced(list.constBegin(),
- list.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced(QList<int>(list), intSquare, intSumReduce);
- QCOMPARE(sum3, 14);
- }
- {
int sum = QtConcurrent::mappedReduced(linkedList, intSquare, intSumReduce);
QCOMPARE(sum, 14);
int sum2 = QtConcurrent::mappedReduced(linkedList.constBegin(),
@@ -1383,29 +1562,6 @@ void tst_QtConcurrentMap::mappedReduced()
// functor-member
{
- QList<int> list2 = QtConcurrent::mappedReduced(list,
- IntSquare(),
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list, QList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
-
- QList<int> list3 = QtConcurrent::mappedReduced(list.constBegin(),
- list.constEnd(),
- IntSquare(),
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list, QList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
-
- QList<int> list4 = QtConcurrent::mappedReduced(QList<int>(list),
- IntSquare(),
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list, QList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
- }
- {
QLinkedList<int> linkedList2 = QtConcurrent::mappedReduced(linkedList,
IntSquare(),
&QLinkedList<int>::push_back,
@@ -1431,20 +1587,6 @@ void tst_QtConcurrentMap::mappedReduced()
// member-functor
{
- int sum = QtConcurrent::mappedReduced<int>(numberList, &Number::toInt, IntSumReduce());
- QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::mappedReduced<int>(numberList.constBegin(),
- numberList.constEnd(),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum2, 6);
-
- int sum3 = QtConcurrent::mappedReduced<int>(QList<Number>(numberList),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum3, 6);
- }
- {
int sum = QtConcurrent::mappedReduced<int>(numberLinkedList, &Number::toInt, IntSumReduce());
QCOMPARE(sum, 6);
int sum2 = QtConcurrent::mappedReduced<int>(numberLinkedList.constBegin(),
@@ -1461,25 +1603,6 @@ void tst_QtConcurrentMap::mappedReduced()
// member-member
{
- QList<int> list2 = QtConcurrent::mappedReduced(numberList,
- &Number::toInt,
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list2, QList<int>() << 1 << 2 << 3);
-
- QList<int> list3 = QtConcurrent::mappedReduced(numberList.constBegin(),
- numberList.constEnd(),
- &Number::toInt,
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list3, QList<int>() << 1 << 2 << 3);
-
- QList<int> list4 = QtConcurrent::mappedReduced(QList<Number>(numberList),
- &Number::toInt,
- &QList<int>::push_back, OrderedReduce);
- QCOMPARE(list4, QList<int>() << 1 << 2 << 3);
- }
- {
QLinkedList<int> linkedList2 = QtConcurrent::mappedReduced(numberLinkedList,
&Number::toInt,
&QLinkedList<int>::push_back,
@@ -1501,29 +1624,6 @@ void tst_QtConcurrentMap::mappedReduced()
// function-member
{
- QList<int> list2 = QtConcurrent::mappedReduced(list,
- intSquare,
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list, QList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
-
- QList<int> list3 = QtConcurrent::mappedReduced(list.constBegin(),
- list.constEnd(),
- intSquare,
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list, QList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
-
- QList<int> list4 = QtConcurrent::mappedReduced(QList<int>(list),
- intSquare,
- &QList<int>::push_back,
- OrderedReduce);
- QCOMPARE(list, QList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
- }
- {
QLinkedList<int> linkedList2 = QtConcurrent::mappedReduced(linkedList,
intSquare,
&QLinkedList<int>::append,
@@ -1549,22 +1649,6 @@ void tst_QtConcurrentMap::mappedReduced()
// member-function
{
- int sum = QtConcurrent::mappedReduced(numberList,
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::mappedReduced(numberList.constBegin(),
- numberList.constEnd(),
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum2, 6);
-
- int sum3 = QtConcurrent::mappedReduced(QList<Number>(numberList),
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum3, 6);
- }
- {
int sum = QtConcurrent::mappedReduced(numberLinkedList,
&Number::toInt,
intSumReduce);
@@ -1615,6 +1699,9 @@ void tst_QtConcurrentMap::mappedReduced()
QCOMPARE(sum6, 14);
}
+QT_WARNING_POP
+#endif
+
// ### the same as above, with an initial result value
}
@@ -1622,12 +1709,8 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// functor-functor
{
@@ -1655,31 +1738,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
intSumReduce);
QCOMPARE(sum6, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced<int>(linkedList, IntSquare(), IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList), IntSquare(), IntSumReduce());
- QCOMPARE(sum3, 14);
-
- int sum4 = QtConcurrent::blockingMappedReduced<int>(linkedList, intSquare, intSumReduce);
- QCOMPARE(sum4, 14);
- int sum5 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum5, 14);
-
- int sum6 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList),
- intSquare,
- intSumReduce);
- QCOMPARE(sum6, 14);
- }
// function-functor
{
@@ -1694,18 +1752,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
int sum3 = QtConcurrent::blockingMappedReduced<int>(QList<int>(list), intSquare, IntSumReduce());
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced<int>(linkedList, intSquare, IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList), intSquare, IntSumReduce());
- QCOMPARE(sum3, 14);
- }
// functor-function
{
@@ -1720,18 +1766,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
int sum3 = QtConcurrent::blockingMappedReduced(QList<int>(list), IntSquare(), intSumReduce);
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced(linkedList, IntSquare(), intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList), IntSquare(), intSumReduce);
- QCOMPARE(sum3, 14);
- }
// function-function
{
@@ -1746,18 +1780,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
int sum3 = QtConcurrent::blockingMappedReduced(QList<int>(list), intSquare, intSumReduce);
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced(linkedList, intSquare, intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList), intSquare, intSumReduce);
- QCOMPARE(sum3, 14);
- }
// functor-member
{
@@ -1783,29 +1805,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(linkedList,
- IntSquare(),
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList),
- IntSquare(),
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 4 << 9);
- }
// member-functor
{
@@ -1823,20 +1822,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
IntSumReduce());
QCOMPARE(sum3, 6);
}
- {
- int sum = QtConcurrent::blockingMappedReduced<int>(numberLinkedList, &Number::toInt, IntSumReduce());
- QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::blockingMappedReduced<int>(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum2, 6);
-
- int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum3, 6);
- }
// member-member
{
@@ -1858,25 +1843,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
&QList<int>::push_back, OrderedReduce);
QCOMPARE(list4, QList<int>() << 1 << 2 << 3);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(numberLinkedList,
- &Number::toInt,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 2 << 3);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 2 << 3);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- &QLinkedList<int>::append, OrderedReduce);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 2 << 3);
- }
// function-member
{
@@ -1902,9 +1868,107 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
}
+
+ // member-function
+ {
+ int sum = QtConcurrent::blockingMappedReduced(numberList,
+ &Number::toInt,
+ intSumReduce);
+ QCOMPARE(sum, 6);
+ int sum2 = QtConcurrent::blockingMappedReduced(numberList.constBegin(),
+ numberList.constEnd(),
+ &Number::toInt,
+ intSumReduce);
+ QCOMPARE(sum2, 6);
+
+ int sum3 = QtConcurrent::blockingMappedReduced(QList<Number>(numberList),
+ &Number::toInt,
+ intSumReduce);
+ QCOMPARE(sum3, 6);
+ }
+
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
+ QLinkedList<int> linkedList;
+ linkedList << 1 << 2 << 3;
+ QLinkedList<Number> numberLinkedList;
+ numberLinkedList << 1 << 2 << 3;
+
+ // functor-functor
+ {
+ int sum = QtConcurrent::blockingMappedReduced<int>(linkedList, IntSquare(), IntSumReduce());
+ QCOMPARE(sum, 14);
+ int sum2 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
+ linkedList.constEnd(),
+ IntSquare(),
+ IntSumReduce());
+ QCOMPARE(sum2, 14);
+
+ int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList), IntSquare(), IntSumReduce());
+ QCOMPARE(sum3, 14);
+
+ int sum4 = QtConcurrent::blockingMappedReduced<int>(linkedList, intSquare, intSumReduce);
+ QCOMPARE(sum4, 14);
+ int sum5 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intSquare,
+ intSumReduce);
+ QCOMPARE(sum5, 14);
+
+ int sum6 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList),
+ intSquare,
+ intSumReduce);
+ QCOMPARE(sum6, 14);
+ }
+
+ // function-functor
+ {
+ int sum = QtConcurrent::blockingMappedReduced<int>(linkedList, intSquare, IntSumReduce());
+ QCOMPARE(sum, 14);
+ int sum2 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intSquare,
+ IntSumReduce());
+ QCOMPARE(sum2, 14);
+
+ int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList), intSquare, IntSumReduce());
+ QCOMPARE(sum3, 14);
+ }
+
+ // functor-function
+ {
+ int sum = QtConcurrent::blockingMappedReduced(linkedList, IntSquare(), intSumReduce);
+ QCOMPARE(sum, 14);
+ int sum2 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
+ linkedList.constEnd(),
+ IntSquare(),
+ intSumReduce);
+ QCOMPARE(sum2, 14);
+
+ int sum3 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList), IntSquare(), intSumReduce);
+ QCOMPARE(sum3, 14);
+ }
+
+ // function-function
+ {
+ int sum = QtConcurrent::blockingMappedReduced(linkedList, intSquare, intSumReduce);
+ QCOMPARE(sum, 14);
+ int sum2 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intSquare,
+ intSumReduce);
+ QCOMPARE(sum2, 14);
+
+ int sum3 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList), intSquare, intSumReduce);
+ QCOMPARE(sum3, 14);
+ }
+
+ // functor-member
{
QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(linkedList,
- intSquare,
+ IntSquare(),
&QLinkedList<int>::append,
OrderedReduce);
QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
@@ -1912,37 +1976,83 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
linkedList.constEnd(),
- intSquare,
+ IntSquare(),
&QLinkedList<int>::append,
OrderedReduce);
QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 4 << 9);
QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList),
- intSquare,
+ IntSquare(),
&QLinkedList<int>::append,
OrderedReduce);
QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 4 << 9);
}
- // member-function
+ // member-functor
{
- int sum = QtConcurrent::blockingMappedReduced(numberList,
- &Number::toInt,
- intSumReduce);
+ int sum = QtConcurrent::blockingMappedReduced<int>(numberLinkedList, &Number::toInt, IntSumReduce());
QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::blockingMappedReduced(numberList.constBegin(),
- numberList.constEnd(),
- &Number::toInt,
- intSumReduce);
+ int sum2 = QtConcurrent::blockingMappedReduced<int>(numberLinkedList.constBegin(),
+ numberLinkedList.constEnd(),
+ &Number::toInt,
+ IntSumReduce());
QCOMPARE(sum2, 6);
- int sum3 = QtConcurrent::blockingMappedReduced(QList<Number>(numberList),
- &Number::toInt,
- intSumReduce);
+ int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<Number>(numberLinkedList),
+ &Number::toInt,
+ IntSumReduce());
QCOMPARE(sum3, 6);
}
+
+ // member-member
+ {
+ QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(numberLinkedList,
+ &Number::toInt,
+ &QLinkedList<int>::append,
+ OrderedReduce);
+ QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 2 << 3);
+
+ QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(numberLinkedList.constBegin(),
+ numberLinkedList.constEnd(),
+ &Number::toInt,
+ &QLinkedList<int>::append,
+ OrderedReduce);
+ QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 2 << 3);
+
+ QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<Number>(numberLinkedList),
+ &Number::toInt,
+ &QLinkedList<int>::append, OrderedReduce);
+ QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 2 << 3);
+ }
+
+ // function-member
+ {
+ QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(linkedList,
+ intSquare,
+ &QLinkedList<int>::append,
+ OrderedReduce);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 4 << 9);
+
+ QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
+ linkedList.constEnd(),
+ intSquare,
+ &QLinkedList<int>::append,
+ OrderedReduce);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 4 << 9);
+
+ QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList),
+ intSquare,
+ &QLinkedList<int>::append,
+ OrderedReduce);
+ QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
+ QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 4 << 9);
+ }
+
+ // member-function
{
int sum = QtConcurrent::blockingMappedReduced(numberLinkedList,
&Number::toInt,
@@ -1994,6 +2104,9 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QCOMPARE(sum6, 14);
}
+QT_WARNING_POP
+#endif
+
// ### the same as above, with an initial result value
}
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 5af1353a0f..70bda1a0ef 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -3885,12 +3885,17 @@ void tst_QVariant::moreCustomTypes()
PLAY_WITH_VARIANT(data, false, QString(), 0, false);
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
{
QList<QLinkedList<int> > data;
PLAY_WITH_VARIANT(data, false, QString(), 0, false);
data << (QLinkedList<int>() << 42);
PLAY_WITH_VARIANT(data, false, QString(), 0, false);
}
+QT_WARNING_POP
+#endif
}
void tst_QVariant::movabilityTest()
diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
index aed84cb14e..ff2e98e730 100644
--- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
@@ -3064,39 +3064,45 @@ void tst_QDataStream::status_QHash_QMap()
} \
} \
{ \
- LinkedList expectedLinkedList; \
+ Vector expectedVector; \
for (int i = 0; i < expectedList.count(); ++i) \
- expectedLinkedList << expectedList.at(i); \
+ expectedVector << expectedList.at(i); \
QByteArray ba = byteArray; \
QDataStream stream(&ba, QIODevice::ReadOnly); \
if (inTransaction) \
stream.startTransaction(); \
stream.setStatus(initialStatus); \
- stream >> linkedList; \
+ stream >> vector; \
QCOMPARE((int)stream.status(), (int)expectedStatus); \
if (!inTransaction || stream.commitTransaction()) { \
- QCOMPARE(linkedList.size(), expectedLinkedList.size()); \
- QCOMPARE(linkedList, expectedLinkedList); \
+ QCOMPARE(vector.size(), expectedVector.size()); \
+ QCOMPARE(vector, expectedVector); \
} else { \
- QVERIFY(linkedList.isEmpty()); \
+ QVERIFY(vector.isEmpty()); \
} \
} \
+ if (inTransaction) \
+ break; \
+ }
+
+#define LINKED_LIST_TEST(byteArray, initialStatus, expectedStatus, expectedList) \
+ for (bool inTransaction = false;; inTransaction = true) { \
{ \
- Vector expectedVector; \
+ LinkedList expectedLinkedList; \
for (int i = 0; i < expectedList.count(); ++i) \
- expectedVector << expectedList.at(i); \
+ expectedLinkedList << expectedList.at(i); \
QByteArray ba = byteArray; \
QDataStream stream(&ba, QIODevice::ReadOnly); \
if (inTransaction) \
stream.startTransaction(); \
stream.setStatus(initialStatus); \
- stream >> vector; \
+ stream >> linkedList; \
QCOMPARE((int)stream.status(), (int)expectedStatus); \
if (!inTransaction || stream.commitTransaction()) { \
- QCOMPARE(vector.size(), expectedVector.size()); \
- QCOMPARE(vector, expectedVector); \
+ QCOMPARE(linkedList.size(), expectedLinkedList.size()); \
+ QCOMPARE(linkedList, expectedLinkedList); \
} else { \
- QVERIFY(vector.isEmpty()); \
+ QVERIFY(linkedList.isEmpty()); \
} \
} \
if (inTransaction) \
@@ -3105,10 +3111,8 @@ void tst_QDataStream::status_QHash_QMap()
void tst_QDataStream::status_QLinkedList_QList_QVector()
{
- typedef QLinkedList<QString> LinkedList;
typedef QList<QString> List;
typedef QVector<QString> Vector;
- LinkedList linkedList;
List list;
Vector vector;
@@ -3155,6 +3159,61 @@ void tst_QDataStream::status_QLinkedList_QList_QVector()
LIST_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::ReadCorruptData, QDataStream::ReadCorruptData, List());
LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, List());
}
+
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ // The same as above with QLinkedList
+
+ typedef QLinkedList<QString> LinkedList;
+ LinkedList linkedList;
+
+ // ok
+ {
+ List listWithEmptyString;
+ listWithEmptyString.append("");
+
+ List someList;
+ someList.append("J");
+ someList.append("MN");
+
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x00", 4), QDataStream::Ok, QDataStream::Ok, List());
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00", 8), QDataStream::Ok, QDataStream::Ok, listWithEmptyString);
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x02\x00J"
+ "\x00\x00\x00\x04\x00M\x00N", 18), QDataStream::Ok, QDataStream::Ok, someList);
+ }
+
+ // past end
+ {
+ LINKED_LIST_TEST(QByteArray(), QDataStream::Ok, QDataStream::ReadPastEnd, List());
+ LINKED_LIST_TEST(QByteArray("\x00", 1), QDataStream::Ok, QDataStream::ReadPastEnd, List());
+ LINKED_LIST_TEST(QByteArray("\x00\x00", 2), QDataStream::Ok, QDataStream::ReadPastEnd, List());
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00", 3), QDataStream::Ok, QDataStream::ReadPastEnd, List());
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::Ok, QDataStream::ReadPastEnd, List());
+ for (int i = 4; i < 12; ++i) {
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", i), QDataStream::Ok, QDataStream::ReadPastEnd, List());
+ }
+ }
+
+ // corrupt data
+ {
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::Ok, QDataStream::ReadCorruptData, List());
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x01\x00J"
+ "\x00\x00\x00\x02\x00M\x00N", 18), QDataStream::Ok, QDataStream::ReadCorruptData, List());
+ }
+
+ // test the previously latched error status is not affected by reading
+ {
+ List listWithEmptyString;
+ listWithEmptyString.append("");
+
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, listWithEmptyString);
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::ReadCorruptData, QDataStream::ReadCorruptData, List());
+ LINKED_LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, List());
+ }
+
+QT_WARNING_POP
+#endif
}
void tst_QDataStream::streamToAndFromQByteArray()
diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp
index e79a4dba29..ec519ad362 100644
--- a/tests/auto/corelib/tools/collections/tst_collections.cpp
+++ b/tests/auto/corelib/tools/collections/tst_collections.cpp
@@ -96,7 +96,9 @@ private slots:
void typeinfo();
void qstring();
void list();
+#if QT_DEPRECATED_SINCE(5, 15)
void linkedList();
+#endif
void vector();
void byteArray();
void stack();
@@ -109,7 +111,9 @@ private slots:
#endif
void pair();
void sharableQList();
+#if QT_DEPRECATED_SINCE(5, 15)
void sharableQLinkedList();
+#endif
void sharableQVector();
void sharableQMap();
void sharableQHash();
@@ -121,8 +125,10 @@ private slots:
void vector_stl();
void list_stl_data();
void list_stl();
+#if QT_DEPRECATED_SINCE(5, 15)
void linkedlist_stl_data();
void linkedlist_stl();
+#endif
void q_init();
void pointersize();
void containerInstantiation();
@@ -736,8 +742,11 @@ void tst_Collections::list()
}
}
+#if QT_DEPRECATED_SINCE(5, 15)
void tst_Collections::linkedList()
{
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
{
QLinkedList<int> list;
QVERIFY(list.isEmpty());
@@ -955,7 +964,9 @@ void tst_Collections::linkedList()
QCOMPARE(a.endsWith(1), false);
QCOMPARE(a.endsWith(2), true);
}
+QT_WARNING_POP
};
+#endif
void tst_Collections::vector()
@@ -2330,11 +2341,16 @@ void populate(QList<int> &container)
container << 1 << 2 << 4 << 8;
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
template <>
void populate(QLinkedList<int> &container)
{
container << 1 << 2 << 4 << 8;
}
+QT_WARNING_POP
+#endif
template <>
void populate(QVector<int> &container)
@@ -2431,10 +2447,15 @@ void tst_Collections::sharableQList()
TEST_SEQUENTIAL_CONTAINER(List);
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
void tst_Collections::sharableQLinkedList()
{
TEST_SEQUENTIAL_CONTAINER(LinkedList);
}
+QT_WARNING_POP
+#endif
void tst_Collections::sharableQVector()
{
@@ -2755,7 +2776,12 @@ void tst_Collections::constAndNonConstStlIterators()
{
testListLikeStlIterators<QList<int> >();
testListLikeStlIterators<QStringList >();
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
testLinkedListLikeStlIterators<QLinkedList<int> >();
+QT_WARNING_POP
+#endif
testListLikeStlIterators<QVector<int> >();
testMapLikeStlIterators<QMap<QString, QString> >();
testMapLikeStlIterators<QMultiMap<QString, QString> >();
@@ -2798,6 +2824,7 @@ void tst_Collections::vector_stl()
QCOMPARE(QVector<QString>(stdVector.begin(), stdVector.end()), vector);
}
+#if QT_DEPRECATED_SINCE(5, 15)
void tst_Collections::linkedlist_stl_data()
{
list_stl_data();
@@ -2805,6 +2832,8 @@ void tst_Collections::linkedlist_stl_data()
void tst_Collections::linkedlist_stl()
{
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QFETCH(QStringList, elements);
QLinkedList<QString> list;
@@ -2821,7 +2850,9 @@ void tst_Collections::linkedlist_stl()
QCOMPARE(*it, *it2);
QCOMPARE(QLinkedList<QString>::fromStdList(stdList), list);
+QT_WARNING_POP
}
+#endif
void tst_Collections::list_stl_data()
{
@@ -3070,6 +3101,10 @@ void tst_Collections::containerInstantiation()
typedef QSet<EqualsComparable> Set;
instantiateAssociative<Set, EqualsComparable>();
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
//Instantiate QLinkedList member functions.
typedef QLinkedList<EqualsComparable> LinkedList;
instantiateSequence<LinkedList, EqualsComparable> ();
@@ -3078,6 +3113,8 @@ void tst_Collections::containerInstantiation()
LinkedList list;
list.removeAll(value);
}
+QT_WARNING_POP
+#endif
//Instantiate QList member functions.
typedef QList<EqualsComparable> List;
@@ -3185,7 +3222,12 @@ void tst_Collections::containerTypedefs()
testContainerTypedefs(QVector<int>());
testContainerTypedefs(QStack<int>());
testContainerTypedefs(QList<int>());
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
testContainerTypedefs(QLinkedList<int>());
+QT_WARNING_POP
+#endif
testContainerTypedefs(QQueue<int>());
testPairAssociativeContainerTypedefs(QMap<int, int>());
@@ -3207,7 +3249,12 @@ void tst_Collections::forwardDeclared()
{ typedef QMultiMap<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QPair<T1, T2> C; C *x = 0; Q_UNUSED(x) }
{ typedef QList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
{ typedef QLinkedList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
+QT_WARNING_POP
+#endif
{ typedef QVector<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) Q_UNUSED(i) Q_UNUSED(j) }
{ typedef QStack<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) Q_UNUSED(i) Q_UNUSED(j) }
{ typedef QQueue<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
@@ -3441,7 +3488,12 @@ void tst_Collections::QTBUG13079_collectionInsideCollection()
QTBUG13079_collectionInsideCollectionImpl<QVector>();
QTBUG13079_collectionInsideCollectionImpl<QStack>();
QTBUG13079_collectionInsideCollectionImpl<QList>();
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QTBUG13079_collectionInsideCollectionImpl<QLinkedList>();
+QT_WARNING_POP
+#endif
QTBUG13079_collectionInsideCollectionImpl<QQueue>();
{
diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
index 88c0c5055c..2c7c8f6514 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
+++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
@@ -324,11 +324,12 @@ private Q_SLOTS:
#endif
}
- void ranged_ctor_QLinkedList_int() { ranged_ctor_non_associative_impl<QLinkedList<int>>(); }
- void ranged_ctor_QLinkedList_Movable() { ranged_ctor_non_associative_impl<QLinkedList<Movable>>(); }
- void ranged_ctor_QLinkedList_Complex() { ranged_ctor_non_associative_impl<QLinkedList<Complex>>(); }
- void ranged_ctor_QLinkedList_duplicates_strategy() { non_associative_container_duplicates_strategy<QLinkedList>(); }
-
+#if QT_DEPRECATED_SINCE(5, 15)
+ void ranged_ctor_QLinkedList_int();
+ void ranged_ctor_QLinkedList_Movable();
+ void ranged_ctor_QLinkedList_Complex();
+ void ranged_ctor_QLinkedList_duplicates_strategy();
+#endif
void ranged_ctor_std_set_int() { ranged_ctor_non_associative_impl<std::set<int>>(); }
void ranged_ctor_std_set_Movable() { ranged_ctor_non_associative_impl<std::set<Movable>>(); }
void ranged_ctor_std_set_Complex() { ranged_ctor_non_associative_impl<std::set<Complex>>(); }
@@ -482,7 +483,9 @@ private Q_SLOTS:
void front_back_std_vector() { front_back_impl<std::vector<int>>(); }
void front_back_QVector() { front_back_impl<QVector<int>>(); }
void front_back_QList() { front_back_impl<QList<qintptr>>(); }
- void front_back_QLinkedList() { front_back_impl<QLinkedList<int>>(); }
+#if QT_DEPRECATED_SINCE(5, 15)
+ void front_back_QLinkedList();
+#endif
void front_back_QVarLengthArray() { front_back_impl<QVarLengthArray<int>>(); }
void front_back_QString() { front_back_impl<QString>(); }
void front_back_QStringRef() { front_back_impl<QStringRef>(); }
@@ -590,8 +593,13 @@ template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::forward_list<T...>> : ContainerAcceptsDuplicateValues {};
#endif
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
template<typename ... T>
struct ContainerDuplicatedValuesStrategy<QLinkedList<T...>> : ContainerAcceptsDuplicateValues {};
+QT_WARNING_POP
+#endif
// assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution
template<typename ... T>
@@ -819,5 +827,35 @@ void tst_ContainerApiSymmetry::front_back_impl() const
QCOMPARE(clean(qAsConst(c2).back()), V(2));
}
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+void tst_ContainerApiSymmetry::ranged_ctor_QLinkedList_int()
+{
+ ranged_ctor_non_associative_impl<QLinkedList<int>>();
+}
+
+void tst_ContainerApiSymmetry::ranged_ctor_QLinkedList_Movable()
+{
+ ranged_ctor_non_associative_impl<QLinkedList<Movable>>();
+}
+
+void tst_ContainerApiSymmetry::ranged_ctor_QLinkedList_Complex()
+{
+ ranged_ctor_non_associative_impl<QLinkedList<Complex>>();
+}
+
+void tst_ContainerApiSymmetry::ranged_ctor_QLinkedList_duplicates_strategy()
+{
+ non_associative_container_duplicates_strategy<QLinkedList>();
+}
+
+void tst_ContainerApiSymmetry::front_back_QLinkedList()
+{
+ front_back_impl<QLinkedList<int>>();
+}
+QT_WARNING_POP
+#endif
+
QTEST_APPLESS_MAIN(tst_ContainerApiSymmetry)
#include "tst_containerapisymmetry.moc"
diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
index df42b5dea9..b681676d09 100644
--- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
+++ b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
@@ -29,6 +29,10 @@
#include <QtTest/QtTest>
#include <QLinkedList>
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
struct Movable
{
Movable(char input = 'j') : i(input), state(Constructed)
@@ -1129,5 +1133,16 @@ void tst_QLinkedList::setSharableInt() const
#endif
}
+QT_WARNING_POP
+#else
+class tst_QLinkedList : public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase() { QSKIP("Deprecated APIs are disabled, skipping this test."); }
+};
+
+#endif // QT_DEPRECATED_SINCE(5, 15)
+
QTEST_APPLESS_MAIN(tst_QLinkedList)
#include "tst_qlinkedlist.moc"