Skip to content

[Testing] Feature Matrix UITest Cases for Button #29803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public override string ToString()
// Elements
new GalleryPageFactory(() => new ActivityIndicatorCoreGalleryPage(), "ActivityIndicator Gallery"),
new GalleryPageFactory(() => new BoxViewCoreGalleryPage(), "Box Gallery"),
new GalleryPageFactory(() => new ButtonControlPage(), "Button Feature Matrix"),
new GalleryPageFactory(() => new ButtonCoreGalleryPage(), "Button Gallery"),
new GalleryPageFactory(() => new CarouselViewCoreGalleryPage(), "CarouselView Gallery"),
new GalleryPageFactory(() => new CheckBoxCoreGalleryPage(), "CheckBox Gallery"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Maui.Controls.Sample"
x:Class="Maui.Controls.Sample.ButtonControlMainPage"
x:DataType="local:ButtonViewModal"
Title="ButtonControlPage">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Options"
Clicked="NavigateToOptionsPage_Clicked"
AutomationId="Options"/>
</ContentPage.ToolbarItems>

<Grid RowDefinitions="*, Auto, Auto, Auto"
ColumnDefinitions="0.5*, 0.5*"
HorizontalOptions="Center"
Padding="10,20,10,20"
RowSpacing="10"
ColumnSpacing="10">
<Button Grid.Row="0"
Grid.ColumnSpan="2"
BackgroundColor="SkyBlue"
HeightRequest="100"
Margin="0,50,0,0"
WidthRequest="200"
VerticalOptions="Center"
AutomationId="ButtonControl"
BorderColor="{Binding BorderColor}"
BorderWidth="{Binding BorderWidth}"
CharacterSpacing="{Binding CharacterSpacing}"
Clicked="OnButtonClicked"
Command="{Binding Command}"
CommandParameter="{Binding Text}"
CornerRadius="{Binding CornerRadius}"
FlowDirection="{Binding FlowDirection}"
FontAttributes="{Binding FontAttributes}"
FontFamily="{Binding FontFamily}"
FontSize="{Binding FontSize}"
IsEnabled="{Binding IsEnabled}"
IsVisible="{Binding IsVisible}"
LineBreakMode="{Binding LineBreakMode}"
Padding="{Binding Padding}"
Pressed="OnButtonPressed"
Released="OnButtonReleased"
Text="{Binding Text}"
TextColor="{Binding TextColor}"
TextTransform="{Binding TextTransform}">
<Button.Shadow>
<Shadow x:Name="ButtonShadow"
Brush="Blue"
Offset="0,0"
Opacity="{Binding ShadowOpacity}"
Radius="20"/>
</Button.Shadow>
</Button>

<Label Grid.Row="1"
Text="Clicked Event: "/>
<Label Grid.Row="1"
Grid.Column="1"
x:Name="ClickedEventLabel"
AutomationId="ClickedEventLabel"/>

<Label Grid.Row="2"
Text="Pressed Event: "/>
<Label Grid.Row="2"
Grid.Column="1"
x:Name="PressedEventLabel"
AutomationId="PressedEventLabel"/>

<Label Grid.Row="3"
Text="Released Event: "/>
<Label Grid.Row="3"
Grid.Column="1"
x:Name="ReleasedEventLabel"
AutomationId="ReleasedEventLabel"/>
</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
namespace Maui.Controls.Sample;

public class ButtonControlPage : NavigationPage
{
public ButtonControlPage()
{
PushAsync(new ButtonControlMainPage());
}
}

public partial class ButtonControlMainPage : ContentPage
{
public ButtonViewModal _viewModel;
public ButtonControlMainPage()
{
InitializeComponent();
BindingContext = _viewModel = new ButtonViewModal();
}

public async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
BindingContext = _viewModel = new ButtonViewModal();
ClickedEventLabel.Text = string.Empty;
PressedEventLabel.Text = string.Empty;
ReleasedEventLabel.Text = string.Empty;
await Navigation.PushAsync(new ButtonOptionsPage(_viewModel));
}

public void OnButtonClicked(object sender, EventArgs e)
{
var button = sender as Button;
if (button != null)
{
ClickedEventLabel.Text = "Clicked Event Executed";
}
}

public void OnButtonPressed(object sender, EventArgs e)
{
var button = sender as Button;
if (button != null)
{
PressedEventLabel.Text = "Pressed Event Executed";
}
}

public void OnButtonReleased(object sender, EventArgs e)
{
var button = sender as Button;
if (button != null)
{
ReleasedEventLabel.Text = "Released Event Executed";
}
}
}
Loading
Loading