diff --git a/src/Plugins/TGAImporter/CMakeLists.txt b/src/Plugins/TGAImporter/CMakeLists.txt deleted file mode 100644 index 07c9e288d..000000000 --- a/src/Plugins/TGAImporter/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -corrade_add_plugin(TGAImporter ${MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR} TGAImporter.conf TGAImporter.cpp) -target_link_libraries(TGAImporter ${MAGNUM_LIBRARY}) - -if(BUILD_TESTS) - add_library(TGAImporterTestLib TGAImporter.cpp) - target_link_libraries(TGAImporterTestLib ${MAGNUM_LIBRARY} ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY}) - enable_testing() - add_subdirectory(Test) -endif() - -if(WIN32) - target_link_libraries(TGAImporter ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY}) -endif() diff --git a/src/Plugins/TGAImporter/Test/CMakeLists.txt b/src/Plugins/TGAImporter/Test/CMakeLists.txt deleted file mode 100644 index 791ea97db..000000000 --- a/src/Plugins/TGAImporter/Test/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -corrade_add_test(TGAImporterTest TGAImporterTest.h TGAImporterTest.cpp) -target_link_libraries(TGAImporterTest TGAImporterTestLib) diff --git a/src/Plugins/TgaImporter/CMakeLists.txt b/src/Plugins/TgaImporter/CMakeLists.txt new file mode 100644 index 000000000..d776849f9 --- /dev/null +++ b/src/Plugins/TgaImporter/CMakeLists.txt @@ -0,0 +1,13 @@ +corrade_add_plugin(TgaImporter ${MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR} TgaImporter.conf TgaImporter.cpp) +target_link_libraries(TgaImporter ${MAGNUM_LIBRARY}) + +if(BUILD_TESTS) + add_library(TgaImporterTestLib TgaImporter.cpp) + target_link_libraries(TgaImporterTestLib ${MAGNUM_LIBRARY} ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY}) + enable_testing() + add_subdirectory(Test) +endif() + +if(WIN32) + target_link_libraries(TgaImporter ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY}) +endif() diff --git a/src/Plugins/TgaImporter/Test/CMakeLists.txt b/src/Plugins/TgaImporter/Test/CMakeLists.txt new file mode 100644 index 000000000..04005d2cf --- /dev/null +++ b/src/Plugins/TgaImporter/Test/CMakeLists.txt @@ -0,0 +1,2 @@ +corrade_add_test(TgaImporterTest TgaImporterTest.h TgaImporterTest.cpp) +target_link_libraries(TgaImporterTest TgaImporterTestLib) diff --git a/src/Plugins/TGAImporter/Test/TGAImporterTest.cpp b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp similarity index 79% rename from src/Plugins/TGAImporter/Test/TGAImporterTest.cpp rename to src/Plugins/TgaImporter/Test/TgaImporterTest.cpp index 3db36c206..231839da9 100644 --- a/src/Plugins/TGAImporter/Test/TGAImporterTest.cpp +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp @@ -13,64 +13,64 @@ GNU Lesser General Public License version 3 for more details. */ -#include "TGAImporterTest.h" +#include "TgaImporterTest.h" #include #include "Utility/Debug.h" -#include "../TGAImporter.h" +#include "../TgaImporter.h" using namespace std; using namespace Corrade::Utility; -QTEST_APPLESS_MAIN(Magnum::Trade::TGAImporter::Test::TGAImporterTest) +QTEST_APPLESS_MAIN(Magnum::Trade::TgaImporter::Test::TgaImporterTest) -namespace Magnum { namespace Trade { namespace TGAImporter { namespace Test { +namespace Magnum { namespace Trade { namespace TgaImporter { namespace Test { -void TGAImporterTest::paletted() { +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))); ostringstream debug; Error::setOutput(&debug); - TGAImporter importer; + TgaImporter importer; QVERIFY(!importer.open(in)); - QCOMPARE(debug.str().c_str(), "TGAImporter: paletted files are not supported\n"); + QCOMPARE(debug.str().c_str(), "TgaImporter: paletted files are not supported\n"); } -void TGAImporterTest::nonRgb() { +void TgaImporterTest::nonRgb() { const char data[] = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; istringstream in(string(data, sizeof(data))); ostringstream debug; Error::setOutput(&debug); - TGAImporter importer; + TgaImporter importer; QVERIFY(!importer.open(in)); - QCOMPARE(debug.str().c_str(), "TGAImporter: non-RGB files are not supported\n"); + QCOMPARE(debug.str().c_str(), "TgaImporter: non-RGB files are not supported\n"); } -void TGAImporterTest::bits16() { +void TgaImporterTest::bits16() { const char data[] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0 }; istringstream in(string(data, sizeof(data))); ostringstream debug; Error::setOutput(&debug); - TGAImporter importer; + TgaImporter importer; QVERIFY(!importer.open(in)); - QCOMPARE(debug.str().c_str(), "TGAImporter: unsupported bits-per-pixel: 16\n"); + QCOMPARE(debug.str().c_str(), "TgaImporter: unsupported bits-per-pixel: 16\n"); } -void TGAImporterTest::bits24() { +void TgaImporterTest::bits24() { const char data[] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 24, 0, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8 }; std::istringstream in(string(data, sizeof(data))); - TGAImporter importer; + TgaImporter importer; QVERIFY(importer.open(in)); auto image = importer.image2D(0); QVERIFY(image->colorFormat() == AbstractTexture::ColorFormat::BGR); @@ -79,14 +79,14 @@ void TGAImporterTest::bits24() { QVERIFY(string(static_cast(image->data())) == string(data + 18, 2*3*3)); } -void TGAImporterTest::bits32() { +void TgaImporterTest::bits32() { const char data[] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 32, 0, 1, 2, 3, 1, 2, 3, 4, 1, 3, 4, 5, 1, 4, 5, 6, 1, 5, 6, 7, 1, 6, 7, 8, 1 }; std::istringstream in(string(data, sizeof(data))); - TGAImporter importer; + TgaImporter importer; QVERIFY(importer.open(in)); auto image = importer.image2D(0); QVERIFY(image->colorFormat() == AbstractTexture::ColorFormat::BGRA); diff --git a/src/Plugins/TGAImporter/Test/TGAImporterTest.h b/src/Plugins/TgaImporter/Test/TgaImporterTest.h similarity index 78% rename from src/Plugins/TGAImporter/Test/TGAImporterTest.h rename to src/Plugins/TgaImporter/Test/TgaImporterTest.h index 5f4a25ec4..b1a8f2554 100644 --- a/src/Plugins/TGAImporter/Test/TGAImporterTest.h +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.h @@ -1,5 +1,5 @@ -#ifndef Magnum_Trade_TGAImporter_Test_TGAImporterTest_h -#define Magnum_Trade_TGAImporter_Test_TGAImporterTest_h +#ifndef Magnum_Trade_TgaImporter_Test_TgaImporterTest_h +#define Magnum_Trade_TgaImporter_Test_TgaImporterTest_h /* Copyright © 2010, 2011, 2012 Vladimír Vondruš @@ -17,9 +17,9 @@ #include -namespace Magnum { namespace Trade { namespace TGAImporter { namespace Test { +namespace Magnum { namespace Trade { namespace TgaImporter { namespace Test { -class TGAImporterTest: public QObject { +class TgaImporterTest: public QObject { Q_OBJECT private slots: diff --git a/src/Plugins/TGAImporter/TGAImporter.conf b/src/Plugins/TgaImporter/TgaImporter.conf similarity index 100% rename from src/Plugins/TGAImporter/TGAImporter.conf rename to src/Plugins/TgaImporter/TgaImporter.conf diff --git a/src/Plugins/TGAImporter/TGAImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp similarity index 77% rename from src/Plugins/TGAImporter/TGAImporter.cpp rename to src/Plugins/TgaImporter/TgaImporter.cpp index 480fac98c..49785ccf1 100644 --- a/src/Plugins/TGAImporter/TGAImporter.cpp +++ b/src/Plugins/TgaImporter/TgaImporter.cpp @@ -13,7 +13,7 @@ GNU Lesser General Public License version 3 for more details. */ -#include "TGAImporter.h" +#include "TgaImporter.h" #include "Utility/Endianness.h" #include "Math/Vector2.h" @@ -22,20 +22,20 @@ using namespace std; using namespace Corrade::Utility; -PLUGIN_REGISTER(Magnum::Trade::TGAImporter::TGAImporter, "cz.mosra.magnum.Trade.AbstractImporter/0.1") +PLUGIN_REGISTER(Magnum::Trade::TgaImporter::TgaImporter, "cz.mosra.magnum.Trade.AbstractImporter/0.1") -namespace Magnum { namespace Trade { namespace TGAImporter { +namespace Magnum { namespace Trade { namespace TgaImporter { -static_assert(sizeof(TGAImporter::Header) == 18, "TGAImporter: header size is not 18 bytes"); +static_assert(sizeof(TgaImporter::Header) == 18, "TgaImporter: header size is not 18 bytes"); -bool TGAImporter::TGAImporter::open(const string& filename) { +bool TgaImporter::TgaImporter::open(const string& filename) { ifstream in(filename.c_str()); bool status = open(in); in.close(); return status; } -bool TGAImporter::open(std::istream& in) { +bool TgaImporter::open(std::istream& in) { if(_image) close(); if(!in.good()) return false; @@ -47,12 +47,12 @@ bool TGAImporter::open(std::istream& in) { header.height = Endianness::littleEndian(header.height); if(header.colorMapType != 0) { - Error() << "TGAImporter: paletted files are not supported"; + Error() << "TgaImporter: paletted files are not supported"; return false; } if(header.imageType != 2) { - Error() << "TGAImporter: non-RGB files are not supported"; + Error() << "TgaImporter: non-RGB files are not supported"; return false; } @@ -65,7 +65,7 @@ bool TGAImporter::open(std::istream& in) { colorFormat = AbstractTexture::ColorFormat::BGRA; break; default: - Error() << "TGAImporter: unsupported bits-per-pixel:" << (int) header.bpp; + Error() << "TgaImporter: unsupported bits-per-pixel:" << (int) header.bpp; return false; } @@ -79,12 +79,12 @@ bool TGAImporter::open(std::istream& in) { return true; } -void TGAImporter::close() { +void TgaImporter::close() { delete _image; _image = nullptr; } -ImageData2D* TGAImporter::image2D(size_t id) { +ImageData2D* TgaImporter::image2D(size_t id) { return _image; } diff --git a/src/Plugins/TGAImporter/TGAImporter.h b/src/Plugins/TgaImporter/TgaImporter.h similarity index 85% rename from src/Plugins/TGAImporter/TGAImporter.h rename to src/Plugins/TgaImporter/TgaImporter.h index ff8b8afe1..fe9a99144 100644 --- a/src/Plugins/TGAImporter/TGAImporter.h +++ b/src/Plugins/TgaImporter/TgaImporter.h @@ -1,5 +1,5 @@ -#ifndef Magnum_Trade_TGAImporter_TGAImporter_h -#define Magnum_Trade_TGAImporter_TGAImporter_h +#ifndef Magnum_Trade_TgaImporter_TgaImporter_h +#define Magnum_Trade_TgaImporter_TgaImporter_h /* Copyright © 2010, 2011, 2012 Vladimír Vondruš @@ -16,17 +16,17 @@ */ /** @file - * @brief Class Magnum::Trade::TGAImporter::TGAImporter + * @brief Class Magnum::Trade::TgaImporter::TgaImporter */ #include "Trade/AbstractImporter.h" -namespace Magnum { namespace Trade { namespace TGAImporter { +namespace Magnum { namespace Trade { namespace TgaImporter { -class TGAImporter: public AbstractImporter { +class TgaImporter: public AbstractImporter { public: - TGAImporter(Corrade::PluginManager::AbstractPluginManager* manager = 0, const std::string& plugin = ""): AbstractImporter(manager, plugin), _image(nullptr) {} - inline virtual ~TGAImporter() { close(); } + TgaImporter(Corrade::PluginManager::AbstractPluginManager* manager = 0, const std::string& plugin = ""): AbstractImporter(manager, plugin), _image(nullptr) {} + inline virtual ~TgaImporter() { close(); } inline int features() const { return OpenFile|OpenStream; }