Browse Source

Text: cover remaining uncovered lines with tests.

pull/482/merge
Vladimír Vondruš 3 weeks ago
parent
commit
4887f45536
  1. 5
      src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp
  2. 18
      src/Magnum/Text/Test/RendererTest.cpp

5
src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp

@ -289,6 +289,11 @@ void DistanceFieldGlyphCacheGLTest::construct() {
} }
#endif #endif
CORRADE_COMPARE(cache.processedSize(), (Vector3i{64, 128, 1})); 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 #ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(cache.texture().imageSize(0), (Vector2i{64, 128})); CORRADE_COMPARE(cache.texture().imageSize(0), (Vector2i{64, 128}));
#endif #endif

18
src/Magnum/Text/Test/RendererTest.cpp

@ -7319,6 +7319,11 @@ void RendererTest::clearReset() {
/* Fill the renderer with something */ /* Fill the renderer with something */
renderer renderer
.setCursor({100.0f, 50.0f}) .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"); .add(shaper, 1.0f, "ab\nc");
CORRADE_COMPARE(renderer.renderingGlyphCount(), 3); CORRADE_COMPARE(renderer.renderingGlyphCount(), 3);
CORRADE_COMPARE(renderer.renderingRunCount(), 1); CORRADE_COMPARE(renderer.renderingRunCount(), 1);
@ -7371,11 +7376,24 @@ void RendererTest::clearReset() {
CORRADE_COMPARE(renderer.renderingRunCount(), 0); CORRADE_COMPARE(renderer.renderingRunCount(), 0);
if(data.reset) { if(data.reset) {
CORRADE_COMPARE(renderer.cursor(), Vector2{}); CORRADE_COMPARE(renderer.cursor(), Vector2{});
CORRADE_COMPARE(renderer.lineAdvance(), 0.0f);
CORRADE_COMPARE(renderer.layoutDirection(), LayoutDirection::HorizontalTopToBottom);
} else { } else {
CORRADE_COMPARE(renderer.cursor(), (Vector2{100.0f, 50.0f})); 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); 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 /* Rendering should work the same way after a clear / reset. The Renderer
wrappers delegate to RendererCore, which is tested in clearResetCore() wrappers delegate to RendererCore, which is tested in clearResetCore()
already, so just verify that the extra state isn't leaking in any already, so just verify that the extra state isn't leaking in any

Loading…
Cancel
Save