Updated FormattedStringExtensions.cs (#25892)
This commit is contained in:
Родитель
ce52028dbf
Коммит
cbdfc9e9a9
|
@ -204,7 +204,8 @@ namespace Microsoft.Maui.Controls.Platform
|
|||
var spanStartX = (int)layout.GetPrimaryHorizontal(startOffset);
|
||||
|
||||
var endOffset = (curLine == spanEndLine) ? spanEndOffset : lineVisibleEndOffset;
|
||||
var spanEndX = (int)layout.GetSecondaryHorizontal(endOffset);
|
||||
var validEndOffset = System.Math.Min(endOffset, layout.GetLineEnd(curLine));
|
||||
var spanEndX = (int)layout.GetSecondaryHorizontal(validEndOffset);
|
||||
|
||||
var spanWidth = spanEndX - spanStartX;
|
||||
var spanLeftX = spanStartX;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
using System.ComponentModel;
|
||||
using Microsoft.Maui.Controls.PlatformConfiguration;
|
||||
using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;
|
||||
using Entry = Microsoft.Maui.Controls.Entry;
|
||||
|
||||
namespace Maui.Controls.Sample.Issues
|
||||
{
|
||||
|
||||
[Issue(IssueTracker.Github, 25836, "Span with tail truncation and paragraph breaks with exception", PlatformAffected.Android)]
|
||||
public class Issue25836 : ContentPage
|
||||
{
|
||||
public Issue25836()
|
||||
{
|
||||
var span = new Span
|
||||
{
|
||||
Text =
|
||||
" Mi augue molestie ligula lobortis enim Velit, in. \n Imperdiet eu dignissim odio. Massa erat Hac inceptos facilisis nibh " +
|
||||
" Interdum massa Consectetuer risus sociis molestie facilisi enim. Class gravida. \n Gravida sociosqu cras Quam velit, suspendisse" +
|
||||
" leo auctor odio integer primis dui potenti dolor faucibus augue justo morbi ornare sem. "
|
||||
};
|
||||
|
||||
var formattedString = new FormattedString();
|
||||
formattedString.Spans.Add(span);
|
||||
|
||||
var label = new Label
|
||||
{
|
||||
AutomationId = "Label",
|
||||
LineBreakMode = LineBreakMode.TailTruncation,
|
||||
VerticalOptions = LayoutOptions.Start,
|
||||
FormattedText = formattedString,
|
||||
MaxLines = 3
|
||||
};
|
||||
|
||||
var layout = new StackLayout();
|
||||
layout.Children.Add(label);
|
||||
|
||||
Content = layout;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using NUnit.Framework;
|
||||
using UITest.Appium;
|
||||
using UITest.Core;
|
||||
|
||||
namespace Microsoft.Maui.TestCases.Tests.Issues
|
||||
{
|
||||
public class Issue25836 : _IssuesUITest
|
||||
{
|
||||
public Issue25836(TestDevice testDevice) : base(testDevice)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Issue => "Span with tail truncation and paragraph breaks with exception";
|
||||
|
||||
[Test]
|
||||
[Category(UITestCategories.Label)]
|
||||
public void ExceptionShouldNotBeThrown()
|
||||
{
|
||||
App.WaitForElement("Label");
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче