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>
This commit is contained in:
Sona Kurazyan 2020-03-04 15:21:40 +01:00
parent 1a9c29289a
commit 249a2e3271
7 changed files with 918 additions and 620 deletions

View File

@ -62,18 +62,6 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, KeepEvenIntegers()); QtConcurrent::blockingFilter(list, KeepEvenIntegers());
QCOMPARE(list, QList<int>() << 2 << 4); 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; QVector<int> vector;
vector << 1 << 2 << 3 << 4; vector << 1 << 2 << 3 << 4;
@ -100,18 +88,6 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, keepEvenIntegers); QtConcurrent::blockingFilter(list, keepEvenIntegers);
QCOMPARE(list, QList<int>() << 2 << 4); 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 // bound function
{ {
@ -126,18 +102,6 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, keepEvenIntegers); QtConcurrent::blockingFilter(list, keepEvenIntegers);
QCOMPARE(list, QList<int>() << 2 << 4); 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);
}
// member // member
{ {
@ -152,6 +116,54 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, &Number::isEven); QtConcurrent::blockingFilter(list, &Number::isEven);
QCOMPARE(list, QList<Number>() << 2 << 4); 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;
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
{
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);
}
// member
{ {
QLinkedList<Number> linkedList; QLinkedList<Number> linkedList;
linkedList << 1 << 2 << 3 << 4; linkedList << 1 << 2 << 3 << 4;
@ -164,6 +176,9 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(linkedList, &Number::isEven); QtConcurrent::blockingFilter(linkedList, &Number::isEven);
QCOMPARE(linkedList, QLinkedList<Number>() << 2 << 4); QCOMPARE(linkedList, QLinkedList<Number>() << 2 << 4);
} }
QT_WARNING_POP
#endif
} }
void tst_QtConcurrentFilter::filtered() void tst_QtConcurrentFilter::filtered()
@ -219,19 +234,6 @@ void tst_QtConcurrentFilter::filtered()
QCOMPARE(f.results(), QList<int>() << 2 << 4); 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 // function
{ {
QFuture<int> f = QtConcurrent::filtered(list, keepEvenIntegers); QFuture<int> f = QtConcurrent::filtered(list, keepEvenIntegers);
@ -352,6 +354,10 @@ void tst_QtConcurrentFilter::filtered()
QCOMPARE(list2, QList<Number>() << 2 << 4); QCOMPARE(list2, QList<Number>() << 2 << 4);
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
// same thing on linked lists // same thing on linked lists
QLinkedList<int> linkedList; QLinkedList<int> linkedList;
@ -517,6 +523,9 @@ void tst_QtConcurrentFilter::filtered()
&Number::isEven); &Number::isEven);
QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4); QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
} }
QT_WARNING_POP
#endif
} }
void tst_QtConcurrentFilter::filteredReduced() void tst_QtConcurrentFilter::filteredReduced()
@ -952,6 +961,10 @@ void tst_QtConcurrentFilter::filteredReduced()
QCOMPARE(sum, 6); QCOMPARE(sum, 6);
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
// same as above on linked lists // same as above on linked lists
QLinkedList<int> linkedList; QLinkedList<int> linkedList;
linkedList << 1 << 2 << 3 << 4; linkedList << 1 << 2 << 3 << 4;
@ -1378,6 +1391,9 @@ void tst_QtConcurrentFilter::filteredReduced()
QCOMPARE(sum, 6); QCOMPARE(sum, 6);
} }
QT_WARNING_POP
#endif
// ### the same as above, with an initial result value // ### the same as above, with an initial result value
} }

File diff suppressed because it is too large Load Diff

View File

@ -3885,12 +3885,17 @@ void tst_QVariant::moreCustomTypes()
PLAY_WITH_VARIANT(data, false, QString(), 0, false); 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; QList<QLinkedList<int> > data;
PLAY_WITH_VARIANT(data, false, QString(), 0, false); PLAY_WITH_VARIANT(data, false, QString(), 0, false);
data << (QLinkedList<int>() << 42); data << (QLinkedList<int>() << 42);
PLAY_WITH_VARIANT(data, false, QString(), 0, false); PLAY_WITH_VARIANT(data, false, QString(), 0, false);
} }
QT_WARNING_POP
#endif
} }
void tst_QVariant::movabilityTest() void tst_QVariant::movabilityTest()

View File

