Skip to content

[iOS] Device tests - html label #29906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ await AttachAndRun(layout, async (handler) =>

label.TextType = TextType.Html;

// We need to delay here because platformLabel.UpdateTextHtml(label) and label.InvalidateMeasure()
// are dispatched asynchronously to the main thread and may not complete immediately.
// https://github.com/dotnet/maui/pull/26153
await Task.Delay(100);
await platformView.AssertDoesNotContainColor(Colors.Red, MauiContext);
});
}
Expand Down Expand Up @@ -517,9 +521,13 @@ public async Task FontStuffAppliesEvenInHtmlMode()
Text = "<p>Test</p>"
};

await InvokeOnMainThreadAsync(() =>
await InvokeOnMainThreadAsync(async () =>
{
var handler = CreateHandler<LabelHandler>(label);
// We need to delay here because platformLabel.UpdateTextHtml(label) and label.InvalidateMeasure()
// are dispatched asynchronously to the main thread and may not complete immediately.
// https://github.com/dotnet/maui/pull/26153
await Task.Delay(100);
AssertEquivalentFont(handler, label.ToFont());
});
}
Expand Down Expand Up @@ -715,9 +723,13 @@ public async Task FontStuffAfterTextTypeIsCorrect()
Text = "<p>Test</p>"
};

await InvokeOnMainThreadAsync(() =>
await InvokeOnMainThreadAsync(async () =>
{
var handler = CreateHandler<LabelHandler>(label);
// We need to delay here because platformLabel.UpdateTextHtml(label) and label.InvalidateMeasure()
// are dispatched asynchronously to the main thread and may not complete immediately.
// https://github.com/dotnet/maui/pull/26153
await Task.Delay(100);
label.FontFamily = "Baskerville";
label.FontSize = 64;
AssertEquivalentFont(handler, label.ToFont());
Expand Down
Loading