From b9c011bee92f9d0ab67dfd675d7611201c73e6d2 Mon Sep 17 00:00:00 2001 From: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com> Date: Wed, 29 May 2024 11:11:50 -0400 Subject: [PATCH] Added unit test to ensure issue is resolved (#876) --- .../BitmapFonts/BitmapFontTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/MonoGame.Extended.Tests/BitmapFonts/BitmapFontTests.cs b/tests/MonoGame.Extended.Tests/BitmapFonts/BitmapFontTests.cs index 8f751bc4..bea02f22 100644 --- a/tests/MonoGame.Extended.Tests/BitmapFonts/BitmapFontTests.cs +++ b/tests/MonoGame.Extended.Tests/BitmapFonts/BitmapFontTests.cs @@ -59,6 +59,22 @@ namespace MonoGame.Extended.Tests.BitmapFonts Assert.Equal(0, size.Height); } + // Test added for issue #695 + // https://github.com/craftworkgames/MonoGame.Extended/issues/695 + // + // Issue claims measure string does not account for space at the end of string. + [Fact] + public void BitmapFont_MeasureString_SpaceAtEnd_Test() + { + var font = CreateTestFont(); + + var noSpaceAtEnd = font.MeasureString("Hello World"); + var spaceAtEnd = font.MeasureString("Hello World "); + + Assert.NotEqual(noSpaceAtEnd, spaceAtEnd); + + } + private static BitmapFont CreateTestFont() { var textureRegion = new TextureRegion2D(null, x: 219, y: 61, width: 16, height: 18);