-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
...SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
<UserControl | ||
x:Class="UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage" | ||
x:Name="ExpanderTestPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:controls="using:Microsoft.UI.Xaml.Controls" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
|
||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="12"> | ||
<ScrollViewer Grid.Column="0" Height="Auto"> | ||
<StackPanel Orientation="Vertical"> | ||
<StackPanel.ChildrenTransitions> | ||
<TransitionCollection> | ||
<RepositionThemeTransition IsStaggeringEnabled="False" /> | ||
</TransitionCollection> | ||
</StackPanel.ChildrenTransitions> | ||
|
||
<controls:Expander x:Name ="ExpandedExpander" AutomationProperties.Name="ExpandedExpander" HorizontalContentAlignment="Left" IsExpanded="True"> | ||
<controls:Expander.Header> | ||
<TextBlock Style="{StaticResource HeaderTextBlockStyle}" Text="This expander is expanded by default." /> | ||
</controls:Expander.Header> | ||
<TextBlock AutomationProperties.AutomationId="ExpandedExpanderContent">Content</TextBlock> | ||
</controls:Expander> | ||
|
||
<controls:Expander AutomationProperties.AutomationId="CollapsedExpander" AutomationProperties.Name="Expander2" HorizontalContentAlignment="Left" IsExpanded="False"> | ||
<controls:Expander.Header> | ||
<TextBlock Style="{StaticResource HeaderTextBlockStyle}" Text="This expander is collapsed by default." /> | ||
</controls:Expander.Header> | ||
<TextBlock AutomationProperties.AutomationId="CollapsedExpanderContent">Content</TextBlock> | ||
</controls:Expander> | ||
|
||
<controls:Expander AutomationProperties.Name="ParentExpander" HorizontalContentAlignment="Left" IsExpanded="False"> | ||
<controls:Expander.Header> | ||
<TextBlock Style="{StaticResource HeaderTextBlockStyle}" Text="This expander has an expander inside" /> | ||
</controls:Expander.Header> | ||
<controls:Expander AutomationProperties.Name="NestedExpander" HorizontalContentAlignment="Left" IsExpanded="False" Margin="30,0,0,0" > | ||
<controls:Expander.Header> | ||
<TextBlock Style="{StaticResource HeaderTextBlockStyle}" Text="Nested expander" /> | ||
</controls:Expander.Header> | ||
<StackPanel HorizontalAlignment="Left"> | ||
<Button>Button1</Button> | ||
<Button>Button2</Button> | ||
</StackPanel> | ||
</controls:Expander> | ||
</controls:Expander> | ||
|
||
<controls:Expander AutomationProperties.Name="ExpanderWithButtons" HorizontalContentAlignment="Left" IsExpanded="False"> | ||
<controls:Expander.Header> | ||
<ToggleButton>This is a toggle button in the header</ToggleButton> | ||
</controls:Expander.Header> | ||
<StackPanel> | ||
<TextBlock>Content</TextBlock> | ||
</StackPanel> | ||
</controls:Expander> | ||
|
||
<controls:Expander AutomationProperties.Name="ExpanderWithUpwardsDirection" HorizontalContentAlignment="Left" ExpandDirection="Up" IsExpanded="False"> | ||
<controls:Expander.Header> | ||
<TextBlock Style="{StaticResource HeaderTextBlockStyle}">This expander will expand upwards</TextBlock> | ||
</controls:Expander.Header> | ||
<StackPanel> | ||
<TextBlock>Content</TextBlock> | ||
</StackPanel> | ||
</controls:Expander> | ||
|
||
<controls:Expander IsEnabled="False" AutomationProperties.Name="ExpanderNotEnabled" HorizontalContentAlignment="Left" ExpandDirection="Down" IsExpanded="False"> | ||
<controls:Expander.Header> | ||
<TextBlock Style="{StaticResource HeaderTextBlockStyle}">This expander is not enabled</TextBlock> | ||
</controls:Expander.Header> | ||
<StackPanel> | ||
<TextBlock>Content</TextBlock> | ||
</StackPanel> | ||
</controls:Expander> | ||
|
||
<local:TestControl IsTabStop="True" x:Name="CustomControl" AutomationProperties.Name="CustomControl"> | ||
<controls:Expander x:Name="ExpanderWithCustomEventsSource" HorizontalContentAlignment="Left" ExpandDirection="Down" IsExpanded="False"> | ||
<controls:Expander.Header> | ||
<TextBlock Style="{StaticResource HeaderTextBlockStyle}">This expander has a custom events source</TextBlock> | ||
</controls:Expander.Header> | ||
<StackPanel> | ||
<TextBlock>Content</TextBlock> | ||
</StackPanel> | ||
</controls:Expander> | ||
</local:TestControl> | ||
</StackPanel> | ||
</ScrollViewer> | ||
|
||
</Grid> | ||
</UserControl> |
39 changes: 39 additions & 0 deletions
39
...plesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/ExpanderTests/WinUIExpanderPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters