diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-12-12 10:25:01 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-12-16 18:22:21 +0000 |
commit | cdcb39dfdd63fed3173e52a1e43f306a8c7b5e1e (patch) | |
tree | 122ba3f52818f2619192dcdfb0325b9bf897addb /tests/auto/corelib | |
parent | 065c03e6fecca172a2bfdc7740c71bfc4fc746ea (diff) |
tst_qxmlstream: swap WHEN and THEN in readBack()
WHEN writing an invalid character, THEN we expect the writer to report
an error.
The old code had it the wrong way around. It checked that WHEN the
writer reports an error, THEN the character was invalid.
The formulations are equivalent, but the latter is mixing up cause and
effect, making it less clear what's being checked (QXmlStreamWriter,
not isValidSingleTextChar()), so swap.
Change-Id: I703de9ddde98d9913977a913f671472930735900
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 7d0f08094a2318b753ea7d69b71c0abe0a46b3d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index c8f3e9d473..47eb3084e9 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -1695,10 +1695,10 @@ void tst_QXmlStream::readBack() const writer.writeEndDocument(); buffer.close(); - if (writer.hasError()) { - QVERIFY2(!isValidSingleTextChar(c), QByteArray::number(c)); + if (!isValidSingleTextChar(c)) { + QVERIFY2(writer.hasError(), QByteArray::number(c)); } else { - QVERIFY2(isValidSingleTextChar(c), QByteArray::number(c)); + QVERIFY2(!writer.hasError(), QByteArray::number(c)); QVERIFY(buffer.open(QIODevice::ReadOnly)); QXmlStreamReader reader(&buffer); do { |