Skip to content

Commit

Permalink
test: FeatureConfiguration changes while native textbox overlay is fo…
Browse files Browse the repository at this point in the history
…cused
  • Loading branch information
ramezgerges committed Jan 22, 2024
1 parent 8daed26 commit 4dca7b6
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4dca7b6

Please sign in to comment.