Skip to content

Commit

Permalink
Add other controls to the UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Sep 28, 2023
1 parent 6326bf7 commit 9b19a92
Show file tree
Hide file tree
Showing 24 changed files with 403 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<ItemGroup>
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" Color="#FFFFFF" BaseSize="168,208" />
<MauiImage Include="Resources\Images\dotnet_bot.svg" Link="Resources\Images\small_dotnet_bot.svg" Color="#FFFFFF" BaseSize="64,64" />
<MauiImage Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" IsAppIcon="true" />
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#FFFFFF" BaseSize="168,208" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ protected override void Build()
Add(gestureRecognizerEventViewContainer);

Add(new LayeredViewContainer<T>(Test.VisualElement.InputTransparent, new T { InputTransparent = true }));
Add(new LayeredViewContainer<T>(Test.VisualElement.NotInputTransparent, new T { InputTransparent = false }));
Add(IsEnabledStateViewContainer);
Add(focusedEventViewContainer);
Add(unfocusedEventViewContainer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,36 @@ public override string ToString()
}

List<GalleryPageFactory> _pages = new List<GalleryPageFactory> {
new GalleryPageFactory(() => new BorderGallery(), "Border Gallery"),
new GalleryPageFactory(() => new ButtonCoreGalleryPage(), "Button Gallery"),
new GalleryPageFactory(() => new CarouselViewCoreGalleryPage(), "CarouselView Gallery"),
new GalleryPageFactory(() => new CheckBoxCoreGalleryPage(), "CheckBox Gallery"),
new GalleryPageFactory(() => new EditorCoreGalleryPage(), "Editor Gallery"),
new GalleryPageFactory(() => new RadioButtonCoreGalleryPage(), "RadioButton Core Gallery"),
new GalleryPageFactory(() => new DragAndDropGallery(), "Drag and Drop Gallery"),
new GalleryPageFactory(() => new LabelCoreGalleryPage(), "Label Gallery"),
new GalleryPageFactory(() => new GestureRecognizerGallery(), "Gesture Recognizer Gallery"),
new GalleryPageFactory(() => new ScrollViewCoreGalleryPage(), "ScrollView Gallery"),
new GalleryPageFactory(() => new InputTransparencyGalleryPage(), "Input Transparency Gallery"),
// Concepts & Abstracts
new GalleryPageFactory(() => new BorderGallery(), "Border Gallery"),
new GalleryPageFactory(() => new DragAndDropGallery(), "Drag and Drop Gallery"),
new GalleryPageFactory(() => new GestureRecognizerGallery(), "Gesture Recognizer Gallery"),
new GalleryPageFactory(() => new InputTransparencyGalleryPage(), "Input Transparency Gallery"),
// Elements
new GalleryPageFactory(() => new ActivityIndicatorCoreGalleryPage(), "ActivityIndicator Gallery"),
new GalleryPageFactory(() => new BoxViewCoreGalleryPage(), "Box Gallery"),
new GalleryPageFactory(() => new ButtonCoreGalleryPage(), "Button Gallery"),
new GalleryPageFactory(() => new CarouselViewCoreGalleryPage(), "CarouselView Gallery"),
new GalleryPageFactory(() => new CheckBoxCoreGalleryPage(), "CheckBox Gallery"),
new GalleryPageFactory(() => new CollectionViewCoreGalleryPage(), "CollectionView Gallery"),
new GalleryPageFactory(() => new DatePickerCoreGalleryPage(), "Date Picker Gallery"),
new GalleryPageFactory(() => new EditorCoreGalleryPage(), "Editor Gallery"),
new GalleryPageFactory(() => new EntryCoreGalleryPage(), "Entry Gallery"),
new GalleryPageFactory(() => new FrameCoreGalleryPage(), "Frame Gallery"),
new GalleryPageFactory(() => new ImageButtonCoreGalleryPage(), "Image Button Gallery"),
new GalleryPageFactory(() => new ImageCoreGalleryPage(), "Image Gallery"),
new GalleryPageFactory(() => new LabelCoreGalleryPage(), "Label Gallery"),
new GalleryPageFactory(() => new ListViewCoreGalleryPage(), "ListView Gallery"),
new GalleryPageFactory(() => new PickerCoreGalleryPage(), "Picker Gallery"),
new GalleryPageFactory(() => new ProgressBarCoreGalleryPage(), "Progress Bar Gallery"),
new GalleryPageFactory(() => new RadioButtonCoreGalleryPage(), "RadioButton Gallery"),
new GalleryPageFactory(() => new ScrollViewCoreGalleryPage(), "ScrollView Gallery"),
new GalleryPageFactory(() => new SearchBarCoreGalleryPage(), "Search Bar Gallery"),
new GalleryPageFactory(() => new SliderCoreGalleryPage(), "Slider Gallery"),
new GalleryPageFactory(() => new StepperCoreGalleryPage(), "Stepper Gallery"),
new GalleryPageFactory(() => new SwitchCoreGalleryPage(), "Switch Gallery"),
new GalleryPageFactory(() => new TimePickerCoreGalleryPage(), "Time Picker Gallery"),
new GalleryPageFactory(() => new WebViewCoreGalleryPage(), "WebView Gallery"),
};

