Skip to content
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