|
|
|
|
@ -59,55 +59,51 @@ void TgaImporterTest::openInexistent() {
|
|
|
|
|
Error::setOutput(&debug); |
|
|
|
|
|
|
|
|
|
TgaImporter importer; |
|
|
|
|
CORRADE_VERIFY(!importer.open("inexistent.file")); |
|
|
|
|
CORRADE_VERIFY(!importer.openFile("inexistent.file")); |
|
|
|
|
CORRADE_COMPARE(debug.str(), "TgaImporter: cannot open file inexistent.file\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void TgaImporterTest::openShort() { |
|
|
|
|
const char data[] = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
|
|
|
|
std::istringstream in(std::string(data, sizeof(data))); |
|
|
|
|
|
|
|
|
|
std::ostringstream debug; |
|
|
|
|
Error::setOutput(&debug); |
|
|
|
|
|
|
|
|
|
TgaImporter importer; |
|
|
|
|
CORRADE_VERIFY(!importer.open(in)); |
|
|
|
|
CORRADE_VERIFY(!importer.openData(data)); |
|
|
|
|
CORRADE_COMPARE(debug.str(), "TgaImporter: the file is too short: 17 bytes\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 }; |
|
|
|
|
std::istringstream in(std::string(data, sizeof(data))); |
|
|
|
|
|
|
|
|
|
std::ostringstream debug; |
|
|
|
|
Error::setOutput(&debug); |
|
|
|
|
|
|
|
|
|
TgaImporter importer; |
|
|
|
|
CORRADE_VERIFY(!importer.open(in)); |
|
|
|
|
CORRADE_VERIFY(!importer.openData(data)); |
|
|
|
|
CORRADE_COMPARE(debug.str(), "TgaImporter: paletted files are not supported\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void TgaImporterTest::nonRgb() { |
|
|
|
|
const char data[] = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
|
|
|
|
std::istringstream in(std::string(data, sizeof(data))); |
|
|
|
|
|
|
|
|
|
std::ostringstream debug; |
|
|
|
|
Error::setOutput(&debug); |
|
|
|
|
|
|
|
|
|
TgaImporter importer; |
|
|
|
|
CORRADE_VERIFY(!importer.open(in)); |
|
|
|
|
CORRADE_VERIFY(!importer.openData(data)); |
|
|
|
|
CORRADE_COMPARE(debug.str(), "TgaImporter: non-RGB files are not supported\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void TgaImporterTest::bits16() { |
|
|
|
|
const char data[] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0 }; |
|
|
|
|
std::istringstream in(std::string(data, sizeof(data))); |
|
|
|
|
|
|
|
|
|
std::ostringstream debug; |
|
|
|
|
Error::setOutput(&debug); |
|
|
|
|
|
|
|
|
|
TgaImporter importer; |
|
|
|
|
CORRADE_VERIFY(!importer.open(in)); |
|
|
|
|
CORRADE_VERIFY(!importer.openData(data)); |
|
|
|
|
CORRADE_COMPARE(debug.str(), "TgaImporter: unsupported bits-per-pixel: 16\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -123,10 +119,9 @@ void TgaImporterTest::bits24() {
|
|
|
|
|
3, 2, 1, 4, 3, 2, 5, 4, 3, 6, 5, 4, 7, 6, 5, 8, 7, 6 |
|
|
|
|
}; |
|
|
|
|
#endif |
|
|
|
|
std::istringstream in(std::string(data, sizeof(data))); |
|
|
|
|
|
|
|
|
|
TgaImporter importer; |
|
|
|
|
CORRADE_VERIFY(importer.open(in)); |
|
|
|
|
CORRADE_VERIFY(importer.openData(data)); |
|
|
|
|
auto image = importer.image2D(0); |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE(image->format(), Trade::ImageData2D::Format::BGR); |
|
|
|
|
@ -150,10 +145,9 @@ void TgaImporterTest::bits32() {
|
|
|
|
|
3, 2, 1, 1, 4, 3, 2, 1, 5, 4, 3, 1, 6, 5, 4, 1, 7, 6, 5, 1, 8, 7, 6, 1 |
|
|
|
|
}; |
|
|
|
|
#endif |
|
|
|
|
std::istringstream in(std::string(data, sizeof(data))); |
|
|
|
|
|
|
|
|
|
TgaImporter importer; |
|
|
|
|
CORRADE_VERIFY(importer.open(in)); |
|
|
|
|
CORRADE_VERIFY(importer.openData(data)); |
|
|
|
|
auto image = importer.image2D(0); |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE(image->format(), Trade::ImageData2D::Format::BGRA); |
|
|
|
|
|