Skip to content
Closed
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
7 changes: 7 additions & 0 deletions Microsoft.Maui.sln
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Core.Design.UnitTe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.DeviceTests.Shared", "src\Core\tests\DeviceTests.Shared\Core.DeviceTests.Shared.csproj", "{66CC98E3-6A1A-4C44-A23C-B575E82106EC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccessibilityCheck.Droid", "src\TestUtils\src\AccessibilityCheck.Droid\AccessibilityCheck.Droid.csproj", "{0F716D53-6EEF-4F87-A528-232BFA3AD044}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -637,6 +639,10 @@ Global
{66CC98E3-6A1A-4C44-A23C-B575E82106EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66CC98E3-6A1A-4C44-A23C-B575E82106EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66CC98E3-6A1A-4C44-A23C-B575E82106EC}.Release|Any CPU.Build.0 = Release|Any CPU
{0F716D53-6EEF-4F87-A528-232BFA3AD044}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F716D53-6EEF-4F87-A528-232BFA3AD044}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F716D53-6EEF-4F87-A528-232BFA3AD044}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F716D53-6EEF-4F87-A528-232BFA3AD044}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -755,6 +761,7 @@ Global
{F351A992-18E4-473C-8ADD-2BA0BAA7B5A2} = {1BA0121E-0B83-4C8F-81BE-C293E7E35DCE}
{F68932B0-81A2-4CC3-A4F7-28091EE91B23} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E}
{66CC98E3-6A1A-4C44-A23C-B575E82106EC} = {C564DDD6-DE79-45CD-88EA-3F690481572A}
{0F716D53-6EEF-4F87-A528-232BFA3AD044} = {7AC28763-9C68-4BF9-A1BA-25CBFFD2D15C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50}
Expand Down
38 changes: 0 additions & 38 deletions src/Controls/tests/DeviceTests/TestCategory.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Numerics;
using System.Threading.Tasks;
using Android.Views;
using Android.Webkit;
using Android.Widget;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
Expand Down Expand Up @@ -168,6 +169,23 @@ public async Task NeedsContainerWhenInputTransparent()
Assert.True(vh.NeedsContainer);
}

//[Fact(DisplayName = "Control meets basic accessibility requirements")]
//[Category(TestCategory.Accessibility)]
protected async Task AssertPlatformViewIsAccessible(TStub view)
{
var handler = await CreateHandlerAsync(view);

var platformView = handler.PlatformView as View;

await InvokeOnMainThreadAsync(async () =>
{
await platformView.AttachAndRun(() =>
{
TestUtils.DeviceTests.Accessibility.AssertAccessible(platformView);
});
});
}

protected string GetAutomationId(IViewHandler viewHandler) =>
$"{GetSemanticPlatformElement(viewHandler).ContentDescription}";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
namespace Microsoft.Maui.DeviceTests
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.Maui.DeviceTests
{
public static class TestCategory
{
public const string MauiContext = "MauiContext";

public const string Accessibility = "Accessibility";
public const string Application = "Application";
public const string ActivityIndicator = "ActivityIndicator";
public const string Behavior = "Behavior";
public const string Border = "Border";
public const string BoxView = "BoxView";
public const string Button = "Button";
public const string CheckBox = "CheckBox";
public const string Compatibility = "Compatibility";
public const string ContentView = "ContentView";
public const string DatePicker = "DatePicker";
public const string Dispatcher = "Dispatcher";
public const string Editor = "Editor";
public const string Element = "Element";
public const string Entry = "Entry";
public const string FlowDirection = "FlowDirection";
public const string FlyoutPage = "FlyoutPage";
public const string FlyoutView = "FlyoutView";
public const string Fonts = "Fonts";
public const string Frame = "Frame";
public const string Gesture = "Gesture";
public const string GraphicsView = "GraphicsView";
public const string Image = "Image";
public const string ImageButton = "ImageButton";
public const string ImageSource = "ImageSource";
public const string IndicatorView = "IndicatorView";
public const string Label = "Label";
public const string Layout = "Layout";
public const string ListView = "ListView";
public const string MenuFlyout = "MenuFlyout";
public const string Modal = "Modal";
public const string NavigationPage = "NavigationPage";
public const string NavigationView = "NavigationView";
public const string Page = "Page";
public const string Picker = "Picker";
Expand All @@ -33,12 +50,18 @@ public static class TestCategory
public const string ScrollView = "ScrollView";
public const string SearchBar = "SearchBar";
public const string ShapeView = "ShapeView";
public const string Shell = "Shell";
public const string Slider = "Slider";
public const string Stepper = "Stepper";
public const string Switch = "Switch";
public const string TabbedPage = "TabbedPage";
public const string TemplatedView = "TemplatedView";
public const string TextFormatting = "Formatting";
public const string TimePicker = "TimePicker";
public const string Toolbar = "Toolbar";
public const string View = "View";
public const string VisualElement = "VisualElement";
public const string VisualElementTree = "VisualElementTree";
public const string WebView = "WebView";
public const string Window = "Window";
public const string WindowOverlay = "WindowOverlay";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,13 @@ public override async Task SetVisibility(Visibility visibility)
var id = await GetValueAsync(view, handler => GetVisibility(handler));
Assert.Equal(view.Visibility, id);
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new ActivityIndicatorStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,13 @@ Task ValidateHasColor(IBorderView border, Color color, Action action = null)
nativeBorder.AssertContainsColor(color);
});
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new BorderStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.Maui.DeviceTests.Stubs;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;