@ -3063,24 +3063,6 @@ void tst_QDataStream::status_QHash_QMap()
QVERIFY(list.isEmpty()); \ QVERIFY(list.isEmpty()); \
} \ } \
} \ } \
{ \
LinkedList expectedLinkedList; \
for (int i = 0; i < expectedList.count(); ++i) \
expectedLinkedList << expectedList.at(i); \
QByteArray ba = byteArray; \
QDataStream stream(&ba, QIODevice::ReadOnly); \
if (inTransaction) \
stream.startTransaction(); \
stream.setStatus(initialStatus); \
stream >> linkedList; \
QCOMPARE((int)stream.status(), (int)expectedStatus); \
if (!inTransaction || stream.commitTransaction()) { \
QCOMPARE(linkedList.size(), expectedLinkedList.size()); \
QCOMPARE(linkedList, expectedLinkedList); \
} else { \
QVERIFY(linkedList.isEmpty()); \
} \
} \
{ \ { \
Vector expectedVector; \ Vector expectedVector; \
for (int i = 0; i < expectedList.count(); ++i) \ for (int i = 0; i < expectedList.count(); ++i) \
@ -3103,12 +3085,34 @@ void tst_QDataStream::status_QHash_QMap()
break; \ break; \
} }
#define LINKED_LIST_TEST(byteArray, initialStatus, expectedStatus, expectedList) \
for (bool inTransaction = false;; inTransaction = true) { \
{ \
LinkedList expectedLinkedList; \
for (int i = 0; i < expectedList.count(); ++i) \
expectedLinkedList << expectedList.at(i); \
QByteArray ba = byteArray; \
QDataStream stream(&ba, QIODevice::ReadOnly); \
if (inTransaction) \
stream.startTransaction(); \
stream.setStatus(initialStatus); \
stream >> linkedList; \
QCOMPARE((int)stream.status(), (int)expectedStatus); \
if (!inTransaction || stream.commitTransaction()) { \
QCOMPARE(linkedList.size(), expectedLinkedList.size()); \
QCOMPARE(linkedList, expectedLinkedList); \
} else { \
QVERIFY(linkedList.isEmpty()); \
} \
} \
if (inTransaction) \
break; \
}
void tst_QDataStream::status_QLinkedList_QList_QVector() void tst_QDataStream::status_QLinkedList_QList_QVector()
{ {
typedef QLinkedList<QString> LinkedList;
typedef QList<QString> List; typedef QList<QString> List;
typedef QVector<QString> Vector; typedef QVector<QString> Vector;
LinkedList linkedList;
List list; List list;
Vector vector; 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", 4), QDataStream::ReadCorruptData, QDataStream::ReadCorruptData, List());
LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, 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() void tst_QDataStream::streamToAndFromQByteArray()

View File

@ -96,7 +96,9 @@ private slots:
void typeinfo(); void typeinfo();
void qstring(); void qstring();
void list(); void list();
#if QT_DEPRECATED_SINCE(5, 15)
void linkedList(); void linkedList();
#endif
void vector(); void vector();
void byteArray(); void byteArray();
void stack(); void stack();
@ -109,7 +111,9 @@ private slots:
#endif #endif
void pair(); void pair();
void sharableQList(); void sharableQList();
#if QT_DEPRECATED_SINCE(5, 15)
void sharableQLinkedList(); void sharableQLinkedList();
#endif
void sharableQVector(); void sharableQVector();
void sharableQMap(); void sharableQMap();
void sharableQHash(); void sharableQHash();
@ -121,8 +125,10 @@ private slots:
void vector_stl(); void vector_stl();
void list_stl_data(); void list_stl_data();
void list_stl(); void list_stl();
#if QT_DEPRECATED_SINCE(5, 15)
void linkedlist_stl_data(); void linkedlist_stl_data();
void linkedlist_stl(); void linkedlist_stl();
#endif
void q_init(); void q_init();
void pointersize(); void pointersize();
void containerInstantiation(); void containerInstantiation();
@ -736,8 +742,11 @@ void tst_Collections::list()
} }
} }
#if QT_DEPRECATED_SINCE(5, 15)
void tst_Collections::linkedList() void tst_Collections::linkedList()
{ {
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
{ {
QLinkedList<int> list; QLinkedList<int> list;
QVERIFY(list.isEmpty()); QVERIFY(list.isEmpty());
@ -955,7 +964,9 @@ void tst_Collections::linkedList()
QCOMPARE(a.endsWith(1), false); QCOMPARE(a.endsWith(1), false);
QCOMPARE(a.endsWith(2), true); QCOMPARE(a.endsWith(2), true);
} }
QT_WARNING_POP
}; };
#endif
void tst_Collections::vector() void tst_Collections::vector()
@ -2330,11 +2341,16 @@ void populate(QList<int> &container)
container << 1 << 2 << 4 << 8; container << 1 << 2 << 4 << 8;
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
template <> template <>
void populate(QLinkedList<int> &container) void populate(QLinkedList<int> &container)
{ {
container << 1 << 2 << 4 << 8; container << 1 << 2 << 4 << 8;
} }
QT_WARNING_POP
#endif
template <> template <>
void populate(QVector<int> &container) void populate(QVector<int> &container)
@ -2431,10 +2447,15 @@ void tst_Collections::sharableQList()
TEST_SEQUENTIAL_CONTAINER(List); TEST_SEQUENTIAL_CONTAINER(List);
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
void tst_Collections::sharableQLinkedList() void tst_Collections::sharableQLinkedList()
{ {
TEST_SEQUENTIAL_CONTAINER(LinkedList); TEST_SEQUENTIAL_CONTAINER(LinkedList);
} }
QT_WARNING_POP
#endif
void tst_Collections::sharableQVector() void tst_Collections::sharableQVector()
{ {
@ -2755,7 +2776,12 @@ void tst_Collections::constAndNonConstStlIterators()
{ {
testListLikeStlIterators<QList<int> >(); testListLikeStlIterators<QList<int> >();
testListLikeStlIterators<QStringList >(); testListLikeStlIterators<QStringList >();
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
testLinkedListLikeStlIterators<QLinkedList<int> >(); testLinkedListLikeStlIterators<QLinkedList<int> >();
QT_WARNING_POP
#endif
testListLikeStlIterators<QVector<int> >(); testListLikeStlIterators<QVector<int> >();
testMapLikeStlIterators<QMap<QString, QString> >(); testMapLikeStlIterators<QMap<QString, QString> >();
testMapLikeStlIterators<QMultiMap<QString, QString> >(); testMapLikeStlIterators<QMultiMap<QString, QString> >();
@ -2798,6 +2824,7 @@ void tst_Collections::vector_stl()
QCOMPARE(QVector<QString>(stdVector.begin(), stdVector.end()), vector); QCOMPARE(QVector<QString>(stdVector.begin(), stdVector.end()), vector);
} }
#if QT_DEPRECATED_SINCE(5, 15)
void tst_Collections::linkedlist_stl_data() void tst_Collections::linkedlist_stl_data()
{ {
list_stl_data(); list_stl_data();
@ -2805,6 +2832,8 @@ void tst_Collections::linkedlist_stl_data()
void tst_Collections::linkedlist_stl() void tst_Collections::linkedlist_stl()
{ {
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QFETCH(QStringList, elements); QFETCH(QStringList, elements);
QLinkedList<QString> list; QLinkedList<QString> list;
@ -2821,7 +2850,9 @@ void tst_Collections::linkedlist_stl()
QCOMPARE(*it, *it2); QCOMPARE(*it, *it2);
QCOMPARE(QLinkedList<QString>::fromStdList(stdList), list); QCOMPARE(QLinkedList<QString>::fromStdList(stdList), list);
QT_WARNING_POP
} }
#endif
void tst_Collections::list_stl_data() void tst_Collections::list_stl_data()
{ {
@ -3070,6 +3101,10 @@ void tst_Collections::containerInstantiation()
typedef QSet<EqualsComparable> Set; typedef QSet<EqualsComparable> Set;
instantiateAssociative<Set, EqualsComparable>(); instantiateAssociative<Set, EqualsComparable>();
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
//Instantiate QLinkedList member functions. //Instantiate QLinkedList member functions.
typedef QLinkedList<EqualsComparable> LinkedList; typedef QLinkedList<EqualsComparable> LinkedList;
instantiateSequence<LinkedList, EqualsComparable> (); instantiateSequence<LinkedList, EqualsComparable> ();
@ -3078,6 +3113,8 @@ void tst_Collections::containerInstantiation()
LinkedList list; LinkedList list;
list.removeAll(value); list.removeAll(value);
} }
QT_WARNING_POP
#endif
//Instantiate QList member functions. //Instantiate QList member functions.
typedef QList<EqualsComparable> List; typedef QList<EqualsComparable> List;
@ -3185,7 +3222,12 @@ void tst_Collections::containerTypedefs()
testContainerTypedefs(QVector<int>()); testContainerTypedefs(QVector<int>());
testContainerTypedefs(QStack<int>()); testContainerTypedefs(QStack<int>());
testContainerTypedefs(QList<int>()); testContainerTypedefs(QList<int>());
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
testContainerTypedefs(QLinkedList<int>()); testContainerTypedefs(QLinkedList<int>());
QT_WARNING_POP
#endif
testContainerTypedefs(QQueue<int>()); testContainerTypedefs(QQueue<int>());
testPairAssociativeContainerTypedefs(QMap<int, 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 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 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) } { 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) } { 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 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 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) } { 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<QVector>();
QTBUG13079_collectionInsideCollectionImpl<QStack>(); QTBUG13079_collectionInsideCollectionImpl<QStack>();
QTBUG13079_collectionInsideCollectionImpl<QList>(); QTBUG13079_collectionInsideCollectionImpl<QList>();
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QTBUG13079_collectionInsideCollectionImpl<QLinkedList>(); QTBUG13079_collectionInsideCollectionImpl<QLinkedList>();
QT_WARNING_POP
#endif
QTBUG13079_collectionInsideCollectionImpl<QQueue>(); QTBUG13079_collectionInsideCollectionImpl<QQueue>();
{ {

View File

@ -324,11 +324,12 @@ private Q_SLOTS:
#endif #endif
} }
void ranged_ctor_QLinkedList_int() { ranged_ctor_non_associative_impl<QLinkedList<int>>(); } #if QT_DEPRECATED_SINCE(5, 15)
void ranged_ctor_QLinkedList_Movable() { ranged_ctor_non_associative_impl<QLinkedList<Movable>>(); } void ranged_ctor_QLinkedList_int();
void ranged_ctor_QLinkedList_Complex() { ranged_ctor_non_associative_impl<QLinkedList<Complex>>(); } void ranged_ctor_QLinkedList_Movable();
void ranged_ctor_QLinkedList_duplicates_strategy() { non_associative_container_duplicates_strategy<QLinkedList>(); } 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_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_Movable() { ranged_ctor_non_associative_impl<std::set<Movable>>(); }
void ranged_ctor_std_set_Complex() { ranged_ctor_non_associative_impl<std::set<Complex>>(); } 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_std_vector() { front_back_impl<std::vector<int>>(); }
void front_back_QVector() { front_back_impl<QVector<int>>(); } void front_back_QVector() { front_back_impl<QVector<int>>(); }
void front_back_QList() { front_back_impl<QList<qintptr>>(); } 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_QVarLengthArray() { front_back_impl<QVarLengthArray<int>>(); }
void front_back_QString() { front_back_impl<QString>(); } void front_back_QString() { front_back_impl<QString>(); }
void front_back_QStringRef() { front_back_impl<QStringRef>(); } void front_back_QStringRef() { front_back_impl<QStringRef>(); }
@ -590,8 +593,13 @@ template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::forward_list<T...>> : ContainerAcceptsDuplicateValues {}; struct ContainerDuplicatedValuesStrategy<std::forward_list<T...>> : ContainerAcceptsDuplicateValues {};
#endif #endif
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
template<typename ... T> template<typename ... T>
struct ContainerDuplicatedValuesStrategy<QLinkedList<T...>> : ContainerAcceptsDuplicateValues {}; struct ContainerDuplicatedValuesStrategy<QLinkedList<T...>> : ContainerAcceptsDuplicateValues {};
QT_WARNING_POP
#endif
// assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution // assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution
template<typename ... T> template<typename ... T>
@ -819,5 +827,35 @@ void tst_ContainerApiSymmetry::front_back_impl() const
QCOMPARE(clean(qAsConst(c2).back()), V(2)); 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) QTEST_APPLESS_MAIN(tst_ContainerApiSymmetry)
#include "tst_containerapisymmetry.moc" #include "tst_containerapisymmetry.moc"

View File

@ -29,6 +29,10 @@
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QLinkedList> #include <QLinkedList>
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct Movable struct Movable
{ {
Movable(char input = 'j') : i(input), state(Constructed) Movable(char input = 'j') : i(input), state(Constructed)
@ -1129,5 +1133,16 @@ void tst_QLinkedList::setSharableInt() const
#endif #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) QTEST_APPLESS_MAIN(tst_QLinkedList)
#include "tst_qlinkedlist.moc" #include "tst_qlinkedlist.moc"