public CorePageView(Page rootPage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal class LayeredViewContainer<T> : ViewContainer<T> where T : View
{
public LayeredViewContainer(Enum formsMember, T view) : base(formsMember, view)
{
var layout = new AbsoluteLayout();
var layout = new Grid();

var hiddenButton = new Button
{
Expand All @@ -18,11 +18,7 @@ public LayeredViewContainer(Enum formsMember, T view) : base(formsMember, view)
};

layout.Children.Add(hiddenButton);
AbsoluteLayout.SetLayoutFlags(hiddenButton, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds(hiddenButton, new Rect(0, 0, 1, 1));
layout.Children.Add(view);
AbsoluteLayout.SetLayoutBounds(view, new Rect(0, 0, 1, 1));
AbsoluteLayout.SetLayoutFlags(view, AbsoluteLayoutFlags.All);

var hiddenLabel = new Label
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample;

internal class ActivityIndicatorCoreGalleryPage : CoreGalleryPage<ActivityIndicator>
{
protected override bool SupportsFocus => false;

protected override void InitializeElement(ActivityIndicator element)
{
element.IsRunning = true;
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample;

internal class BoxViewCoreGalleryPage : CoreGalleryPage<BoxView>
{
protected override bool SupportsFocus => false;

protected override void InitializeElement(BoxView element)
{
element.HeightRequest = 200;

element.Color = Colors.Purple;
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class CollectionViewCoreGalleryPage : CoreGalleryPage<CollectionView>
{
protected override void InitializeElement(CollectionView element)
{
base.InitializeElement(element);

var items = new List<string>();

for (int n = 0; n < 1000; n++)
{
items.Add(DateTime.Now.AddDays(n).ToString("D"));
}

element.ItemsSource = items;

element.HeightRequest = 250;

element.ItemsLayout = LinearItemsLayout.Vertical;
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class DatePickerCoreGalleryPage : CoreGalleryPage<DatePicker>
{
protected override bool SupportsTapGestureRecognizer => false;

protected override void InitializeElement(DatePicker element)
{
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class EntryCoreGalleryPage : CoreGalleryPage<Entry>
{
protected override bool SupportsTapGestureRecognizer => false;

protected override void InitializeElement(Entry element)
{
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample;

internal class FrameCoreGalleryPage : CoreGalleryPage<Frame>
{
protected override bool SupportsFocus => false;

protected override void InitializeElement(Frame element)
{
element.HeightRequest = 50;
element.WidthRequest = 100;
element.BorderColor = Colors.Olive;
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class ImageButtonCoreGalleryPage : CoreGalleryPage<ImageButton>
{
protected override bool SupportsTapGestureRecognizer => false;

protected override void InitializeElement(ImageButton element)
{
element.Source = "small_dotnet_bot.png";
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class ImageCoreGalleryPage : CoreGalleryPage<Image>
{
protected override bool SupportsFocus => false;

protected override void InitializeElement(Image element)
{
element.Source = "small_dotnet_bot.png";
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class ListViewCoreGalleryPage : CoreGalleryPage<ListView>
{
protected override void InitializeElement(ListView element)
{
base.InitializeElement(element);

var items = new List<string>();

for (int n = 0; n < 1000; n++)
{
items.Add(DateTime.Now.AddDays(n).ToString("D"));
}

element.ItemsSource = items;

element.HeightRequest = 250;
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class PickerCoreGalleryPage : CoreGalleryPage<Picker>
{
protected override bool SupportsTapGestureRecognizer => false;

protected override void InitializeElement(Picker element)
{
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class ProgressBarCoreGalleryPage : CoreGalleryPage<ProgressBar>
{
protected override bool SupportsFocus => false;

protected override void InitializeElement(ProgressBar element)
{
element.Progress = 1;
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class SearchBarCoreGalleryPage : CoreGalleryPage<SearchBar>
{
protected override bool SupportsTapGestureRecognizer => true;

protected override void InitializeElement(SearchBar element)
{
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class SliderCoreGalleryPage : CoreGalleryPage<Slider>
{
protected override bool SupportsFocus => false;

protected override bool SupportsTapGestureRecognizer => false;

protected override void InitializeElement(Slider element)
{
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class StepperCoreGalleryPage : CoreGalleryPage<Stepper>
{
protected override bool SupportsFocus => false;
protected override bool SupportsTapGestureRecognizer => false;

protected override void InitializeElement(Stepper element)
{
}

protected override void Build()
{
base.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

internal class SwitchCoreGalleryPage : CoreGalleryPage<Switch>
{
protected override bool SupportsFocus => false;

protected override bool SupportsTapGestureRecognizer => false;

protected override void InitializeElement(Switch element)
{
}

protected override void Build()
{
base.Build();
}
}
Loading

0 comments on commit 9b19a92

Please sign in to comment.