Expand All @@ -19,5 +20,13 @@ Task ValidateHasColor(IShapeView boxView, Color color, Action action = null)
nativeBoxView.AssertContainsColor(color);
});
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new BoxViewStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,18 @@ Task ValidateHasColor(IButton button, Color color, Action action = null)
platformButton.AssertContainsColor(color);
});
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new ButtonStub();

// A button won't be considered accessible if it doesn't have text
// for a screen reader
view.Text = "Button Text";

await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using AndroidX.AppCompat.Widget;
using Microsoft.Maui.DeviceTests.Stubs;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;

Expand All @@ -26,5 +27,13 @@ Task ValidateHasColor(ICheckBox checkBoxStub, Color color, Action action = null)
nativeSwitch.AssertContainsColor(color);
});
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new CheckBoxStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,13 @@ double GetNativeCharacterSpacing(DatePickerHandler datePickerHandler)
var mauiDatePicker = GetNativeDatePicker(datePickerHandler);
return mauiDatePicker.LetterSpacing;
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new DatePickerStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,5 +222,16 @@ int GetNativeSelectionLength(EditorHandler editorHandler)

return -1;
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new EditorStub();

view.Semantics = new Semantics() { Hint = "Editor Hint" };

await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,13 @@ int GetNativeSelectionLength(EntryHandler entryHandler)

return -1;
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new EntryStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,13 @@ Aspect GetNativeAspect(IImageHandler imageHandler)

throw new ArgumentOutOfRangeException("Aspect");
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new TStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,16 @@ Task ValidateHasColor(IImageButton imageButton, Color color, Action action = nul

bool ImageSourceLoaded(ImageButtonHandler imageButtonHandler) =>
imageButtonHandler.PlatformView.Drawable != null;

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new ImageButtonStub();

view.Semantics = new Semantics() { Description = "Button Description" };

await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,13 @@ Task ValidateHasColor(ILabel label, Color color, Action action = null)
platformLabel.AssertContainsColor(color);
});
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new LabelStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,13 @@ Color GetNativeTextColor(PickerHandler pickerHandler)

GravityFlags GetNativeVerticalTextAlignment(PickerHandler pickerHandler) =>
GetNativePicker(pickerHandler).Gravity;

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new PickerStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;
using AProgressBar = Android.Widget.ProgressBar;
using Microsoft.Maui.DeviceTests.Stubs;

namespace Microsoft.Maui.DeviceTests
{
Expand All @@ -26,5 +27,13 @@ Task ValidateHasColor(IProgress progressBar, Color color, Action action = null)
platformProgressBar.AssertContainsColor(color);
});
}

[Fact(DisplayName = "Control meets basic accessibility requirements")]
[Category(TestCategory.Accessibility)]
public async Task PlatformViewIsAccessible()
{
var view = new ProgressBarStub();
await AssertPlatformViewIsAccessible(view);
}
}
}
Loading