diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBox.skia.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBox.skia.cs index b433eac90e4a..8ee3d8876ab9 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBox.skia.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBox.skia.cs @@ -12,6 +12,7 @@ using Microsoft.UI.Xaml.Media; using FluentAssertions; using MUXControlsTestApp.Utilities; +using Uno.Disposables; using Uno.Extensions; using Uno.UI.RuntimeTests.Helpers; using Uno.UI.Xaml.Core; @@ -3182,6 +3183,34 @@ public async Task When_Paste_Does_Not_Change_Text() Assert.AreEqual(0, SUT.SelectionLength); } + [TestMethod] + public async Task When_FeatureConfiguration_Changes() + { + var useOverlay = FeatureConfiguration.TextBox.UseOverlayOnSkia; + using var _ = Disposable.Create(() => FeatureConfiguration.TextBox.UseOverlayOnSkia = useOverlay); + + FeatureConfiguration.TextBox.UseOverlayOnSkia = true; + + var SUT = new TextBox + { + Width = 150, + Text = "hello world" + }; + + await UITestHelper.Load(SUT); + + SUT.Focus(FocusState.Programmatic); + await WindowHelper.WaitForIdle(); + + Assert.AreEqual(0, SUT.TextBoxView.DisplayBlock.Opacity); + + FeatureConfiguration.TextBox.UseOverlayOnSkia = false; + + await UITestHelper.Load(new Button()); // a random control to unload SUT + + Assert.AreEqual(1, SUT.TextBoxView.DisplayBlock.Opacity); + } + private class TextBoxFeatureConfigDisposable : IDisposable { private bool _useOverlay;