From eab9b132506b63473e5ffc63779a9cc6c0e47410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 15 May 2012 12:48:07 +0200 Subject: [PATCH] TgaImporter: test for opening inexistent files. --- src/Plugins/TgaImporter/Test/TgaImporterTest.cpp | 9 +++++++++ src/Plugins/TgaImporter/Test/TgaImporterTest.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp index 2adf5bd56..a237555d0 100644 --- a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp @@ -27,6 +27,15 @@ QTEST_APPLESS_MAIN(Magnum::Trade::TgaImporter::Test::TgaImporterTest) namespace Magnum { namespace Trade { namespace TgaImporter { namespace Test { +void TgaImporterTest::openInexistent() { + ostringstream debug; + Error::setOutput(&debug); + + TgaImporter importer; + QVERIFY(!importer.open("inexistent.file")); + QCOMPARE(debug.str().c_str(), "TgaImporter: cannot open file inexistent.file\n"); +} + void TgaImporterTest::paletted() { const char data[] = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; istringstream in(string(data, sizeof(data))); diff --git a/src/Plugins/TgaImporter/Test/TgaImporterTest.h b/src/Plugins/TgaImporter/Test/TgaImporterTest.h index b1a8f2554..f4647c681 100644 --- a/src/Plugins/TgaImporter/Test/TgaImporterTest.h +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.h @@ -23,6 +23,7 @@ class TgaImporterTest: public QObject { Q_OBJECT private slots: + void openInexistent(); void paletted(); void nonRgb(); void bits16();