Browse Source

GL: rename test cases for better clarity.

pull/680/head
Vladimír Vondruš 10 months ago
parent
commit
df7f706f05
  1. 56
      src/Magnum/GL/Test/PixelStorageGLTest.cpp

56
src/Magnum/GL/Test/PixelStorageGLTest.cpp

@ -47,43 +47,43 @@ namespace Magnum { namespace GL { namespace Test { namespace {
struct PixelStorageGLTest: OpenGLTester { struct PixelStorageGLTest: OpenGLTester {
explicit PixelStorageGLTest(); explicit PixelStorageGLTest();
void unpack2D(); void alignmentRowLengthSkipXYUnpack2D();
void pack2D(); void alignmentRowLengthSkipXYPack2D();
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void unpack3D(); void alignmentImageHeightRowLengthSkipXYZUnpack3D();
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void pack3D(); void alignmentImageHeightRowLengthSkipXYZPack3D();
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void unpackCompressed2D(); void compressedUnpack2D();
void packCompressed2D(); void compressedPack2D();
void unpackCompressed3D(); void compressedUnpack3D();
void packCompressed3D(); void compressedPack3D();
#endif #endif
}; };
PixelStorageGLTest::PixelStorageGLTest() { PixelStorageGLTest::PixelStorageGLTest() {
addTests({&PixelStorageGLTest::unpack2D, addTests({&PixelStorageGLTest::alignmentRowLengthSkipXYUnpack2D,
&PixelStorageGLTest::pack2D, &PixelStorageGLTest::alignmentRowLengthSkipXYPack2D,
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
&PixelStorageGLTest::unpack3D, &PixelStorageGLTest::alignmentImageHeightRowLengthSkipXYZUnpack3D,
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
&PixelStorageGLTest::pack3D, &PixelStorageGLTest::alignmentImageHeightRowLengthSkipXYZPack3D,
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
&PixelStorageGLTest::unpackCompressed2D, &PixelStorageGLTest::compressedUnpack2D,
&PixelStorageGLTest::packCompressed2D, &PixelStorageGLTest::compressedPack2D,
&PixelStorageGLTest::unpackCompressed3D, &PixelStorageGLTest::compressedUnpack3D,
&PixelStorageGLTest::packCompressed3D &PixelStorageGLTest::compressedPack3D
#endif #endif
}); });
} }
constexpr const char Data2D[] = { constexpr char AlignmentRowLengthSkipXYData2D[]{
/* Row length ------------------------------------------------------ */ /* Alignment */ /* Row length ------------------------------------------------------ */ /* Alignment */
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
@ -100,7 +100,7 @@ constexpr const char ActualData[] = {
'\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00', '\x00' '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00', '\x00'
}; };
void PixelStorageGLTest::unpack2D() { void PixelStorageGLTest::alignmentRowLengthSkipXYUnpack2D() {
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::EXT::unpack_subimage>()) if(!Context::current().isExtensionSupported<Extensions::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::EXT::unpack_subimage::string() << "is not supported."); CORRADE_SKIP(Extensions::EXT::unpack_subimage::string() << "is not supported.");
@ -110,7 +110,7 @@ void PixelStorageGLTest::unpack2D() {
.setAlignment(2) .setAlignment(2)
.setRowLength(3) .setRowLength(3)
.setSkip({1, 3, 0}), .setSkip({1, 3, 0}),
PixelFormat::RGB, PixelType::UnsignedByte, {2, 3}, Data2D}; PixelFormat::RGB, PixelType::UnsignedByte, {2, 3}, AlignmentRowLengthSkipXYData2D};
Texture2D texture; Texture2D texture;
texture.setStorage(1, TextureFormat::RGB8, {2, 3}) texture.setStorage(1, TextureFormat::RGB8, {2, 3})
@ -140,7 +140,7 @@ void PixelStorageGLTest::unpack2D() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
void PixelStorageGLTest::pack2D() { void PixelStorageGLTest::alignmentRowLengthSkipXYPack2D() {
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::NV::pack_subimage>()) if(!Context::current().isExtensionSupported<Extensions::NV::pack_subimage>())
CORRADE_SKIP(Extensions::NV::pack_subimage::string() << "is not supported."); CORRADE_SKIP(Extensions::NV::pack_subimage::string() << "is not supported.");
@ -159,7 +159,7 @@ void PixelStorageGLTest::pack2D() {
.setAlignment(2) .setAlignment(2)
.setRowLength(3) .setRowLength(3)
.setSkip({1, 3, 0}), .setSkip({1, 3, 0}),
PixelFormat::RGB, PixelType::UnsignedByte, {}, Containers::Array<char>{ValueInit, sizeof(Data2D)}}; PixelFormat::RGB, PixelType::UnsignedByte, {}, Containers::Array<char>{ValueInit, sizeof(AlignmentRowLengthSkipXYData2D)}};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
texture.image(0, image); texture.image(0, image);
@ -174,7 +174,7 @@ void PixelStorageGLTest::pack2D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(image.data(), Containers::arrayView(Data2D), CORRADE_COMPARE_AS(image.data(), Containers::arrayView(AlignmentRowLengthSkipXYData2D),
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -198,7 +198,7 @@ constexpr const char Data3D[] = {
/* Filling to image height not needed */ /* Filling to image height not needed */
}; };
void PixelStorageGLTest::unpack3D() { void PixelStorageGLTest::alignmentImageHeightRowLengthSkipXYZUnpack3D() {
PixelStorage storage; PixelStorage storage;
storage.setAlignment(2) storage.setAlignment(2)
.setRowLength(3) .setRowLength(3)
@ -239,7 +239,7 @@ void PixelStorageGLTest::unpack3D() {
/* Testing mainly image height here, which is not available as pack parameter /* Testing mainly image height here, which is not available as pack parameter
in ES */ in ES */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void PixelStorageGLTest::pack3D() { void PixelStorageGLTest::alignmentImageHeightRowLengthSkipXYZPack3D() {
ImageView3D actual{PixelFormat::RGB, PixelType::UnsignedByte, {2, 3, 1}, ActualData}; ImageView3D actual{PixelFormat::RGB, PixelType::UnsignedByte, {2, 3, 1}, ActualData};
Texture3D texture; Texture3D texture;
@ -286,7 +286,7 @@ constexpr const UnsignedByte ActualCompressedData[] = {
232, 57, 0, 0, 213, 255, 170, 2, 232, 57, 0, 0, 213, 255, 170, 2,
}; };
void PixelStorageGLTest::unpackCompressed2D() { void PixelStorageGLTest::compressedUnpack2D() {
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>()) if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported."); CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported.");
@ -313,7 +313,7 @@ void PixelStorageGLTest::unpackCompressed2D() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
void PixelStorageGLTest::packCompressed2D() { void PixelStorageGLTest::compressedPack2D() {
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>()) if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported."); CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported.");
@ -392,7 +392,7 @@ constexpr const UnsignedByte CompressedData3D[] = {
232, 57, 0, 0, 213, 255, 170, 2 232, 57, 0, 0, 213, 255, 170, 2
}; };
void PixelStorageGLTest::unpackCompressed3D() { void PixelStorageGLTest::compressedUnpack3D() {
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>()) if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported."); CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported.");
@ -420,7 +420,7 @@ void PixelStorageGLTest::unpackCompressed3D() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
void PixelStorageGLTest::packCompressed3D() { void PixelStorageGLTest::compressedPack3D() {
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>()) if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported."); CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported.");

Loading…
Cancel
Save