From dd7b0754a0247511333eb86a26fb4446067bc57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 9 Jul 2025 13:26:36 +0200 Subject: [PATCH] Test: test that compressed blocks can be 2D/3D even for 1D/2D images. --- src/Magnum/GL/Test/BufferImageGLTest.cpp | 5 ++++- src/Magnum/Test/ImageTest.cpp | 4 +++- src/Magnum/Test/ImageViewTest.cpp | 4 +++- src/Magnum/Trade/Test/ImageDataTest.cpp | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Magnum/GL/Test/BufferImageGLTest.cpp b/src/Magnum/GL/Test/BufferImageGLTest.cpp index 14336ac66..129f2e326 100644 --- a/src/Magnum/GL/Test/BufferImageGLTest.cpp +++ b/src/Magnum/GL/Test/BufferImageGLTest.cpp @@ -435,8 +435,11 @@ void BufferImageGLTest::constructInvalidSize() { void BufferImageGLTest::constructCompressedInvalidBlockSize() { CORRADE_SKIP_IF_NO_ASSERT(); - /* This is okay */ + /* This is all okay. In particular, it's also completely fine that the Y + and Z size is more than 1 for 1D and 2D. GL might disagree about using + S3TC in 1D images, but the construction itself is fine. */ const char data[8]{}; + CompressedBufferImage1D{CompressedPixelFormat::SRGBS3tcDxt1, 1, data, BufferUsage::StaticDraw}; CompressedBufferImage2D{CompressedPixelStorage{} .setCompressedBlockSize({4, 4, 1}) .setCompressedBlockDataSize(8), diff --git a/src/Magnum/Test/ImageTest.cpp b/src/Magnum/Test/ImageTest.cpp index 9544bb620..4d268bcaa 100644 --- a/src/Magnum/Test/ImageTest.cpp +++ b/src/Magnum/Test/ImageTest.cpp @@ -625,7 +625,9 @@ void ImageTest::constructCompressedUnknownImplementationSpecificBlockSize() { void ImageTest::constructCompressedInvalidBlockSize() { CORRADE_SKIP_IF_NO_ASSERT(); - /* This is all okay */ + /* This is all okay. In particular, it's also completely fine that the Y + and Z size is more than 1 for 1D and 2D. */ + CompressedImage1D{CompressedPixelStorage{}, 666, {4, 5, 6}, 8, 1, Containers::Array{NoInit, 8}}; CompressedImage2D{CompressedPixelStorage{}, 666, {4, 5, 6}, 8, {1, 1}, Containers::Array{NoInit, 8}}; CompressedImage2D{CompressedPixelStorage{} .setCompressedBlockSize({4, 5, 6}) diff --git a/src/Magnum/Test/ImageViewTest.cpp b/src/Magnum/Test/ImageViewTest.cpp index 45b90128e..dcb8fcdf7 100644 --- a/src/Magnum/Test/ImageViewTest.cpp +++ b/src/Magnum/Test/ImageViewTest.cpp @@ -869,8 +869,10 @@ void ImageViewTest::constructCompressedUnknownImplementationSpecificBlockSize() void ImageViewTest::constructCompressedInvalidBlockSize() { CORRADE_SKIP_IF_NO_ASSERT(); - /* This is all okay */ + /* This is all okay. In particular, it's also completely fine that the Y + and Z size is more than 1 for 1D and 2D. */ char data[8]; + CompressedImageView1D{CompressedPixelStorage{}, 666, {4, 5, 6}, 8, 1, data}; CompressedImageView2D{CompressedPixelStorage{}, 666, {4, 5, 6}, 8, {1, 1}, data}; CompressedImageView2D{CompressedPixelStorage{} .setCompressedBlockSize({4, 5, 6}) diff --git a/src/Magnum/Trade/Test/ImageDataTest.cpp b/src/Magnum/Trade/Test/ImageDataTest.cpp index fc6aef471..019333c9a 100644 --- a/src/Magnum/Trade/Test/ImageDataTest.cpp +++ b/src/Magnum/Trade/Test/ImageDataTest.cpp @@ -855,7 +855,9 @@ void ImageDataTest::constructCompressedUnknownImplementationSpecificBlockSize() void ImageDataTest::constructCompressedInvalidBlockSize() { CORRADE_SKIP_IF_NO_ASSERT(); - /* This is all okay */ + /* This is all okay. In particular, it's also completely fine that the Y + and Z size is more than 1 for 1D and 2D. */ + ImageData1D{CompressedPixelStorage{}, 666, {4, 5, 6}, 8, 1, Containers::Array{NoInit, 8}}; ImageData2D{CompressedPixelStorage{}, 666, {4, 5, 6}, 8, {1, 1}, Containers::Array{NoInit, 8}}; ImageData2D{CompressedPixelStorage{} .setCompressedBlockSize({4, 5, 6})