mirror of https://github.com/qt/qt5compat.git
tst_QLinkedList: compile with QT_NO_JAVA_STYLE_ITERATORS
Temporarily disable tests of Java-style iteration, as qtbase/1d28fd7a9c4720289f3d41db2ed8e6fcb07d5a30 unconditionally re-enabled QT_NO_JAVA_STYLE_ITERATORS, with no API to disable it, breaking integration. This commit disables the Java-style iterator code whereas the next one reverts this and uses the API introduced in qtbase/1d28fd7a9c4720289f3d41db2ed8e6fcb07d5a30 to re-disable QT_NO_JAVA_STYLE_ITERATORS. Fixes: QTBUG-100359 Pick-to: 6.3 6.2 Change-Id: I41ea0d50d1d94ff57891241cf11645d7450432d0 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
parent
bd891d87af
commit
93be44c9c1
|
@ -1095,6 +1095,7 @@ void tst_QLinkedList::iterators() const
|
||||||
list << 4 << 5 << 6;
|
list << 4 << 5 << 6;
|
||||||
QVERIFY(!list.isEmpty());
|
QVERIFY(!list.isEmpty());
|
||||||
QVERIFY(list.size() == 6);
|
QVERIFY(list.size() == 6);
|
||||||
|
#ifndef QT_NO_JAVA_STYLE_ITERATORS
|
||||||
{
|
{
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
QLinkedListIterator<int> i = list;
|
QLinkedListIterator<int> i = list;
|
||||||
|
@ -1103,6 +1104,7 @@ void tst_QLinkedList::iterators() const
|
||||||
}
|
}
|
||||||
QVERIFY(sum == 21);
|
QVERIFY(sum == 21);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
QLinkedList<int>::const_iterator i = list.begin();
|
QLinkedList<int>::const_iterator i = list.begin();
|
||||||
|
@ -1111,10 +1113,16 @@ void tst_QLinkedList::iterators() const
|
||||||
QVERIFY(sum == 21);
|
QVERIFY(sum == 21);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_JAVA_STYLE_ITERATORS
|
||||||
QMutableLinkedListIterator<int> i = list;
|
QMutableLinkedListIterator<int> i = list;
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
i.setValue(2 * i.next());
|
i.setValue(2 * i.next());
|
||||||
|
#else
|
||||||
|
for (auto &e : list)
|
||||||
|
e *= 2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef QT_NO_JAVA_STYLE_ITERATORS
|
||||||
{
|
{
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
QLinkedListIterator<int> i = list;
|
QLinkedListIterator<int> i = list;
|
||||||
|
@ -1123,12 +1131,19 @@ void tst_QLinkedList::iterators() const
|
||||||
sum += i.previous();
|
sum += i.previous();
|
||||||
QVERIFY(sum == 2 * 21);
|
QVERIFY(sum == 2 * 21);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_JAVA_STYLE_ITERATORS
|
||||||
QMutableLinkedListIterator<int> i = list;
|
QMutableLinkedListIterator<int> i = list;
|
||||||
i.toBack();
|
i.toBack();
|
||||||
while (i.hasPrevious())
|
while (i.hasPrevious())
|
||||||
i.setValue(2 * i.previous());
|
i.setValue(2 * i.previous());
|
||||||
|
#else
|
||||||
|
for (auto &e : list)
|
||||||
|
e *= 2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef QT_NO_JAVA_STYLE_ITERATORS
|
||||||
{
|
{
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
QLinkedListIterator<int> i = list;
|
QLinkedListIterator<int> i = list;
|
||||||
|
@ -1205,6 +1220,7 @@ void tst_QLinkedList::iterators() const
|
||||||
while (i.findNext(42))
|
while (i.findNext(42))
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
Loading…
Reference in New Issue