Commit b70a8d60 authored by Agata Cacko's avatar Agata Cacko

Improve exr error codes, remove raw wrong tests

Raw is an import-only format, so export tests shouldn't be used.
Exr returned Failure before, now it returns ErrorWhileReading or
ErrorWhileWriting. Tests were changed to allow for that sitation
(since exr filter doesn't know whether it can't read the file or
just parse it).
parent d21b28f9
......@@ -908,13 +908,14 @@ KisImportExportErrorCode EXRConverter::decode(const QString &filename)
} catch (std::exception &e) {
dbgFile << "Error while reading from the exr file: " << e.what();
KisImportExportAdditionalChecks checks;
if (!checks.doesFileExist(filename)) {
return ImportExportCodes::FileNotExist;
} else if(!checks.isFileReadable(filename)) {
return ImportExportCodes::NoAccessToRead;
} else {
return ImportExportCodes::Failure;
return ImportExportCodes::ErrorWhileReading;
}
}
......@@ -1387,7 +1388,7 @@ KisImportExportErrorCode EXRConverter::buildFile(const QString &filename, KisGro
if (!checks.isFileWriteable(QFile::encodeName(filename))) {
return ImportExportCodes::NoAccessToWrite;
}
return ImportExportCodes::Failure;
return ImportExportCodes::ErrorWhileWriting;
}
}
......
......@@ -45,7 +45,7 @@ void KisExrTest::testImportFromWriteonly()
void KisExrTest::testExportToReadonly()
{
TestUtil::testExportToReadonly(QString(FILES_DATA_DIR), ExrMimetype);
TestUtil::testExportToReadonly(QString(FILES_DATA_DIR), ExrMimetype, true);
}
void KisExrTest::testImportIncorrectFormat()
......
......@@ -39,12 +39,6 @@ void KisRawTest::testImportFromWriteonly()
}
void KisRawTest::testExportToReadonly()
{
TestUtil::testExportToReadonly(QString(FILES_DATA_DIR), RawMimetype);
}
void KisRawTest::testImportIncorrectFormat()
{
TestUtil::testImportIncorrectFormat(QString(FILES_DATA_DIR), RawMimetype);
......
......@@ -27,7 +27,6 @@ class KisRawTest : public QObject
private Q_SLOTS:
void testImportFromWriteonly();
void testExportToReadonly();
void testImportIncorrectFormat();
};
......
......@@ -286,7 +286,8 @@ void testImportIncorrectFormat(const QString& _dirname, QString mimetype = "")
delete doc;
QVERIFY(!status.isOk());
QVERIFY(status == KisImportExportErrorCode(ImportExportCodes::FileFormatIncorrect));
QVERIFY(status == KisImportExportErrorCode(ImportExportCodes::FileFormatIncorrect)
|| status == KisImportExportErrorCode(ImportExportCodes::ErrorWhileReading)); // in case the filter doesn't know if it can't read or just parse
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment