diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Controls/xLoad_Visibility.xaml b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Controls/xLoad_Visibility.xaml
new file mode 100644
index 000000000000..b7a40d5a296d
--- /dev/null
+++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Controls/xLoad_Visibility.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Controls/xLoad_Visibility.xaml.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Controls/xLoad_Visibility.xaml.cs
new file mode 100644
index 000000000000..d4ac806e753e
--- /dev/null
+++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Controls/xLoad_Visibility.xaml.cs
@@ -0,0 +1,17 @@
+using Microsoft.UI.Xaml.Controls;
+
+// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml.Controls
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class xLoad_Visibility : Page
+ {
+ public xLoad_Visibility()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_xLoad.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_xLoad.cs
index 2f8aba86b654..cf65d1fb9487 100644
--- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_xLoad.cs
+++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_xLoad.cs
@@ -2,6 +2,7 @@
#if !WINAPPSDK
using System;
using System.Diagnostics;
+using System.Linq;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Private.Infrastructure;
@@ -446,6 +447,17 @@ private async Task AssertIsNullAsync(Func getter, TimeSpan? timeout = null
Assert.IsNull(getter());
}
+
+ [TestMethod]
+ public async Task When_xLoad_Visibility_Set()
+ {
+ var SUT = new xLoad_Visibility();
+ TestServices.WindowHelper.WindowContent = SUT;
+ await TestServices.WindowHelper.WaitForIdle();
+
+ Assert.AreEqual(1, SUT.GetChildren().Count(c => c is ElementStub));
+ Assert.AreEqual(0, SUT.GetChildren().Count(c => c is Border));
+ }
}
}
#endif
diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Media/Given_VisualTreeHelper.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Media/Given_VisualTreeHelper.cs
index f64b8d74dfab..87b7a1f9973e 100644
--- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Media/Given_VisualTreeHelper.cs
+++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Media/Given_VisualTreeHelper.cs
@@ -16,6 +16,7 @@
using Microsoft.UI.Xaml.Media;
using FluentAssertions;
using Uno.Extensions;
+using Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml.Controls;
using static Private.Infrastructure.TestServices;
namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Media
@@ -149,6 +150,24 @@ public async Task When_HitTestTranslatedElement()
#if !UNO_HAS_MANAGED_POINTERS
[Ignore("Root visual tree elements are not configured properly to use managed hit testing.")]
#endif
+#if __MACOS__
+ [Ignore("Currently fails on macOS, part of #9282 epic")]
+#endif
+ public async Task When_ElementStub_Not_Counted()
+ {
+ var SUT = new xLoad_Visibility();
+ WindowHelper.WindowContent = SUT;
+ await WindowHelper.WaitForIdle();
+
+ Assert.AreEqual(0, VisualTreeHelper.GetChildrenCount(SUT));
+ Assert.IsNull(VisualTreeHelper.GetChild(SUT, 0));
+ }
+
+ [TestMethod]
+ [RunsOnUIThread]
+#if !UNO_HAS_MANAGED_POINTERS
+ [Ignore("Root visual tree elements are not configured properly to use managed hit testing.")]
+#endif
#if __MACOS__
[Ignore("Currently fails on macOS, part of #9282 epic")]
#endif