aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsonbinding
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-23 20:41:57 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-04-04 09:43:49 +0100
commit082634268a4bd23ff08b9a58d4537eaf800b7b84 (patch)
treea135b81a516b0b5f71f1fa87a45548cc1e196cca /tests/auto/qml/qjsonbinding
parentcd5d2ec701be8de32e83ee778d161de17f1400b4 (diff)
Tests: check that QFile::open succeeds
Wrap it in QVERIFY if possible. If not possible (e.g. a function that returns non-void, or not an autotest function) use qFatal to abort the test. Change-Id: Ie255024d29507e928a94e67d9af1cd436df4f1df Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qjsonbinding')
-rw-r--r--tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp b/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp
index 00372612f1..76fa1328e7 100644
--- a/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp
+++ b/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp
@@ -67,7 +67,8 @@ private:
QByteArray tst_qjsonbinding::readAsUtf8(const QString &fileName)
{
QFile file(testFile(fileName));
- file.open(QIODevice::ReadOnly);
+ if (!file.open(QIODevice::ReadOnly))
+ qFatal("Cannot open file %s", qPrintable(fileName));
QTextStream stream(&file);
return stream.readAll().trimmed().toUtf8();
}