From 0f7171f290f0d137b4034c617d4c1fd169079209 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Mon, 11 Apr 2016 10:55:30 +0200 Subject: Better error message when trying to load an invalid resource Before this change QFile::errorString function was returning an "Unknown error". Now it will return the typical ENOENT string. Task-number: QTBUG-45259 Change-Id: Ib7634f1aa5d91f77151cf92c58d3956e20a4cc6b Reviewed-by: hjk --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto/corelib/io/qfile') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 1c695a1113..b1e383dda1 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -543,6 +543,10 @@ void tst_QFile::open_data() << false << QFile::OpenError; QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly) << false << QFile::OpenError; + QTest::newRow("resource_file") << QString::fromLatin1(":/does/not/exist") + << int(QIODevice::ReadOnly) + << false + << QFile::OpenError; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //opening devices requires administrative privileges (and elevation). HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); -- cgit v1.2.3