diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-10-27 19:43:09 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-11-08 15:19:45 +0000 |
commit | e7998dc187cf8f1218711ac963c441afbea1577c (patch) | |
tree | f367243b5781f09d688d71b9d15c6fcf5a48ecaa /tests/auto/corelib | |
parent | c0b1230108090cf914ccc5329b1213063ed21bdd (diff) |
QCborStreamReader: make sure setDevice() clears the last error
The unit tests weren't running into this problem because the every
setDevice() was preceded by the object being initialized with the exact
same data, so there was never a previous error state. I've only changed
a couple of tests, left the other setDevice() unchanged so we test both
behaviors.
Fixes: QTBUG-71426
Change-Id: I1bd327aeaf73421a8ec5fffd1561a590e3933376
Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp b/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp index 24d9c7409e..3dd4b5114c 100644 --- a/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp +++ b/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp @@ -269,7 +269,7 @@ void tst_QCborStreamReader::integers() quint64 absolute = (isNegative ? expectedRaw + 1 : expectedRaw); QBuffer buffer(&data); - QCborStreamReader reader(data); + QCborStreamReader reader(useDevice ? QByteArray() : data); if (useDevice) { buffer.open(QIODevice::ReadOnly); reader.setDevice(&buffer); @@ -605,7 +605,7 @@ void tst_QCborStreamReader::fixed() removeIndicators(expected); QBuffer buffer(&data); - QCborStreamReader reader(data); + QCborStreamReader reader(useDevice ? QByteArray() : data); if (useDevice) { buffer.open(QIODevice::ReadOnly); reader.setDevice(&buffer); |