From c46c7f58fba58d6697f69cfa0f9de82975802c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 21 Jan 2025 20:11:51 +0100 Subject: [PATCH] GL: be nice and show a message for this assertion. --- src/Magnum/GL/PixelFormat.cpp | 2 +- src/Magnum/GL/Test/PixelFormatTest.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Magnum/GL/PixelFormat.cpp b/src/Magnum/GL/PixelFormat.cpp index 92fe453bd..4ce4e411b 100644 --- a/src/Magnum/GL/PixelFormat.cpp +++ b/src/Magnum/GL/PixelFormat.cpp @@ -266,7 +266,7 @@ UnsignedInt pixelFormatSize(const PixelFormat format, const PixelType type) { #pragma GCC diagnostic pop #endif - CORRADE_INTERNAL_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ + CORRADE_ASSERT_UNREACHABLE("GL::pixelFormatSize(): unknown" << format << "or" << type, {}); } Containers::Optional genericPixelFormat(const PixelFormat format, PixelType type) { diff --git a/src/Magnum/GL/Test/PixelFormatTest.cpp b/src/Magnum/GL/Test/PixelFormatTest.cpp index f36e94ddf..50290d90e 100644 --- a/src/Magnum/GL/Test/PixelFormatTest.cpp +++ b/src/Magnum/GL/Test/PixelFormatTest.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "Magnum/PixelFormat.h" #include "Magnum/GL/PixelFormat.h" @@ -444,8 +445,12 @@ void PixelFormatTest::sizeInvalid() { Containers::String out; Error redirectError{&out}; + pixelFormatSize(PixelFormat(0xdeadbeef), PixelType(0xbadcafe)); pixelFormatSize(PixelFormat::DepthStencil, PixelType::Float); - CORRADE_COMPARE(out, "GL::pixelFormatSize(): invalid GL::PixelType::Float specified for GL::PixelFormat::DepthStencil\n"); + CORRADE_COMPARE_AS(out, + "GL::pixelFormatSize(): unknown GL::PixelFormat(0xdeadbeef) or GL::PixelType(0xbadcafe)\n" + "GL::pixelFormatSize(): invalid GL::PixelType::Float specified for GL::PixelFormat::DepthStencil\n", + TestSuite::Compare::String); } void PixelFormatTest::mapCompressedFormatTextureFormat() {