Added unit test to ensure issue is resolved (#876)

This commit is contained in:
Christopher Whitley
2024-05-29 11:11:50 -04:00
committed by GitHub
parent 9239fced04
commit b9c011bee9
@@ -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);