summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2014-06-24 08:41:11 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2014-06-24 18:48:33 +0200
commit7cc893b2169555a8c4d8242f69e7ef12ebc36185 (patch)
treeab81f6269a591311c7e957aa6ecda4fd82c73319 /tests/auto
parent00dce1cc0078f9633d121908172346cc22deb3c3 (diff)
Fix QRingBuffer::readPointerAtPosition()
Fix condition to allow return a valid pointer when head != 0. Change-Id: I5215f7dfc44924016c2d9b67ab2d9935b5164d7a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
index 6780493206..285cc3042a 100644
--- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
+++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
@@ -111,6 +111,13 @@ void tst_QRingBuffer::readPointerAtPositionWithHead()
buf2 = ringBuffer.readPointerAtPosition(0, length);
QCOMPARE(length, qint64(0));
QVERIFY(buf2 == 0);
+
+ // check buffer with 2 blocks
+ memcpy(ringBuffer.reserve(4), "0123", 4);
+ ringBuffer.append(QByteArray("45678", 5));
+ ringBuffer.free(3);
+ buf2 = ringBuffer.readPointerAtPosition(1, length);
+ QCOMPARE(length, qint64(5));
}
void tst_QRingBuffer::readPointerAtPositionEmptyRead()