From 251dcbf2cde985f6a62433c6b12448cb9a351d55 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Thu, 6 May 2021 05:50:20 +0200 Subject: [PATCH] Add failing unit test --- .../Media/TextFormatting/TextFormatterTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs b/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs index 05dd32b84d..a1c2dfdec8 100644 --- a/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs +++ b/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs @@ -401,6 +401,24 @@ namespace Avalonia.Skia.UnitTests.Media.TextFormatting Assert.Equal(expectedOffset, textLine.Start); } } + + [Fact] + public void Should_FormatLine_With_Emergency_Breaks() + { + using (Start()) + { + var defaultProperties = new GenericTextRunProperties(Typeface.Default); + var paragraphProperties = new GenericTextParagraphProperties(defaultProperties); + + var textSource = new SingleBufferTextSource("0123456789_0123456789_0123456789_0123456789", defaultProperties); + var formatter = new TextFormatterImpl(); + + var textLine = + formatter.FormatLine(textSource, 0, 33, paragraphProperties); + + Assert.NotNull(textLine.TextLineBreak.RemainingCharacters); + } + } public static IDisposable Start() {