Check status of QDataStream in QTimeZone tests using it

It makes sense to verify the stream is OK after writing and reading,
so add those tests.

Change-Id: I459856ed0d991bc3bbe4044b6694c97970cf2787
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2025-04-09 17:25:39 +02:00
parent 0278a80d68
commit 5a911f72c6

View File

@ -493,11 +493,13 @@ void tst_QTimeZone::dataStreamTest()
{
QDataStream ds(&tmp, QIODevice::WriteOnly);
ds << tz1;
QCOMPARE(ds.status(), QDataStream::Ok);
}
QTimeZone tz2("UTC-12:00"); // Shall be over-written.
{
QDataStream ds(&tmp, QIODevice::ReadOnly);
ds >> tz2;
QCOMPARE(ds.status(), QDataStream::Ok);
}
QCOMPARE(tz2.id(), "QST"_ba);
QCOMPARE(tz2.comment(), u"Qt Testing"_s);
@ -515,10 +517,12 @@ void tst_QTimeZone::dataStreamTest()
{
QDataStream ds(&tmp, QIODevice::WriteOnly);
ds << tz1;
QCOMPARE(ds.status(), QDataStream::Ok);
}
{
QDataStream ds(&tmp, QIODevice::ReadOnly);
ds >> tz2;
QCOMPARE(ds.status(), QDataStream::Ok);
}
QCOMPARE(tz2.isValid(), true);
QCOMPARE(tz2.id(), tz1.id());
@ -533,11 +537,13 @@ void tst_QTimeZone::dataStreamTest()
{
QDataStream ds(&tmp, QIODevice::WriteOnly);
ds << tz1;
QCOMPARE(ds.status(), QDataStream::Ok);
}
tz2 = QTimeZone("UTC");
{
QDataStream ds(&tmp, QIODevice::ReadOnly);
ds >> tz2;
QCOMPARE(ds.status(), QDataStream::Ok);
}
QCOMPARE(tz2.id(), tz1.id());
#endif