From 1279af82831f7f77b7b3994530f09f20809a18cb Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 3 Nov 2020 21:29:51 -0500 Subject: [PATCH] feat(Expander): Add WinUI test page --- .../ExpanderTests/WinUIExpanderPage.xaml | 92 +++++++++++++++++++ .../ExpanderTests/WinUIExpanderPage.xaml.cs | 39 ++++++++ .../UITests.Shared/UITests.Shared.projitems | 9 +- 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml create mode 100644 src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml.cs diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml new file mode 100644 index 000000000000..385e3c133bdd --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + Content + + + + + + + Content + + + + + + + + + + + + + + + + + + + + This is a toggle button in the header + + + Content + + + + + + This expander will expand upwards + + + Content + + + + + + This expander is not enabled + + + Content + + + + + + + This expander has a custom events source + + + Content + + + + + + + + diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml.cs new file mode 100644 index 000000000000..396658225087 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml.cs @@ -0,0 +1,39 @@ +using Uno.UI.Samples.Controls; +using Windows.UI.Xaml.Automation.Peers; +using Windows.UI.Xaml.Controls; + +namespace UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests +{ + // We are going to test setting the events source of an expander to the customcontrol's + public sealed partial class TestControl : ContentControl + { + protected override AutomationPeer OnCreateAutomationPeer() + { + return new TestControlAutomationPeer(this); + } + } + + public sealed partial class TestControlAutomationPeer : FrameworkElementAutomationPeer + { + public TestControlAutomationPeer(TestControl owner) : base(owner) { } + protected override AutomationControlType GetAutomationControlTypeCore() + { + return AutomationControlType.Custom; + } + } + + [Sample("Expander", "WinUI", Name = "WinUIExpanderPage")] + public sealed partial class WinUIExpanderPage : UserControl + { + public WinUIExpanderPage() + { + this.InitializeComponent(); + var customControlPeer = FrameworkElementAutomationPeer.FromElement(CustomControl); + var expanderPeer = FrameworkElementAutomationPeer.FromElement(ExpanderWithCustomEventsSource); + + // Commenting because of MuxTestInfra bug: + // https://github.com/microsoft/microsoft-ui-xaml/issues/3491 + //expanderPeer.EventsSource = customControlPeer; + } + } +} diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems index 2da89cf03f77..27490be49c09 100644 --- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems +++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems @@ -97,6 +97,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -3645,6 +3649,9 @@ TwoPaneViewPage.xaml + + WinUIExpanderPage.xaml + MsalLoginAndGraph.xaml @@ -6428,4 +6435,4 @@ - + \ No newline at end of file