diff --git a/src/Plugins/TgaImporter/Test/CMakeLists.txt b/src/Plugins/TgaImporter/Test/CMakeLists.txt index 04005d2cf..f53849abf 100644 --- a/src/Plugins/TgaImporter/Test/CMakeLists.txt +++ b/src/Plugins/TgaImporter/Test/CMakeLists.txt @@ -1,2 +1 @@ -corrade_add_test(TgaImporterTest TgaImporterTest.h TgaImporterTest.cpp) -target_link_libraries(TgaImporterTest TgaImporterTestLib) +corrade_add_test2(TgaImporterTest TgaImporterTest.cpp LIBRARIES TgaImporterTestLib) diff --git a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp index be277984d..7f084bacd 100644 --- a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp @@ -15,24 +15,31 @@ #include "TgaImporterTest.h" -#include - -#include "Utility/Debug.h" #include "../TgaImporter.h" using namespace std; -QTEST_APPLESS_MAIN(Magnum::Trade::TgaImporter::Test::TgaImporterTest) +CORRADE_TEST_MAIN(Magnum::Trade::TgaImporter::Test::TgaImporterTest) namespace Magnum { namespace Trade { namespace TgaImporter { namespace Test { +TgaImporterTest::TgaImporterTest() { + addTests(&TgaImporterTest::openInexistent, + &TgaImporterTest::openShort, + &TgaImporterTest::paletted, + &TgaImporterTest::nonRgb, + &TgaImporterTest::bits16, + &TgaImporterTest::bits24, + &TgaImporterTest::bits32); +} + 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"); + CORRADE_VERIFY(!importer.open("inexistent.file")); + CORRADE_COMPARE(debug.str(), "TgaImporter: cannot open file inexistent.file\n"); } void TgaImporterTest::openShort() { @@ -43,8 +50,8 @@ void TgaImporterTest::openShort() { Error::setOutput(&debug); TgaImporter importer; - QVERIFY(!importer.open(in)); - QCOMPARE(debug.str().c_str(), "TgaImporter: the file is too short: 17 bytes\n"); + CORRADE_VERIFY(!importer.open(in)); + CORRADE_COMPARE(debug.str(), "TgaImporter: the file is too short: 17 bytes\n"); } void TgaImporterTest::paletted() { @@ -55,8 +62,8 @@ void TgaImporterTest::paletted() { Error::setOutput(&debug); TgaImporter importer; - QVERIFY(!importer.open(in)); - QCOMPARE(debug.str().c_str(), "TgaImporter: paletted files are not supported\n"); + CORRADE_VERIFY(!importer.open(in)); + CORRADE_COMPARE(debug.str(), "TgaImporter: paletted files are not supported\n"); } void TgaImporterTest::nonRgb() { @@ -67,8 +74,8 @@ void TgaImporterTest::nonRgb() { Error::setOutput(&debug); TgaImporter importer; - QVERIFY(!importer.open(in)); - QCOMPARE(debug.str().c_str(), "TgaImporter: non-RGB files are not supported\n"); + CORRADE_VERIFY(!importer.open(in)); + CORRADE_COMPARE(debug.str(), "TgaImporter: non-RGB files are not supported\n"); } void TgaImporterTest::bits16() { @@ -79,8 +86,8 @@ void TgaImporterTest::bits16() { Error::setOutput(&debug); TgaImporter importer; - QVERIFY(!importer.open(in)); - QCOMPARE(debug.str().c_str(), "TgaImporter: unsupported bits-per-pixel: 16\n"); + CORRADE_VERIFY(!importer.open(in)); + CORRADE_COMPARE(debug.str(), "TgaImporter: unsupported bits-per-pixel: 16\n"); } void TgaImporterTest::bits24() { @@ -91,12 +98,12 @@ void TgaImporterTest::bits24() { std::istringstream in(string(data, sizeof(data))); TgaImporter importer; - QVERIFY(importer.open(in)); + CORRADE_VERIFY(importer.open(in)); auto image = importer.image2D(0); - QVERIFY(image->components() == AbstractImage::Components::BGR); - QVERIFY(image->dimensions() == Math::Vector2(2, 3)); - QVERIFY(image->type() == TypeTraits::imageType()); - QVERIFY(string(static_cast(image->data())) == string(data + 18, 2*3*3)); + CORRADE_VERIFY(image->components() == AbstractImage::Components::BGR); + CORRADE_COMPARE(image->dimensions(), Math::Vector2(2, 3)); + CORRADE_VERIFY(image->type() == TypeTraits::imageType()); + CORRADE_COMPARE(string(static_cast(image->data()), 2*3*3), string(data + 18, 2*3*3)); } void TgaImporterTest::bits32() { @@ -107,12 +114,12 @@ void TgaImporterTest::bits32() { std::istringstream in(string(data, sizeof(data))); TgaImporter importer; - QVERIFY(importer.open(in)); + CORRADE_VERIFY(importer.open(in)); auto image = importer.image2D(0); - QVERIFY(image->components() == AbstractImage::Components::BGRA); - QVERIFY(image->dimensions() == Math::Vector2(2, 3)); - QVERIFY(image->type() == TypeTraits::imageType()); - QVERIFY(string(static_cast(image->data()), 2*3*3) == string(data + 18, 2*3*3)); + CORRADE_VERIFY(image->components() == AbstractImage::Components::BGRA); + CORRADE_COMPARE(image->dimensions(), Math::Vector2(2, 3)); + CORRADE_VERIFY(image->type() == TypeTraits::imageType()); + CORRADE_COMPARE(string(static_cast(image->data()), 2*3*3), string(data + 18, 2*3*3)); } }}}} diff --git a/src/Plugins/TgaImporter/Test/TgaImporterTest.h b/src/Plugins/TgaImporter/Test/TgaImporterTest.h index e4d0f1fac..2f105ac30 100644 --- a/src/Plugins/TgaImporter/Test/TgaImporterTest.h +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Trade { namespace TgaImporter { namespace Test { -class TgaImporterTest: public QObject { - Q_OBJECT +class TgaImporterTest: public Corrade::TestSuite::Tester { + public: + TgaImporterTest(); - private slots: void openInexistent(); void openShort(); void paletted();