Skip to content

Commit

Permalink
test: assert phone vertical alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Feb 11, 2025
1 parent bee761d commit d3136e6
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/SamplesApp/UITests.Shared/UITests.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Media\FontTests\FontAlignmentTests.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_Devices\Midi\MidiDeviceOutput.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -9890,6 +9894,11 @@
<DependentUpon>OverlappedControls.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Media\FontTests\FontAlignmentTests.xaml.cs">
<DependentUpon>FontAlignmentTests.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ImageTests\ImageSourceWriteableBitmapInvalidate.xaml.cs">
<DependentUpon>ImageSourceWriteableBitmapInvalidate.xaml</DependentUpon>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<Page
x:Class="UITests.Shared.Windows_UI_Xaml.Font.FontAlignmentTests"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<StackPanel HorizontalAlignment="Left">
<CheckBox Margin="0,24"
VerticalContentAlignment="Center"
Content="CheckBox with the missing vertical alignment" />

<CheckBox Margin="0,24">
<TextBlock
Margin="0,4,0,0"
Text="Checkbox with a TextBlock with a custom margin" />
</CheckBox>

<CheckBox Margin="0,24">
<TextBlock
Margin="0,4,0,0"
Text="Checkbox with a TextBlock with VerticalAlignment=Center"
VerticalAlignment="Center"/>
</CheckBox>

<TextBox PlaceholderText="Enter your name123456:"
Text="{Binding Name, Mode=TwoWay}" />

<StackPanel Orientation="Horizontal">
<TextBox Text="Test"
Background="Blue"
Foreground="White" />
<Button Background="Blue"
Foreground="White"
AutomationProperties.AutomationId="SecondPageButton"
Content="Go to Second Page" />
</StackPanel>

<!-- Dialog Information -->
<StackPanel CornerRadius="5"
Margin="0,15">
<TextBlock
FontSize="18"
FontWeight="Bold"
Text="Configure TLCEV T1" />
<Grid
x:Name="MainGrid"
Margin="0,24,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto" />
<ColumnDefinition
Width="48" />
<ColumnDefinition
Width="Auto" />
</Grid.ColumnDefinitions>

<StackPanel>
<TextBlock
Style="{StaticResource PropertyHeaderTextBlockStyle}"
Text="Charge non-approved OEMs" />
<ToggleSwitch
x:Name="Toggle"
IsOn="True"
Margin="0,4,0,0"
OffContent="Block"
OnContent="Allow" />
<Button
Content="Help"
Margin="0,4,0,0" />
<TeachingTip
x:Name="ToggleThemeTeachingTip3"
Title="What is a non-approved OEMs?"
PreferredPlacement="LeftBottom"
Target="{x:Bind Toggle}">
<TeachingTip.HeroContent>
<Image
Margin="24"
Source="/Assets/Images/vehicule.png" />
</TeachingTip.HeroContent>
<TeachingTip.Content>
<TextBlock
Margin="0,16,0,0"
Text="Explanation here"
TextWrapping="WrapWholeWords" />
</TeachingTip.Content>
</TeachingTip>

<TextBlock
Margin="0,16,0,0"
Style="{StaticResource PropertyHeaderTextBlockStyle}"
Text="Maximum power" />

<StackPanel
Margin="0,4,0,0"
Orientation="Horizontal">
<NumberBox
AutomationProperties.Name="NumberBox with spin button"
LargeChange="100"
SmallChange="10"
SpinButtonPlacementMode="Inline"
Width="160"
Value="300" />
<TextBlock
Margin="4,0,0,0"
Text="kW"
VerticalAlignment="Center" />
</StackPanel>

<TextBlock
Margin="0,16,0,0"
Style="{StaticResource PropertyHeaderTextBlockStyle}"
Text="Connection type" />

<ComboBox
Margin="0,4,0,0"
SelectedIndex="1"
Width="160">
<ComboBoxItem>CCS</ComboBoxItem>
<ComboBoxItem>NACS</ComboBoxItem>
</ComboBox>

<TextBlock
Margin="0,16,0,0"
Style="{StaticResource PropertyHeaderTextBlockStyle}"
Text="Portal password" />

<PasswordBox
HorizontalAlignment="Left"
Margin="0,4,0,0"
PlaceholderText="Enter your password"
Width="160" />
<!-- Show TeachingTip -->
</StackPanel>

<StackPanel
Grid.Column="2">
<CheckBox
Checked="ToggleButton_OnChecked"
Content="Is debug mode enabled" />

<TextBlock
Margin="0,12,0,0"
Style="{StaticResource PropertyHeaderTextBlockStyle}"
Text="Debug level verbosity" />

<RadioButtons
x:Name="MyRadioButtons"
IsEnabled="False"
SelectedIndex="1">
<x:String>Minimal</x:String>
<x:String>Normal</x:String>
<x:String>Detailed</x:String>
</RadioButtons>
<!-- Show TeachingTip -->
</StackPanel>
</Grid>

<StackPanel
x:Name="ProgressStackPanel"
Margin="0,24,0,0"
Orientation="Horizontal"
Visibility="Collapsed">
<ProgressRing
Foreground="Blue"
Height="30"
IsActive="True"
Width="30" />

<TextBlock
Margin="12,0,0,0"
Text="Configuring TLCEV T1..."
VerticalAlignment="Center" />
</StackPanel>

<InfoBar
x:Name="InfoBar"
IsClosable="False"
Margin="0,12,0,0"
Message="TLCEV T1 configured successfully"
Severity="Success"
Visibility="Collapsed" />
</StackPanel>
</StackPanel>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Uno.UI.Samples.Controls;

namespace UITests.Shared.Windows_UI_Xaml.Font;

[SampleControlInfo("Fonts", "FontAlignmentTests", isManualTest: true, description: "Tests the alignment of text in different UI Controls")]
public sealed partial class FontAlignmentTests : Page
{
public FontAlignmentTests()
{
this.InitializeComponent();
}

private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
{
var check = (CheckBox)sender;
MyRadioButtons.IsEnabled = check.IsChecked.Value;
}
}

0 comments on commit d3136e6

Please sign in to comment.