Browse Source

Add tests for the remaining break chars

pull/3644/head
Benedikt Schroeder 6 years ago
parent
commit
938fc79ca7
  1. 17
      tests/Avalonia.Skia.UnitTests/TextLayoutTests.cs

17
tests/Avalonia.Skia.UnitTests/TextLayoutTests.cs

@ -406,9 +406,13 @@ namespace Avalonia.Skia.UnitTests
}
[Theory]
[InlineData("abcde\r\n")]
[InlineData("abcde\n\r")]
public void Should_Break_With_BreakChar_Pair(string text)
[InlineData("abcde\r\n", 7)] // Carriage Return + Line Feed
[InlineData("abcde\n\r", 7)] // This isn't valid but we somehow have to support it.
[InlineData("abcde\u000A", 6)] // Line Feed
[InlineData("abcde\u000B", 6)] // Vertical Tab
[InlineData("abcde\u000C", 6)] // Form Feed
[InlineData("abcde\u000D", 6)] // Carriage Return
public void Should_Break_With_BreakChar(string text, int expectedLength)
{
using (Start())
{
@ -422,11 +426,14 @@ namespace Avalonia.Skia.UnitTests
Assert.Equal(1, layout.TextLines[0].TextRuns.Count);
Assert.Equal(7, ((ShapedTextRun)layout.TextLines[0].TextRuns[0]).GlyphRun.GlyphClusters.Length);
Assert.Equal(expectedLength, ((ShapedTextRun)layout.TextLines[0].TextRuns[0]).GlyphRun.GlyphClusters.Length);
Assert.Equal(5, ((ShapedTextRun)layout.TextLines[0].TextRuns[0]).GlyphRun.GlyphClusters[5]);
Assert.Equal(5, ((ShapedTextRun)layout.TextLines[0].TextRuns[0]).GlyphRun.GlyphClusters[6]);
if(expectedLength == 7)
{
Assert.Equal(5, ((ShapedTextRun)layout.TextLines[0].TextRuns[0]).GlyphRun.GlyphClusters[6]);
}
}
}

Loading…
Cancel
Save