QJniArray: add missing post-increment operator
Augment test case. Found during header review. Pick-to: 6.7 Task-number: QTBUG-119952 Change-Id: I326395397167edb05ff1f45f7151614c02b7e7eb Reviewed-by: Marc Mutz <marc.mutz@qt.io>bb10
parent
8f04615bcd
commit
e5074cd354
|
|
@ -50,6 +50,12 @@ struct QJniArrayIterator
|
|||
++that.m_index;
|
||||
return that;
|
||||
}
|
||||
friend QJniArrayIterator operator++(QJniArrayIterator &that, int) noexcept
|
||||
{
|
||||
auto copy = that;
|
||||
++that;
|
||||
return copy;
|
||||
}
|
||||
|
||||
void swap(QJniArrayIterator &other) noexcept
|
||||
{
|
||||
|
|
|
|||
|
|
@ -92,6 +92,17 @@ void tst_QJniArray::operators()
|
|||
QJniArray<jbyte> array(bytes);
|
||||
QVERIFY(array.isValid());
|
||||
|
||||
{
|
||||
auto it = array.begin();
|
||||
QCOMPARE(*it, 'a');
|
||||
QCOMPARE(*++it, 'b');
|
||||
QCOMPARE(*it++, 'b');
|
||||
QCOMPARE(*it, 'c');
|
||||
++it;
|
||||
it++;
|
||||
QCOMPARE(*it, 'e');
|
||||
QCOMPARE(++it, array.end());
|
||||
}
|
||||
{
|
||||
QJniArray<jbyte>::const_iterator it = {};
|
||||
QCOMPARE(it, QJniArray<jbyte>::const_iterator{});
|
||||
|
|
|
|||
Loading…
Reference in New Issue