diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2016-07-04 15:58:39 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2016-07-04 15:58:39 +0200 |
commit | b5695bd5be908970244919bcd7c19cbf7ccca2c4 (patch) | |
tree | 29f1e2895bef25db5b47e7e2cf01414f6b32ac8d /tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp | |
parent | 840729a931a7d3fefbc4b4a8e01f8b1bd69a427e (diff) | |
parent | b7744e0b05255fc468db2af215ba94eca4b7757b (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ibd81cd1df4a0650d93fcb556a57be90be2e1f569
Diffstat (limited to 'tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp')
-rw-r--r-- | tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index fefe08db30..b7e7344b16 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -1203,10 +1203,11 @@ static QTime qTimeData(int index) case 57: return QTime(23, 59, 59, 99); case 58: return QTime(23, 59, 59, 100); case 59: return QTime(23, 59, 59, 999); + case 60: return QTime(); } return QTime(0, 0, 0); } -#define MAX_QTIME_DATA 60 +#define MAX_QTIME_DATA 61 void tst_QDataStream::stream_QTime_data() { @@ -3132,6 +3133,30 @@ void tst_QDataStream::compatibility_Qt3() QCOMPARE(in_palette.brush(QPalette::Button).style(), Qt::NoBrush); QCOMPARE(in_palette.color(QPalette::Light), QColor(Qt::green)); } + // QTime() was serialized to (0, 0, 0, 0) in Qt3, not (0xFF, 0xFF, 0xFF, 0xFF) + // This is because in Qt3 a null time was valid, and there was no support for deserializing a value of -1. + { + QByteArray stream; + { + QDataStream out(&stream, QIODevice::WriteOnly); + out.setVersion(QDataStream::Qt_3_3); + out << QTime(); + } + QTime in_time; + { + QDataStream in(stream); + in.setVersion(QDataStream::Qt_3_3); + in >> in_time; + } + QVERIFY(in_time.isNull()); + + quint32 rawValue; + QDataStream in(stream); + in.setVersion(QDataStream::Qt_3_3); + in >> rawValue; + QCOMPARE(rawValue, quint32(0)); + } + } void tst_QDataStream::compatibility_Qt2() |