From 08bc70545db530cfc2f2d123f15966d21cd580c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 6 Jan 2021 12:47:35 +0100 Subject: [PATCH] Vk: test also that PixelFormat debug output matches for each value. --- src/Magnum/Vk/Test/PixelFormatTest.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Vk/Test/PixelFormatTest.cpp b/src/Magnum/Vk/Test/PixelFormatTest.cpp index 86fa9f0f2..4286f4203 100644 --- a/src/Magnum/Vk/Test/PixelFormatTest.cpp +++ b/src/Magnum/Vk/Test/PixelFormatTest.cpp @@ -78,7 +78,8 @@ void PixelFormatTest::map() { - that the entries are ordered by number by comparing a function to expected result (so insertion here is done in proper place) - that there was no gap (unhandled value inside the range) - - that a particular pixel format maps to a particular vkFormat */ + - that a particular generic format maps to a particular format + - that the debug output matches what was converted */ #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic error "-Wswitch" @@ -90,6 +91,11 @@ void PixelFormatTest::map() { CORRADE_COMPARE(firstUnhandled, 0xffff); \ CORRADE_VERIFY(hasPixelFormat(Magnum::PixelFormat::format)); \ CORRADE_COMPARE(pixelFormat(Magnum::PixelFormat::format), PixelFormat::format); \ + { \ + std::ostringstream out; \ + Debug{&out} << pixelFormat(Magnum::PixelFormat::format); \ + CORRADE_COMPARE(out.str(), "Vk::PixelFormat::" #format "\n"); \ + } \ ++nextHandled; \ continue; #define _s(format) \ @@ -180,7 +186,8 @@ void PixelFormatTest::mapCompressed() { - that the entries are ordered by number by comparing a function to expected result (so insertion here is done in proper place) - that there was no gap (unhandled value inside the range) - - that a particular pixel format maps to a particular VkFormat */ + - that a particular generic format maps to a particular format + - that the debug output matches what was converted */ #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic error "-Wswitch" @@ -192,6 +199,11 @@ void PixelFormatTest::mapCompressed() { CORRADE_COMPARE(firstUnhandled, 0xffff); \ CORRADE_VERIFY(hasPixelFormat(Magnum::CompressedPixelFormat::format)); \ CORRADE_COMPARE(pixelFormat(Magnum::CompressedPixelFormat::format), PixelFormat::Compressed ## expectedFormat); \ + { \ + std::ostringstream out; \ + Debug{&out} << pixelFormat(Magnum::CompressedPixelFormat::format); \ + CORRADE_COMPARE(out.str(), "Vk::PixelFormat::Compressed" #expectedFormat "\n"); \ + } \ ++nextHandled; \ continue; #define _s(format) \