From 4887f45536bcccf40c1d00d2d5f9408be95c2e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Jun 2026 19:24:34 +0200 Subject: [PATCH] Text: cover remaining uncovered lines with tests. --- .../Test/DistanceFieldGlyphCacheGLTest.cpp | 5 +++++ src/Magnum/Text/Test/RendererTest.cpp | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp b/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp index a9700445c..d0c367501 100644 --- a/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp +++ b/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp @@ -289,6 +289,11 @@ void DistanceFieldGlyphCacheGLTest::construct() { } #endif CORRADE_COMPARE(cache.processedSize(), (Vector3i{64, 128, 1})); + #ifdef MAGNUM_BUILD_DEPRECATED + CORRADE_IGNORE_DEPRECATED_PUSH + CORRADE_COMPARE(cache.distanceFieldTextureSize(), (Vector2i{64, 128})); + CORRADE_IGNORE_DEPRECATED_POP + #endif #ifndef MAGNUM_TARGET_GLES CORRADE_COMPARE(cache.texture().imageSize(0), (Vector2i{64, 128})); #endif diff --git a/src/Magnum/Text/Test/RendererTest.cpp b/src/Magnum/Text/Test/RendererTest.cpp index 278a86b5c..5f5b8deb3 100644 --- a/src/Magnum/Text/Test/RendererTest.cpp +++ b/src/Magnum/Text/Test/RendererTest.cpp @@ -7319,6 +7319,11 @@ void RendererTest::clearReset() { /* Fill the renderer with something */ renderer .setCursor({100.0f, 50.0f}) + /* These two are called just to have their overloads in Renderer + covered, other than that they're thoroughly tested for RendererCore + already */ + .setLineAdvance(30.0f) + .setLayoutDirection(LayoutDirection::HorizontalTopToBottom) .add(shaper, 1.0f, "ab\nc"); CORRADE_COMPARE(renderer.renderingGlyphCount(), 3); CORRADE_COMPARE(renderer.renderingRunCount(), 1); @@ -7371,11 +7376,24 @@ void RendererTest::clearReset() { CORRADE_COMPARE(renderer.renderingRunCount(), 0); if(data.reset) { CORRADE_COMPARE(renderer.cursor(), Vector2{}); + CORRADE_COMPARE(renderer.lineAdvance(), 0.0f); + CORRADE_COMPARE(renderer.layoutDirection(), LayoutDirection::HorizontalTopToBottom); } else { CORRADE_COMPARE(renderer.cursor(), (Vector2{100.0f, 50.0f})); + CORRADE_COMPARE(renderer.lineAdvance(), 30.0f); + /** @todo verify with a different value once vertical layout direction + is supported */ + CORRADE_COMPARE(renderer.layoutDirection(), LayoutDirection::HorizontalTopToBottom); } CORRADE_COMPARE(renderer.indexType(), MeshIndexType::UnsignedShort); + /* Clear the custom line advance if it wasn't reset, to not have it affect + the next */ + /** @todo same as in clearResetCore(), this could theoretically hide a bug + where this actually does reset the detected one as well */ + if(!data.reset) + renderer.setLineAdvance(0.0f); + /* Rendering should work the same way after a clear / reset. The Renderer wrappers delegate to RendererCore, which is tested in clearResetCore() already, so just verify that the extra state isn't leaking in any