Baseline test: fix warning from unused QFile::open result

As in other baseline test implementations, exit with a fatal
message when the reference file cannot be opened.

Change-Id: I112f3ed3bfa57af17eab91357dd0056e7b5c5585
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 8092e44167)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2025-02-24 12:21:13 +01:00 committed by Qt Cherry-pick Bot
parent 62fef14aa6
commit 47d06d0d61
1 changed files with 2 additions and 1 deletions

View File

@ -214,7 +214,8 @@ quint16 tst_Graphs::checksumFileOrDir(const QString &path)
if (fi.isFile()) {
QFile f(path);
bool isBinary = path.endsWith(".png") || path.endsWith(".jpg");
f.open(isBinary ? QIODevice::ReadOnly : QIODevice::ReadOnly | QIODevice::Text);
if (!f.open(isBinary ? QIODevice::ReadOnly : QIODevice::ReadOnly | QIODevice::Text))
qFatal("Could not open file %s", qPrintable(path));
QByteArray contents = f.readAll();
return qChecksum(contents);
}