Repository: AvaloniaUI/Avalonia
File: tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs (C#)

Code before:

                Assert.NotNull(textLine);

                var textBounds = textLine.GetTextBounds(10, 1);

                Assert.Equal(1, textBounds.Count);

                var firstBounds = textBounds[0];

                Assert.NotEmpty(firstBounds.TextRunBounds);

                var firstRunBounds = firstBounds.TextRunBounds[0];

                Assert.Equal(1, firstRunBounds.Length);
            }
        }

        [Fact]
        public void Should_Get_TextBounds_With_Glue()
        {
            using (Start())
            {
                var typeface = Typeface.Default;

                var defaultProperties = new GenericTextRunProperties(typeface);
                var text = "a‬‬‬‬b";
                var shaperOption = new TextShaperOptions(typeface.GlyphTypeface);

                var textSource = new SingleBufferTextSource(text, defaultProperties);

                var formatter = new TextFormatterImpl();

                var textLine =
                    formatter.FormatLine(textSource, 0, double.PositiveInfinity,
                        new GenericTextParagraphProperties(defaultProperties));

                Assert.NotNull(textLine);

                var textBounds = textLine.GetTextBounds(1, 1);

                Assert.NotEmpty(textBounds);

                var firstTextBounds = textBounds[0];

                Assert.NotEmpty(firstTextBounds.TextRunBounds);

                var firstRunBounds = firstTextBounds.TextRunBounds[0];

                Assert.Equal(1, firstRunBounds.TextSourceCharacterIndex);
                Assert.Equal(1, firstRunBounds.Length);
            }

Review comment (suggestion):
```suggestion
                var text = "a\u202C\u202C\u202C\u202Cb";
```

Code after:

                Assert.NotNull(textLine);

                var textBounds = textLine.GetTextBounds(10, 1);

                Assert.Equal(1, textBounds.Count);

                var firstBounds = textBounds[0];

                Assert.NotEmpty(firstBounds.TextRunBounds);

                var firstRunBounds = firstBounds.TextRunBounds[0];

                Assert.Equal(1, firstRunBounds.Length);
            }
        }

        [Fact]
        public void Should_Get_TextBounds_With_Glue()
        {
            using (Start())
            {
                var typeface = Typeface.Default;

                var defaultProperties = new GenericTextRunProperties(typeface);
                var text = "a\u202C\u202C\u202C\u202Cb";
                var shaperOption = new TextShaperOptions(typeface.GlyphTypeface);

                var textSource = new SingleBufferTextSource(text, defaultProperties);

                var formatter = new TextFormatterImpl();

                var textLine =
                    formatter.FormatLine(textSource, 0, double.PositiveInfinity,
                        new GenericTextParagraphProperties(defaultProperties));

                Assert.NotNull(textLine);

                var textBounds = textLine.GetTextBounds(1, 1);

                Assert.NotEmpty(textBounds);

                var firstTextBounds = textBounds[0];

                Assert.NotEmpty(firstTextBounds.TextRunBounds);

                var firstRunBounds = firstTextBounds.TextRunBounds[0];

                Assert.Equal(1, firstRunBounds.TextSourceCharacterIndex);
                Assert.Equal(1, firstRunBounds.Length);
            }