Browse Source

Remove redundant member

pull/9349/head
Benedikt Stebner 3 years ago
parent
commit
0d889da820
  1. 21
      src/Avalonia.Controls/Documents/InlineCollection.cs
  2. 4
      tests/Avalonia.Controls.UnitTests/TextBlockTests.cs

21
src/Avalonia.Controls/Documents/InlineCollection.cs

@ -111,7 +111,14 @@ namespace Avalonia.Controls.Documents
/// <param name="text">The to be added text.</param>
public void Add(string text)
{
AddText(text);
if (InlineHost is TextBlock textBlock && !textBlock.HasComplexContent)
{
textBlock._text += text;
}
else
{
Add(new Run(text));
}
}
/// <summary>
@ -123,18 +130,6 @@ namespace Avalonia.Controls.Documents
Add(new InlineUIContainer(control));
}
internal void AddText(string text)
{
if (InlineHost is TextBlock textBlock && !textBlock.HasComplexContent)
{
textBlock._text += text;
}
else
{
Add(new Run(text));
}
}
/// <summary>
/// Raised when an inline in the collection changes.
/// </summary>

4
tests/Avalonia.Controls.UnitTests/TextBlockTests.cs

@ -166,9 +166,9 @@ namespace Avalonia.Controls.UnitTests
}.RegisterInNameScope(scope)
);
target.Inlines!.AddText("123456");
target.Inlines!.Add("123456");
target.Inlines.Add(new InlineUIContainer(button));
target.Inlines.AddText("123456");
target.Inlines.Add("123456");
target.Measure(Size.Infinity);

Loading…
Cancel
Save