Skip to content

Commit

Permalink
chore: remove the manual ui test in favor of a runtime test
Browse files Browse the repository at this point in the history
  • Loading branch information
ramezgerges committed Nov 25, 2024
1 parent 183da4f commit 9058d6d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 69 deletions.
7 changes: 0 additions & 7 deletions src/SamplesApp/UITests.Shared/UITests.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -1414,10 +1414,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\AutoSuggestBoxTests\AutoSuggestBox_PopupFocus.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\AutoSuggestBoxTests\AutoSuggestBox_Icons.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -6562,9 +6558,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\AutoSuggestBoxTests\AutoSuggestBox_Description.xaml.cs">
<DependentUpon>AutoSuggestBox_Description.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\AutoSuggestBoxTests\AutoSuggestBox_PopupFocus.xaml.cs">
<DependentUpon>AutoSuggestBox_PopupFocus.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\AutoSuggestBoxTests\AutoSuggestBox_Icons.xaml.cs">
<DependentUpon>AutoSuggestBox_Icons.xaml</DependentUpon>
</Compile>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using Windows.UI.Input.Preview.Injection;
using Windows.Foundation;
using System.Collections.Generic;
using Uno.Extensions;


#if WINAPPSDK
Expand Down Expand Up @@ -1124,6 +1125,44 @@ static FrameworkElement GetSCP(TextBox tb)
}
#endif

#if HAS_UNO
[TestMethod]
[UnoWorkItem("https://github.com/unoplatform/uno/issues/18790")]
#if !HAS_INPUT_INJECTOR
[Ignore("InputInjector is not supported on this platform.")]
#endif
public async Task When_Clicked_In_Popup()
{
TextBox tb;
var btn = new Button
{
Flyout = new Flyout
{
Content = tb = new TextBox()
}
};

await UITestHelper.Load(btn);

var injector = InputInjector.TryCreate() ?? throw new InvalidOperationException("Failed to init the InputInjector");
using var mouse = injector.GetMouse();

mouse.Press(btn.GetAbsoluteBoundsRect().GetCenter());
await UITestHelper.WaitForIdle();
mouse.Release();
await UITestHelper.WaitForIdle();

Assert.IsTrue(btn.Flyout.IsOpen);

mouse.Press(tb.GetAbsoluteBoundsRect().GetCenter());
await UITestHelper.WaitForIdle();
mouse.Release();
await UITestHelper.WaitForIdle();

Assert.AreEqual(tb, FocusManager.GetFocusedElement(WindowHelper.XamlRoot));
}
#endif

private static async Task<TextBox> LoadZeroSizeTextBoxAsync(Style style)
{
var loaded = false;
Expand Down
11 changes: 0 additions & 11 deletions src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -593,17 +593,6 @@ public double HorizontalOffset
);
#endregion

#if __WASM__
/// <summary>
/// This is specifically added for ScrollViewers inside TextBoxes and specifically for WASM
/// On WASM, a click on a TextBox inside a popup shifts focus to the Popup instead of the TextBox
/// as a result of ScrollContentControl_SetFocusOnFlyoutLightDismissPopupByPointer.
/// This is only a problem on WASM because we don't capture the pointer when pressing inside a TextBox
/// <seealso cref="TextBox.IsPointerCaptureRequired"/>.
/// </summary>
internal bool DisableSetFocusOnPopupByPointer { get; set; }
#endif

private readonly SerialDisposable _sizeChangedSubscription = new SerialDisposable();

#pragma warning disable 649 // unused member for Unit tests
Expand Down
9 changes: 9 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ namespace Microsoft.UI.Xaml.Controls
{
partial class ScrollViewer
{
/// <summary>
/// This is specifically added for ScrollViewers inside TextBoxes and specifically for WASM
/// On WASM, a click on a TextBox inside a popup shifts focus to the Popup instead of the TextBox
/// as a result of ScrollContentControl_SetFocusOnFlyoutLightDismissPopupByPointer.
/// This is only a problem on WASM because we don't capture the pointer when pressing inside a TextBox
/// <seealso cref="TextBox.IsPointerCaptureRequired"/>.
/// </summary>
internal bool DisableSetFocusOnPopupByPointer { get; set; }

internal bool CancelNextNativeScroll { get; private set; }
internal Size ScrollBarSize => (_presenter as ScrollContentPresenter)?.ScrollBarSize ?? default;

Expand Down

0 comments on commit 9058d6d

Please sign in to comment.