diff --git a/src/Compatibility/Core/src/Windows/CollectionView/ItemsViewRenderer.cs b/src/Compatibility/Core/src/Windows/CollectionView/ItemsViewRenderer.cs index 8f97fd85928c..0f8efd563452 100644 --- a/src/Compatibility/Core/src/Windows/CollectionView/ItemsViewRenderer.cs +++ b/src/Compatibility/Core/src/Windows/CollectionView/ItemsViewRenderer.cs @@ -597,7 +597,8 @@ bool IsElementVisibleInContainer(FrameworkElement element, FrameworkElement cont default: return elementBounds.Left < containerBounds.Right && elementBounds.Right > containerBounds.Left; - }; + } + ; } void OnScrollViewChanged(object sender, ScrollViewerViewChangedEventArgs e) diff --git a/src/Compatibility/Core/src/iOS/Renderers/NavigationRenderer.cs b/src/Compatibility/Core/src/iOS/Renderers/NavigationRenderer.cs index 7eb2f18ec791..6b85dadcdd82 100644 --- a/src/Compatibility/Core/src/iOS/Renderers/NavigationRenderer.cs +++ b/src/Compatibility/Core/src/iOS/Renderers/NavigationRenderer.cs @@ -1642,7 +1642,8 @@ public override CGRect Frame value.Width = (value.X - xSpace) + value.Width; value.X = xSpace; } - }; + } + ; value.Height = ToolbarHeight; } diff --git a/src/Controls/src/BindingSourceGen/PathParser.cs b/src/Controls/src/BindingSourceGen/PathParser.cs index 99bf47af109c..e3b50bbf3f5a 100644 --- a/src/Controls/src/BindingSourceGen/PathParser.cs +++ b/src/Controls/src/BindingSourceGen/PathParser.cs @@ -142,7 +142,8 @@ private Result> HandleBinaryExpression(BinaryExpressionSyntax as if (typeInfo == null) { return Result>.Failure(DiagnosticsFactory.UnableToResolvePath(castTo.GetLocation())); - }; + } + ; leftResult.Value.Add(new Cast(typeInfo.CreateTypeDescription(_enabledNullable))); @@ -161,7 +162,8 @@ private Result> HandleCastExpression(CastExpressionSyntax castEx if (typeInfo == null) { return Result>.Failure(DiagnosticsFactory.UnableToResolvePath(castExpression.GetLocation())); - }; + } + ; result.Value.Add(new Cast(typeInfo.CreateTypeDescription(_enabledNullable))); diff --git a/src/Controls/src/Core/AppThemeBinding.cs b/src/Controls/src/Core/AppThemeBinding.cs index 9aaff6c80a90..3685ad9398c8 100644 --- a/src/Controls/src/Core/AppThemeBinding.cs +++ b/src/Controls/src/Core/AppThemeBinding.cs @@ -114,7 +114,8 @@ void Set() } target.SetValueCore(_targetProperty, value, Internals.SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted, specificity); } - }; + } + ; } object _light; diff --git a/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs index 7eb1d1e67431..3a730a89e104 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs @@ -1115,7 +1115,7 @@ public override UITableViewCell GetCell(UITableView tableView, NSIndexPath index PreserveActivityIndicatorState(cell); Performance.Stop(reference); - if(platformCell is ContextActionsCell contextActionsCell) + if (platformCell is ContextActionsCell contextActionsCell) _contextActionsCells.Add(contextActionsCell); return platformCell; diff --git a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs index bd2e54e64115..54366c0e1c15 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs @@ -1996,7 +1996,8 @@ public override CGRect Frame value.Width = (value.X - xSpace) + value.Width; value.X = xSpace; } - }; + } + ; value.Height = ToolbarHeight; } diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRendererBase.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRendererBase.cs index e69d6bacd67d..3efd98363373 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRendererBase.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRendererBase.cs @@ -393,7 +393,8 @@ void RemoveAllButCurrent(Fragment skip) trans ??= ChildFragmentManager.BeginTransactionEx(); trans.Remove(f); - }; + } + ; trans?.CommitAllowingStateLossEx(); } diff --git a/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs b/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs index 272eec544592..50fa6676d369 100644 --- a/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs +++ b/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs @@ -583,7 +583,8 @@ bool IsElementVisibleInContainer(FrameworkElement element, FrameworkElement cont default: return elementBounds.Left < containerBounds.Right && elementBounds.Right > containerBounds.Left; - }; + } + ; } async void ScrollToRequested(object sender, ScrollToRequestEventArgs args) diff --git a/src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewController.cs index 5b3ed42585fc..9376cdf61d50 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewController.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewController.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using Foundation; +using Microsoft.Maui.Controls.Platform; using ObjCRuntime; using UIKit; -using Microsoft.Maui.Controls.Platform; namespace Microsoft.Maui.Controls.Handlers.Items { diff --git a/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs index d3c238ec10e4..bef1290c9420 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs @@ -4,9 +4,9 @@ using CoreGraphics; using Foundation; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.Platform; using Microsoft.Maui.Graphics; using UIKit; -using Microsoft.Maui.Controls.Platform; namespace Microsoft.Maui.Controls.Handlers.Items { @@ -97,8 +97,8 @@ public override UICollectionViewLayoutAttributes PreferredLayoutAttributesFittin var preferredAttributes = base.PreferredLayoutAttributesFittingAttributes(layoutAttributes); if (_measureInvalidated || - !AttributesConsistentWithConstrainedDimension(preferredAttributes) || - !preferredAttributes.Frame.Size.IsCloseTo(_size)) + !AttributesConsistentWithConstrainedDimension(preferredAttributes) || + !preferredAttributes.Frame.Size.IsCloseTo(_size)) { // Measure this cell (including the Forms element) if there is no constrained size var size = ConstrainedSize == default ? Measure() : ConstrainedSize; diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs index c7b5d7f429e3..1514f7efb4bb 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs @@ -300,7 +300,7 @@ private int GetTargetPosition() { return 0; } - + return ItemsView.ItemsUpdatingScrollMode switch { ItemsUpdatingScrollMode.KeepItemsInView => 0, diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs index 3a499ce42fdb..8dbc33e96e1c 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs @@ -62,7 +62,8 @@ static NSCollectionLayoutBoundarySupplementaryItem[] CreateSupplementaryItems(La scrollDirection == UICollectionViewScrollDirection.Vertical ? NSRectAlignment.Top : NSRectAlignment.Leading)); - }; + } + ; if (layoutHeaderFooterInfo.HasFooter) { diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/SelectableItemsViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/SelectableItemsViewController2.cs index 6909afabc29a..fdfe3578bb12 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/SelectableItemsViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/SelectableItemsViewController2.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using Foundation; +using Microsoft.Maui.Controls.Platform; using ObjCRuntime; using UIKit; -using Microsoft.Maui.Controls.Platform; namespace Microsoft.Maui.Controls.Handlers.Items2 { diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs index 4823dff0bbe6..a085f966f95e 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs @@ -195,7 +195,7 @@ void InvalidateLayoutIfItemsMeasureChanged() // We could then invalidate the layout for supplementary cell only `collectionView.IndexPathForCell(headerCell)` like we do on standard cells, // but that causes other cells to oddly collapse (see Issue25362 UITest), so in this case we have to stick with `InvalidateLayout`. var collectionView = CollectionView; - + if (ItemsView.Header is not null || ItemsView.HeaderTemplate is not null) { var visibleHeaders = collectionView.GetVisibleSupplementaryViews(UICollectionElementKindSectionKey.Header); diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs index 16ba34065d9d..0cbbb32eb1d0 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs @@ -144,8 +144,8 @@ public override void PrepareForReuse() public void Bind(DataTemplate template, object bindingContext, ItemsView itemsView) { - var virtualView = PlatformHandler?.VirtualView as View ?? - template.CreateContent(bindingContext, itemsView) as View; + var virtualView = PlatformHandler?.VirtualView as View ?? + template.CreateContent(bindingContext, itemsView) as View; BindVirtualView(virtualView, bindingContext, itemsView, false); } diff --git a/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs index 1fe23332fa72..7348dbd80992 100644 --- a/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs +++ b/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs @@ -87,9 +87,9 @@ public static void UpdateToolbarDynamicOverflowEnabled(this MauiToolbar platform private static void UpdateBackButtonVisibility(MauiToolbar platformToolbar, Toolbar toolbar) { - platformToolbar.IsBackButtonVisible = - toolbar.BackButtonVisible - ? NavigationViewBackButtonVisible.Visible + platformToolbar.IsBackButtonVisible = + toolbar.BackButtonVisible + ? NavigationViewBackButtonVisible.Visible : NavigationViewBackButtonVisible.Collapsed; } } diff --git a/src/Controls/src/Core/Shell/ShellSection.cs b/src/Controls/src/Core/Shell/ShellSection.cs index 82fd8e125c56..5f648989cde7 100644 --- a/src/Controls/src/Core/Shell/ShellSection.cs +++ b/src/Controls/src/Core/Shell/ShellSection.cs @@ -694,7 +694,8 @@ void WaitForRendererToGetRemoved(object s, EventArgs p) { sc.Page.PlatformEnabledChanged -= WaitForRendererToGetRemoved; base.OnChildRemoved(child, oldLogicalIndex); - }; + } + ; } else { diff --git a/src/Controls/tests/Core.UnitTests/BindingUnitTests.cs b/src/Controls/tests/Core.UnitTests/BindingUnitTests.cs index fd83f3611231..42eb82cacb8c 100644 --- a/src/Controls/tests/Core.UnitTests/BindingUnitTests.cs +++ b/src/Controls/tests/Core.UnitTests/BindingUnitTests.cs @@ -1241,7 +1241,8 @@ void create() proxies.Add(new WeakReference(listener)); } Assert.NotEmpty(proxies); // Should be at least 1 - }; + } + ; create(); await Task.Yield(); diff --git a/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs index 025a2d4adff6..0617a838d63a 100644 --- a/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs @@ -61,8 +61,8 @@ await AttachAndRun(border, (handler) => await AssertColorAtPoint(border, expected, typeof(BorderHandler), cornerRadius, cornerRadius); } - [Fact] - [Description("The IsVisible property of a Border should match with native IsVisible")] + [Fact] + [Description("The IsVisible property of a Border should match with native IsVisible")] public async Task VerifyBorderIsVisibleProperty() { var border = new Border(); @@ -73,9 +73,9 @@ public async Task VerifyBorderIsVisibleProperty() var nativeView = GetNativeBorder(handler); await InvokeOnMainThreadAsync(() => { - var isVisible = nativeView.Visibility == Microsoft.UI.Xaml.Visibility.Visible; - Assert.Equal(expectedValue, isVisible); - }); + var isVisible = nativeView.Visibility == Microsoft.UI.Xaml.Visibility.Visible; + Assert.Equal(expectedValue, isVisible); + }); } ContentPanel GetNativeBorder(BorderHandler borderHandler) => diff --git a/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.cs b/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.cs index 1c981f97c74b..278b426bcfc5 100644 --- a/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.cs @@ -259,7 +259,7 @@ await InvokeOnMainThreadAsync(() => await AssertionExtensions.WaitForGC(handlerReference, platformViewReference); } - + [Fact(DisplayName = "Border With Stroke Shape And Name Does Not Leak")] public async Task DoesNotLeakWithStrokeShape() { diff --git a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs index 0d84d49eb8e3..5bb974663958 100644 --- a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs @@ -9,10 +9,10 @@ namespace Microsoft.Maui.DeviceTests { - public partial class BoxViewTests - { - MauiShapeView GetNativeBoxView(ShapeViewHandler boxViewViewHandler) => - boxViewViewHandler.PlatformView; + public partial class BoxViewTests + { + MauiShapeView GetNativeBoxView(ShapeViewHandler boxViewViewHandler) => + boxViewViewHandler.PlatformView; Task GetPlatformOpacity(ShapeViewHandler handler) { @@ -22,81 +22,81 @@ Task GetPlatformOpacity(ShapeViewHandler handler) return nativeView.Alpha; }); } - - [Fact] - [Description("The ScaleX property of a BoxView should match with native ScaleX")] - public async Task ScaleXConsistent() - { - var boxView = new BoxView() { ScaleX = 0.45f }; - var expected = boxView.ScaleX; - var handler = await CreateHandlerAsync(boxView); - var platformBoxView = GetNativeBoxView(handler); - var platformScaleX = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleX); - Assert.Equal(expected, platformScaleX); - } - [Fact] - [Description("The ScaleY property of a BoxView should match with native ScaleY")] - public async Task ScaleYConsistent() - { - var boxView = new BoxView() { ScaleY = 1.23f }; - var expected = boxView.ScaleY; - var handler = await CreateHandlerAsync(boxView); - var platformBoxView = GetNativeBoxView(handler); - var platformScaleY = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleY); - Assert.Equal(expected, platformScaleY); - } + [Fact] + [Description("The ScaleX property of a BoxView should match with native ScaleX")] + public async Task ScaleXConsistent() + { + var boxView = new BoxView() { ScaleX = 0.45f }; + var expected = boxView.ScaleX; + var handler = await CreateHandlerAsync(boxView); + var platformBoxView = GetNativeBoxView(handler); + var platformScaleX = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleX); + Assert.Equal(expected, platformScaleX); + } + + [Fact] + [Description("The ScaleY property of a BoxView should match with native ScaleY")] + public async Task ScaleYConsistent() + { + var boxView = new BoxView() { ScaleY = 1.23f }; + var expected = boxView.ScaleY; + var handler = await CreateHandlerAsync(boxView); + var platformBoxView = GetNativeBoxView(handler); + var platformScaleY = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleY); + Assert.Equal(expected, platformScaleY); + } + + [Fact] + [Description("The Scale property of a BoxView should match with native Scale")] + public async Task ScaleConsistent() + { + var boxView = new BoxView() { Scale = 2.0f }; + var expected = boxView.Scale; + var handler = await CreateHandlerAsync(boxView); + var platformBoxView = GetNativeBoxView(handler); + var platformScaleX = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleX); + var platformScaleY = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleY); + Assert.Equal(expected, platformScaleX); + Assert.Equal(expected, platformScaleY); + } - [Fact] - [Description("The Scale property of a BoxView should match with native Scale")] - public async Task ScaleConsistent() - { - var boxView = new BoxView() { Scale = 2.0f }; - var expected = boxView.Scale; - var handler = await CreateHandlerAsync(boxView); - var platformBoxView = GetNativeBoxView(handler); - var platformScaleX = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleX); - var platformScaleY = await InvokeOnMainThreadAsync(() => platformBoxView.ScaleY); - Assert.Equal(expected, platformScaleX); - Assert.Equal(expected, platformScaleY); - } + [Fact] + [Description("The RotationX property of a BoxView should match with native RotationX")] + public async Task RotationXConsistent() + { + var boxView = new BoxView() { RotationX = 33.0 }; + var expected = boxView.RotationX; + var handler = await CreateHandlerAsync(boxView); + var platformBoxView = GetNativeBoxView(handler); + var platformRotationX = await InvokeOnMainThreadAsync(() => platformBoxView.RotationX); + Assert.Equal(expected, platformRotationX); + } - [Fact] - [Description("The RotationX property of a BoxView should match with native RotationX")] - public async Task RotationXConsistent() - { - var boxView = new BoxView() { RotationX = 33.0 }; - var expected = boxView.RotationX; - var handler = await CreateHandlerAsync(boxView); - var platformBoxView = GetNativeBoxView(handler); - var platformRotationX = await InvokeOnMainThreadAsync(() => platformBoxView.RotationX); - Assert.Equal(expected, platformRotationX); - } + [Fact] + [Description("The RotationY property of a BoxView should match with native RotationY")] + public async Task RotationYConsistent() + { + var boxView = new BoxView() { RotationY = 87.0 }; + var expected = boxView.RotationY; + var handler = await CreateHandlerAsync(boxView); + var platformBoxView = GetNativeBoxView(handler); + var platformRotationY = await InvokeOnMainThreadAsync(() => platformBoxView.RotationY); + Assert.Equal(expected, platformRotationY); + } - [Fact] - [Description("The RotationY property of a BoxView should match with native RotationY")] - public async Task RotationYConsistent() - { - var boxView = new BoxView() { RotationY = 87.0 }; - var expected = boxView.RotationY; - var handler = await CreateHandlerAsync(boxView); - var platformBoxView = GetNativeBoxView(handler); - var platformRotationY = await InvokeOnMainThreadAsync(() => platformBoxView.RotationY); - Assert.Equal(expected, platformRotationY); - } + [Fact] + [Description("The Rotation property of a BoxView should match with native Rotation")] + public async Task RotationConsistent() + { + var boxView = new BoxView() { Rotation = 23.0 }; + var expected = boxView.Rotation; + var handler = await CreateHandlerAsync(boxView); + var platformBoxView = GetNativeBoxView(handler); + var platformRotation = await InvokeOnMainThreadAsync(() => platformBoxView.Rotation); + Assert.Equal(expected, platformRotation); + } - [Fact] - [Description("The Rotation property of a BoxView should match with native Rotation")] - public async Task RotationConsistent() - { - var boxView = new BoxView() { Rotation = 23.0 }; - var expected = boxView.Rotation; - var handler = await CreateHandlerAsync(boxView); - var platformBoxView = GetNativeBoxView(handler); - var platformRotation = await InvokeOnMainThreadAsync(() => platformBoxView.Rotation); - Assert.Equal(expected, platformRotation); - } - Task GetPlatformIsVisible(ShapeViewHandler boxViewViewHandler) { return InvokeOnMainThreadAsync(() => diff --git a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Windows.cs index 88e0735833b1..aaa5dc93e8e1 100644 --- a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Windows.cs @@ -19,7 +19,7 @@ Task GetPlatformOpacity(ShapeViewHandler handler) return (float)nativeView.Opacity; }); } - + Task GetPlatformIsVisible(ShapeViewHandler boxViewHandler) { return InvokeOnMainThreadAsync(() => diff --git a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs index cf574048faf1..b5f4b80ea067 100644 --- a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs @@ -2,11 +2,11 @@ using System.Diagnostics; using System.Threading.Tasks; using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Handlers; using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; using Microsoft.Maui.Hosting; using Xunit; -using Microsoft.Maui.Controls.Handlers; namespace Microsoft.Maui.DeviceTests { @@ -64,9 +64,9 @@ await InvokeOnMainThreadAsync(async () => Assert.Equal(expectedValue, nativeOpacityValue); }); } - + [Fact] - [Description("The IsVisible property of a BoxView should match with native IsVisible")] + [Description("The IsVisible property of a BoxView should match with native IsVisible")] public async Task VerifyBoxViewIsVisibleProperty() { var boxView = new BoxView(); @@ -74,11 +74,11 @@ public async Task VerifyBoxViewIsVisibleProperty() var expectedValue = boxView.IsVisible; var handler = await CreateHandlerAsync(boxView); - await InvokeOnMainThreadAsync( async () => + await InvokeOnMainThreadAsync(async () => { - var isVisible = await GetPlatformIsVisible(handler); - Assert.Equal(expectedValue, isVisible); - }); + var isVisible = await GetPlatformIsVisible(handler); + Assert.Equal(expectedValue, isVisible); + }); } } } \ No newline at end of file diff --git a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.iOS.cs index a5180aec06a2..2bf127b6c58a 100644 --- a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.iOS.cs @@ -1,14 +1,14 @@ using System; +using System.ComponentModel; using System.Reflection; using System.Threading.Tasks; using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Handlers; using Microsoft.Maui.Graphics; using Microsoft.Maui.Graphics.Platform; using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using Xunit; -using System.ComponentModel; -using Microsoft.Maui.Controls.Handlers; namespace Microsoft.Maui.DeviceTests { @@ -25,7 +25,7 @@ Task GetPlatformOpacity(ShapeViewHandler handler) return (float)nativeView.Alpha; }); } - + Task GetPlatformIsVisible(ShapeViewHandler boxViewHandler) { return InvokeOnMainThreadAsync(() => diff --git a/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs index c0a229238f06..a572514e9cfb 100644 --- a/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs @@ -116,7 +116,7 @@ await InvokeOnMainThreadAsync(async () => Assert.Equal(expectedValue, nativeOpacityValue); }); } - + [Fact] [Description("The ScaleX property of a Button should match with native ScaleX")] public async Task ScaleXConsistent() diff --git a/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Windows.cs index c7713d1d4c02..6d052dc3a67c 100644 --- a/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Windows.cs @@ -1,10 +1,10 @@ #nullable enable +using System.ComponentModel; using System.Threading.Tasks; using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System.ComponentModel; using Xunit; namespace Microsoft.Maui.DeviceTests @@ -57,6 +57,6 @@ await InvokeOnMainThreadAsync(async () => Assert.Equal(expectedValue, nativeOpacityValue); }); } - + } } diff --git a/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs index 7403625f6268..b48c83eec67b 100644 --- a/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs @@ -9,11 +9,11 @@ namespace Microsoft.Maui.DeviceTests { - [Collection(RunInNewWindowCollection)] - public partial class CheckBoxTests - { - AppCompatCheckBox GetNativeCheckBox(CheckBoxHandler checkBoxHandler) => - checkBoxHandler.PlatformView; + [Collection(RunInNewWindowCollection)] + public partial class CheckBoxTests + { + AppCompatCheckBox GetNativeCheckBox(CheckBoxHandler checkBoxHandler) => + checkBoxHandler.PlatformView; Task GetPlatformOpacity(CheckBoxHandler CheckBoxHandler) { @@ -23,81 +23,81 @@ Task GetPlatformOpacity(CheckBoxHandler CheckBoxHandler) return nativeView.Alpha; }); } - - [Fact] - [Description("The ScaleX property of a CheckBox should match with native ScaleX")] - public async Task ScaleXConsistent() - { - var checkBox = new CheckBox() { ScaleX = 0.45f }; - var expected = checkBox.ScaleX; - var handler = await CreateHandlerAsync(checkBox); - var PlatformCheckBox = GetNativeCheckBox(handler); - var platformScaleX = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleX); - Assert.Equal(expected, platformScaleX); - } - [Fact] - [Description("The ScaleY property of a CheckBox should match with native ScaleY")] - public async Task ScaleYConsistent() - { - var checkBox = new CheckBox() { ScaleY = 1.23f }; - var expected = checkBox.ScaleY; - var handler = await CreateHandlerAsync(checkBox); - var PlatformCheckBox = GetNativeCheckBox(handler); - var platformScaleY = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleY); - Assert.Equal(expected, platformScaleY); - } - - [Fact] - [Description("The Scale property of a CheckBox should match with native Scale")] - public async Task ScaleConsistent() - { - var checkBox = new CheckBox() { Scale = 2.0f }; - var expected = checkBox.Scale; - var handler = await CreateHandlerAsync(checkBox); - var PlatformCheckBox = GetNativeCheckBox(handler); - var platformScaleX = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleX); - var platformScaleY = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleY); - Assert.Equal(expected, platformScaleX); - Assert.Equal(expected, platformScaleY); - } + [Fact] + [Description("The ScaleX property of a CheckBox should match with native ScaleX")] + public async Task ScaleXConsistent() + { + var checkBox = new CheckBox() { ScaleX = 0.45f }; + var expected = checkBox.ScaleX; + var handler = await CreateHandlerAsync(checkBox); + var PlatformCheckBox = GetNativeCheckBox(handler); + var platformScaleX = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleX); + Assert.Equal(expected, platformScaleX); + } + + [Fact] + [Description("The ScaleY property of a CheckBox should match with native ScaleY")] + public async Task ScaleYConsistent() + { + var checkBox = new CheckBox() { ScaleY = 1.23f }; + var expected = checkBox.ScaleY; + var handler = await CreateHandlerAsync(checkBox); + var PlatformCheckBox = GetNativeCheckBox(handler); + var platformScaleY = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleY); + Assert.Equal(expected, platformScaleY); + } - [Fact] - [Description("The RotationX property of a CheckBox should match with native RotationX")] - public async Task RotationXConsistent() - { - var checkBox = new CheckBox() { RotationX = 33.0 }; - var expected = checkBox.RotationX; - var handler = await CreateHandlerAsync(checkBox); - var PlatformCheckBox = GetNativeCheckBox(handler); - var platformRotationX = await InvokeOnMainThreadAsync(() => PlatformCheckBox.RotationX); - Assert.Equal(expected, platformRotationX); - } + [Fact] + [Description("The Scale property of a CheckBox should match with native Scale")] + public async Task ScaleConsistent() + { + var checkBox = new CheckBox() { Scale = 2.0f }; + var expected = checkBox.Scale; + var handler = await CreateHandlerAsync(checkBox); + var PlatformCheckBox = GetNativeCheckBox(handler); + var platformScaleX = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleX); + var platformScaleY = await InvokeOnMainThreadAsync(() => PlatformCheckBox.ScaleY); + Assert.Equal(expected, platformScaleX); + Assert.Equal(expected, platformScaleY); + } - [Fact] - [Description("The RotationY property of a CheckBox should match with native RotationY")] - public async Task RotationYConsistent() - { - var checkBox = new CheckBox() { RotationY = 87.0 }; - var expected = checkBox.RotationY; - var handler = await CreateHandlerAsync(checkBox); - var PlatformCheckBox = GetNativeCheckBox(handler); - var platformRotationY = await InvokeOnMainThreadAsync(() => PlatformCheckBox.RotationY); - Assert.Equal(expected, platformRotationY); - } + [Fact] + [Description("The RotationX property of a CheckBox should match with native RotationX")] + public async Task RotationXConsistent() + { + var checkBox = new CheckBox() { RotationX = 33.0 }; + var expected = checkBox.RotationX; + var handler = await CreateHandlerAsync(checkBox); + var PlatformCheckBox = GetNativeCheckBox(handler); + var platformRotationX = await InvokeOnMainThreadAsync(() => PlatformCheckBox.RotationX); + Assert.Equal(expected, platformRotationX); + } + + [Fact] + [Description("The RotationY property of a CheckBox should match with native RotationY")] + public async Task RotationYConsistent() + { + var checkBox = new CheckBox() { RotationY = 87.0 }; + var expected = checkBox.RotationY; + var handler = await CreateHandlerAsync(checkBox); + var PlatformCheckBox = GetNativeCheckBox(handler); + var platformRotationY = await InvokeOnMainThreadAsync(() => PlatformCheckBox.RotationY); + Assert.Equal(expected, platformRotationY); + } + + [Fact] + [Description("The Rotation property of a CheckBox should match with native Rotation")] + public async Task RotationConsistent() + { + var checkBox = new CheckBox() { Rotation = 23.0 }; + var expected = checkBox.Rotation; + var handler = await CreateHandlerAsync(checkBox); + var PlatformCheckBox = GetNativeCheckBox(handler); + var platformRotation = await InvokeOnMainThreadAsync(() => PlatformCheckBox.Rotation); + Assert.Equal(expected, platformRotation); + } - [Fact] - [Description("The Rotation property of a CheckBox should match with native Rotation")] - public async Task RotationConsistent() - { - var checkBox = new CheckBox() { Rotation = 23.0 }; - var expected = checkBox.Rotation; - var handler = await CreateHandlerAsync(checkBox); - var PlatformCheckBox = GetNativeCheckBox(handler); - var platformRotation = await InvokeOnMainThreadAsync(() => PlatformCheckBox.Rotation); - Assert.Equal(expected, platformRotation); - } - Task GetPlatformIsVisible(CheckBoxHandler checkBoxHandler) { return InvokeOnMainThreadAsync(() => diff --git a/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs index f2213688efe0..8cb6ee4454de 100644 --- a/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs @@ -1,11 +1,11 @@ using System; +using System.ComponentModel; using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; using Microsoft.Maui.Hosting; using Xunit; -using System.ComponentModel; namespace Microsoft.Maui.DeviceTests { @@ -64,7 +64,7 @@ await InvokeOnMainThreadAsync(async () => } [Fact] - [Description("The IsVisible property of a CheckBox should match with native IsVisible")] + [Description("The IsVisible property of a CheckBox should match with native IsVisible")] public async Task VerifyCheckBoxIsVisibleProperty() { var checkBox = new CheckBox(); @@ -74,9 +74,9 @@ public async Task VerifyCheckBoxIsVisibleProperty() var handler = await CreateHandlerAsync(checkBox); await InvokeOnMainThreadAsync(async () => { - var isVisible = await GetPlatformIsVisible(handler); - Assert.Equal(expectedValue, isVisible); - }); + var isVisible = await GetPlatformIsVisible(handler); + Assert.Equal(expectedValue, isVisible); + }); } } } \ No newline at end of file diff --git a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Android.cs index 92fa952203ba..e2551da6db6f 100644 --- a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Android.cs @@ -1,12 +1,12 @@ -using System.Threading.Tasks; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Handlers.Items; using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using Xunit; -using System.Collections.ObjectModel; -using System.Linq; namespace Microsoft.Maui.DeviceTests { @@ -138,7 +138,7 @@ public async Task ObservableSourceItemsCountConsistent() source.Add("Item 3"); var count = 0; await InvokeOnMainThreadAsync(() => - { + { count = ois.Count; Assert.Equal(3, ois.Count); }); diff --git a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs index e538b903ce26..8aec647b4737 100644 --- a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs @@ -3,15 +3,15 @@ using System.Collections.ObjectModel; using System.Threading.Tasks; using CoreGraphics; +using Foundation; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Handlers.Items; using Microsoft.Maui.Graphics; +using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using UIKit; using Xunit; using Xunit.Sdk; -using Foundation; -using Microsoft.Maui.Handlers; namespace Microsoft.Maui.DeviceTests { diff --git a/src/Controls/tests/DeviceTests/Elements/DatePicker/DatePickerTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/DatePicker/DatePickerTests.Windows.cs index 394255698f83..4e2b29e314ef 100644 --- a/src/Controls/tests/DeviceTests/Elements/DatePicker/DatePickerTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/DatePicker/DatePickerTests.Windows.cs @@ -38,6 +38,6 @@ await InvokeOnMainThreadAsync(() => }); } - static CalendarDatePicker GetPlatformControl(DatePickerHandler handler) => + static CalendarDatePicker GetPlatformControl(DatePickerHandler handler) => handler.PlatformView; } \ No newline at end of file diff --git a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs index c5e91d40eef7..b4e1bf5113ae 100644 --- a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs @@ -310,7 +310,7 @@ await InvokeOnMainThreadAsync(async () => } [Fact] - [Description("The IsVisible property of a Editor should match with native IsVisible")] + [Description("The IsVisible property of a Editor should match with native IsVisible")] public async Task VerifyEditorIsVisibleProperty() { var editor = new Editor(); diff --git a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.iOS.cs index 6be8fb8fb7b4..ca6ed41f60ac 100644 --- a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.iOS.cs @@ -48,7 +48,7 @@ Task GetPlatformOpacity(EditorHandler editorHandler) return InvokeOnMainThreadAsync(() => { var nativeView = GetPlatformControl(editorHandler); - return (float)nativeView.Alpha; + return (float)nativeView.Alpha; }); } diff --git a/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.cs b/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.cs index 33557b1e1993..5a8544ea4f36 100644 --- a/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.cs @@ -223,7 +223,7 @@ await InvokeOnMainThreadAsync(async () => } [Fact] - [Description("The IsVisible property of a Entry should match with native IsVisible")] + [Description("The IsVisible property of a Entry should match with native IsVisible")] public async Task VerifyEntryIsVisibleProperty() { var entry = new Entry(); diff --git a/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.iOS.cs index 4a2e9e48c957..f2518584d15d 100644 --- a/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.iOS.cs @@ -44,13 +44,13 @@ static int GetPlatformSelectionLength(EntryHandler entryHandler) return -1; } - + Task GetPlatformOpacity(EntryHandler entryHandler) { return InvokeOnMainThreadAsync(() => { var nativeView = GetPlatformControl(entryHandler); - return (float)nativeView.Alpha; + return (float)nativeView.Alpha; }); } diff --git a/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs b/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs index 4f76be3805e1..19b282799fe6 100644 --- a/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs @@ -62,6 +62,6 @@ public async Task ImageBackgroundColorConsistent() }; await ValidateHasColor(image, expected, typeof(ImageHandler)); - } + } } } \ No newline at end of file diff --git a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs index 650f2c638dfd..14fa067a44e2 100644 --- a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs @@ -29,7 +29,7 @@ await InvokeOnMainThreadAsync((System.Action)(() => Assert.Equal(LineBreakMode.TailTruncation.ToPlatform(), GetPlatformLineBreakMode(handler)); })); } - + UILabel GetPlatformLabel(LabelHandler labelHandler) => (UILabel)labelHandler.PlatformView; @@ -74,7 +74,7 @@ Task GetPlatformOpacity(LabelHandler labelHandler) return InvokeOnMainThreadAsync(() => { var nativeView = GetPlatformLabel(labelHandler); - return (float)nativeView.Alpha; + return (float)nativeView.Alpha; }); } public static IEnumerable GetCharacterSpacingWithLineHeightWithTextDecorationsWorksTestData() diff --git a/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.Android.cs index 50ac8aa24fc7..040664e37be5 100644 --- a/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.Android.cs @@ -29,7 +29,7 @@ Task GetPlatformOpacity(PickerHandler pickerHandler) return (float)nativeView.Alpha; }); } - + [Fact] [Description("The ScaleX property of a Picker should match with native ScaleX")] public async Task ScaleXConsistent() diff --git a/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.iOS.cs index 7ca87c59224d..fcd5d1613e96 100644 --- a/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Picker/PickerTests.iOS.cs @@ -9,24 +9,24 @@ namespace Microsoft.Maui.DeviceTests { - public partial class PickerTests : ControlsHandlerTestBase - { - protected Task GetPlatformControlText(MauiPicker platformView) - { - return InvokeOnMainThreadAsync(() => platformView.Text); - } + public partial class PickerTests : ControlsHandlerTestBase + { + protected Task GetPlatformControlText(MauiPicker platformView) + { + return InvokeOnMainThreadAsync(() => platformView.Text); + } - MauiPicker GetPlatformPicker(PickerHandler pickerHandler) => - pickerHandler.PlatformView; + MauiPicker GetPlatformPicker(PickerHandler pickerHandler) => + pickerHandler.PlatformView; - Task GetPlatformOpacity(PickerHandler pickerHandler) - { - return InvokeOnMainThreadAsync(() => - { - var nativeView = GetPlatformPicker(pickerHandler); - return (float)nativeView.Alpha; - }); - } + Task GetPlatformOpacity(PickerHandler pickerHandler) + { + return InvokeOnMainThreadAsync(() => + { + var nativeView = GetPlatformPicker(pickerHandler); + return (float)nativeView.Alpha; + }); + } - } + } } \ No newline at end of file diff --git a/src/Controls/tests/DeviceTests/Elements/RadioButton/RadioButtonTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/RadioButton/RadioButtonTests.Windows.cs index 30853568b48e..35f066863c3d 100644 --- a/src/Controls/tests/DeviceTests/Elements/RadioButton/RadioButtonTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/RadioButton/RadioButtonTests.Windows.cs @@ -28,13 +28,13 @@ public async Task VerifyRadioButtonOpacityProperty() var nativeView = GetNativeRadioButton(handler); await InvokeOnMainThreadAsync(() => { - var nativeOpacityValue = (float)nativeView.Opacity; - Assert.Equal(expectedValue, nativeOpacityValue); - }); + var nativeOpacityValue = (float)nativeView.Opacity; + Assert.Equal(expectedValue, nativeOpacityValue); + }); } [Fact] - [Description("The IsVisible property of a RadioButton should match with native IsVisible")] + [Description("The IsVisible property of a RadioButton should match with native IsVisible")] public async Task VerifyRadioButtonIsVisibleProperty() { var radioButton = new RadioButton(); @@ -45,9 +45,9 @@ public async Task VerifyRadioButtonIsVisibleProperty() var nativeView = GetNativeRadioButton(handler); await InvokeOnMainThreadAsync(() => { - var isVisible = nativeView.Visibility == Microsoft.UI.Xaml.Visibility.Visible; - Assert.Equal(expectedValue, isVisible); - }); + var isVisible = nativeView.Visibility == Microsoft.UI.Xaml.Visibility.Visible; + Assert.Equal(expectedValue, isVisible); + }); } } } diff --git a/src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.iOS.cs index 1257dde7683c..8495f10ccdd3 100644 --- a/src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.iOS.cs @@ -41,7 +41,8 @@ public async Task ContentSizeExpandsToViewport() static CoreGraphics.CGSize getViewportSize(UIScrollView scrollView) { return scrollView.AdjustedContentInset.InsetRect(scrollView.Bounds).Size; - }; + } + ; var scrollViewHandler = await InvokeOnMainThreadAsync(() => { diff --git a/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Android.cs index 335b55cebb19..62bf4ac1a138 100644 --- a/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Android.cs @@ -42,7 +42,7 @@ Task GetPlatformOpacity(SearchBarHandler searchBarHandler) return nativeView.Alpha; }); } - + [Fact] [Description("The ScaleX property of a SearchBar should match with native ScaleX")] public async Task ScaleXConsistent() diff --git a/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.cs b/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.cs index 13d257c70fd0..7546ee8b2d6a 100644 --- a/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.cs @@ -1,10 +1,10 @@ using System; +using System.ComponentModel; using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using Xunit; -using System.ComponentModel; namespace Microsoft.Maui.DeviceTests { @@ -86,7 +86,7 @@ public async Task VerifySearchBarOpacityProperty() Opacity = 0.35f }; var expectedValue = searchBar.Opacity; - + var handler = await CreateHandlerAsync(searchBar); await InvokeOnMainThreadAsync(async () => { @@ -96,7 +96,7 @@ await InvokeOnMainThreadAsync(async () => } [Fact] - [Description("The IsVisible property of a SearchBar should match with native IsVisible")] + [Description("The IsVisible property of a SearchBar should match with native IsVisible")] public async Task VerifySearchBarIsVisibleProperty() { var searchBar = new SearchBar @@ -108,9 +108,9 @@ public async Task VerifySearchBarIsVisibleProperty() var handler = await CreateHandlerAsync(searchBar); await InvokeOnMainThreadAsync(async () => { - var isVisible = await GetPlatformIsVisible(handler); - Assert.Equal(expectedValue, isVisible); - }); + var isVisible = await GetPlatformIsVisible(handler); + Assert.Equal(expectedValue, isVisible); + }); } #if false diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs index ddc7fc64d2ef..f6ecc8afb525 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs @@ -470,7 +470,7 @@ public async Task FlyoutHeaderReactsToChanges() }); await CreateHandlerAndAddToWindow(shell, async (handler) => - { + { var initialHeaderPlatformView = initialHeader.ToPlatform(); Assert.NotNull(initialHeaderPlatformView); Assert.NotNull(initialHeader.Handler); @@ -496,7 +496,7 @@ public async Task ShellTabColorsDefaultToWhite() { SetupBuilder(); - var shell = await CreateShellAsync(shell => + var shell = await CreateShellAsync(shell => { shell.Items.Add(new Tab() { Items = { new ContentPage() }, Title = "Tab 1" }); }); diff --git a/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.Android.cs index 37ed82a30149..5fec54f54300 100644 --- a/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.Android.cs @@ -161,18 +161,18 @@ public async Task VerifySwipeViewOpacityProperty() Opacity = 0.35f }; var expectedValue = swipeView.Opacity; - + var handler = await CreateHandlerAsync(swipeView); var nativeView = GetPlatformControl(handler); await InvokeOnMainThreadAsync(() => { - var nativeOpacityValue = (float)nativeView.Alpha; - Assert.Equal(expectedValue, nativeOpacityValue); - }); + var nativeOpacityValue = (float)nativeView.Alpha; + Assert.Equal(expectedValue, nativeOpacityValue); + }); } [Fact] - [Description("The IsVisible property of a SwipeView should match with native IsVisible")] + [Description("The IsVisible property of a SwipeView should match with native IsVisible")] public async Task VerifySwipeViewIsVisibleProperty() { var swipeView = new SwipeView @@ -185,9 +185,9 @@ public async Task VerifySwipeViewIsVisibleProperty() var nativeView = GetPlatformControl(handler); await InvokeOnMainThreadAsync(() => { - var isVisible = nativeView.Visibility == Android.Views.ViewStates.Visible; - Assert.Equal(expectedValue, isVisible); - }); + var isVisible = nativeView.Visibility == Android.Views.ViewStates.Visible; + Assert.Equal(expectedValue, isVisible); + }); } } } \ No newline at end of file diff --git a/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.iOS.cs index 80b90b1cb47d..d5a226f0ff02 100644 --- a/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.iOS.cs @@ -1,11 +1,11 @@ using System; +using System.ComponentModel; using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using Xunit; -using System.ComponentModel; namespace Microsoft.Maui.DeviceTests { @@ -30,18 +30,18 @@ public async Task VerifySwipeViewOpacityProperty() Opacity = 0.35f }; var expectedValue = swipeView.Opacity; - + var handler = await CreateHandlerAsync(swipeView); var nativeView = GetPlatformControl(handler); await InvokeOnMainThreadAsync(() => { - var nativeOpacityValue = (float)nativeView.Alpha; - Assert.Equal(expectedValue, nativeOpacityValue); - }); + var nativeOpacityValue = (float)nativeView.Alpha; + Assert.Equal(expectedValue, nativeOpacityValue); + }); } [Fact] - [Description("The IsVisible property of a SwipeView should match with native IsVisible")] + [Description("The IsVisible property of a SwipeView should match with native IsVisible")] public async Task VerifySwipeViewIsVisibleProperty() { var swipeView = new SwipeView @@ -54,9 +54,9 @@ public async Task VerifySwipeViewIsVisibleProperty() var nativeView = GetPlatformControl(handler); await InvokeOnMainThreadAsync(() => { - var isVisible = !nativeView.Hidden; - Assert.Equal(expectedValue, isVisible); - }); + var isVisible = !nativeView.Hidden; + Assert.Equal(expectedValue, isVisible); + }); } } } diff --git a/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.cs b/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.cs index 006ee516c2da..00ee51519393 100644 --- a/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.cs @@ -296,7 +296,8 @@ public async Task MovingBetweenMultiplePagesWithNestedNavigationPages(bool botto { Title = title }; - }; + } + ; var tabbedPage = CreateBasicTabbedPage(bottomTabs, isSmoothScrollEnabled, pages); diff --git a/src/Controls/tests/DeviceTests/Elements/TemplatedView/TemplatedViewTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/TemplatedView/TemplatedViewTests.Android.cs index 3633ae606278..db0f5c8b75fa 100644 --- a/src/Controls/tests/DeviceTests/Elements/TemplatedView/TemplatedViewTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/TemplatedView/TemplatedViewTests.Android.cs @@ -8,80 +8,80 @@ namespace Microsoft.Maui.DeviceTests { - public partial class TemplatedViewTests - { - static int GetChildCount(ContentViewHandler contentViewHandler) => - contentViewHandler.PlatformView.ChildCount; + public partial class TemplatedViewTests + { + static int GetChildCount(ContentViewHandler contentViewHandler) => + contentViewHandler.PlatformView.ChildCount; - static Android.Views.View GetChild(ContentViewHandler contentViewHandler, int index = 0) => - contentViewHandler.PlatformView.GetChildAt(index); + static Android.Views.View GetChild(ContentViewHandler contentViewHandler, int index = 0) => + contentViewHandler.PlatformView.GetChildAt(index); - [Fact] - [Description("The ScaleX property of a TemplatedView should match with native ScaleX")] - public async Task ScaleXConsistent() - { - var templatedView = new TemplatedView() { ScaleX = 0.45f }; - var expected = templatedView.ScaleX; - var handler = await CreateHandlerAsync(templatedView); - var platformScaleX = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleX); - Assert.Equal(expected, platformScaleX); - } + [Fact] + [Description("The ScaleX property of a TemplatedView should match with native ScaleX")] + public async Task ScaleXConsistent() + { + var templatedView = new TemplatedView() { ScaleX = 0.45f }; + var expected = templatedView.ScaleX; + var handler = await CreateHandlerAsync(templatedView); + var platformScaleX = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleX); + Assert.Equal(expected, platformScaleX); + } - [Fact] - [Description("The ScaleY property of a TemplatedView should match with native ScaleY")] - public async Task ScaleYConsistent() - { - var templatedView = new TemplatedView() { ScaleY = 1.23f }; - var expected = templatedView.ScaleY; - var handler = await CreateHandlerAsync(templatedView); - var platformScaleY = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleY); - Assert.Equal(expected, platformScaleY); - } + [Fact] + [Description("The ScaleY property of a TemplatedView should match with native ScaleY")] + public async Task ScaleYConsistent() + { + var templatedView = new TemplatedView() { ScaleY = 1.23f }; + var expected = templatedView.ScaleY; + var handler = await CreateHandlerAsync(templatedView); + var platformScaleY = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleY); + Assert.Equal(expected, platformScaleY); + } - [Fact] - [Description("The Scale property of a TemplatedView should match with native Scale")] - public async Task ScaleConsistent() - { - var templatedView = new TemplatedView() { Scale = 2.0f }; - var expected = templatedView.Scale; - var handler = await CreateHandlerAsync(templatedView); - var platformScaleX = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleX); - var platformScaleY = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleY); - Assert.Equal(expected, platformScaleX); - Assert.Equal(expected, platformScaleY); - } + [Fact] + [Description("The Scale property of a TemplatedView should match with native Scale")] + public async Task ScaleConsistent() + { + var templatedView = new TemplatedView() { Scale = 2.0f }; + var expected = templatedView.Scale; + var handler = await CreateHandlerAsync(templatedView); + var platformScaleX = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleX); + var platformScaleY = await InvokeOnMainThreadAsync(() => handler.PlatformView.ScaleY); + Assert.Equal(expected, platformScaleX); + Assert.Equal(expected, platformScaleY); + } - [Fact] - [Description("The RotationX property of a TemplatedView should match with native RotationX")] - public async Task RotationXConsistent() - { - var templatedView = new TemplatedView() { RotationX = 33.0 }; - var expected = templatedView.RotationX; - var handler = await CreateHandlerAsync(templatedView); - var platformRotationX = await InvokeOnMainThreadAsync(() => handler.PlatformView.RotationX); - Assert.Equal(expected, platformRotationX); - } + [Fact] + [Description("The RotationX property of a TemplatedView should match with native RotationX")] + public async Task RotationXConsistent() + { + var templatedView = new TemplatedView() { RotationX = 33.0 }; + var expected = templatedView.RotationX; + var handler = await CreateHandlerAsync(templatedView); + var platformRotationX = await InvokeOnMainThreadAsync(() => handler.PlatformView.RotationX); + Assert.Equal(expected, platformRotationX); + } - [Fact] - [Description("The RotationY property of a TemplatedView should match with native RotationY")] - public async Task RotationYConsistent() - { - var templatedView = new TemplatedView() { RotationY = 87.0 }; - var expected = templatedView.RotationY; - var handler = await CreateHandlerAsync(templatedView); - var platformRotationY = await InvokeOnMainThreadAsync(() => handler.PlatformView.RotationY); - Assert.Equal(expected, platformRotationY); - } + [Fact] + [Description("The RotationY property of a TemplatedView should match with native RotationY")] + public async Task RotationYConsistent() + { + var templatedView = new TemplatedView() { RotationY = 87.0 }; + var expected = templatedView.RotationY; + var handler = await CreateHandlerAsync(templatedView); + var platformRotationY = await InvokeOnMainThreadAsync(() => handler.PlatformView.RotationY); + Assert.Equal(expected, platformRotationY); + } - [Fact] - [Description("The Rotation property of a TemplatedView should match with native Rotation")] - public async Task RotationConsistent() - { - var templatedView = new TemplatedView() { Rotation = 23.0 }; - var expected = templatedView.Rotation; - var handler = await CreateHandlerAsync(templatedView); - var platformRotation = await InvokeOnMainThreadAsync(() => handler.PlatformView.Rotation); - Assert.Equal(expected, platformRotation); - } - } + [Fact] + [Description("The Rotation property of a TemplatedView should match with native Rotation")] + public async Task RotationConsistent() + { + var templatedView = new TemplatedView() { Rotation = 23.0 }; + var expected = templatedView.Rotation; + var handler = await CreateHandlerAsync(templatedView); + var platformRotation = await InvokeOnMainThreadAsync(() => handler.PlatformView.Rotation); + Assert.Equal(expected, platformRotation); + } + } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue15649.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue15649.xaml.cs index a197720dafdc..62992fbc9a66 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue15649.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue15649.xaml.cs @@ -5,19 +5,19 @@ public partial class Issue15649 : ContentPage { public int _positionSelected = 1; - public int PositionSelected + public int PositionSelected + { + set { - set + if (_positionSelected != value) { - if (_positionSelected != value) - { - _positionSelected = value; + _positionSelected = value; - OnPropertyChanged(); - } + OnPropertyChanged(); } - get => _positionSelected; } + get => _positionSelected; + } public Issue15649() { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue19007.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue19007.cs index 2797410831b6..733b4a3ed7a1 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue19007.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue19007.cs @@ -1,27 +1,27 @@ namespace Maui.Controls.Sample.Issues { - [Issue(IssueTracker.Github, 19007, "Incomplete Label Display on macOS and IOS When Padding is Applied", PlatformAffected.iOS)] - public class Issue19007 : ContentPage - { - public Issue19007() - { - var grid = new Grid(); - grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); - grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(100) }); + [Issue(IssueTracker.Github, 19007, "Incomplete Label Display on macOS and IOS When Padding is Applied", PlatformAffected.iOS)] + public class Issue19007 : ContentPage + { + public Issue19007() + { + var grid = new Grid(); + grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); + grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(100) }); - var label = new Label - { - Background = Colors.Red, - Text = ".NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating mobile and desktop apps with C# and XAML.", - Padding = new Thickness(20), - AutomationId = "Label" - }; + var label = new Label + { + Background = Colors.Red, + Text = ".NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating mobile and desktop apps with C# and XAML.", + Padding = new Thickness(20), + AutomationId = "Label" + }; - grid.Children.Add(label); - Grid.SetRow(label, 0); - Grid.SetColumn(label, 0); + grid.Children.Add(label); + Grid.SetRow(label, 0); + Grid.SetColumn(label, 0); - Content = grid; - } - } + Content = grid; + } + } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue19109.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue19109.cs index cf8977a1eb9e..4d7fa8217e8a 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue19109.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue19109.cs @@ -2,61 +2,61 @@ { [XamlCompilation(XamlCompilationOptions.Compile)] [Issue(IssueTracker.Github, 19109, "CursorPosition Property Not Applied Correctly to Entry Control on iOS Platform", PlatformAffected.iOS)] - public partial class Issue19109: ContentPage + public partial class Issue19109 : ContentPage { Entry entry; public Issue19109() { entry = new Entry - { - Text = "Entry 123", - CursorPosition = 5, - Placeholder = "Focus this entry to check if the cursor position is set correctly.", - ReturnType = ReturnType.Next, + { + Text = "Entry 123", + CursorPosition = 5, + Placeholder = "Focus this entry to check if the cursor position is set correctly.", + ReturnType = ReturnType.Next, AutomationId = "EntryControl" - }; + }; - var button = new Button - { - Text = "Focus Entry", + var button = new Button + { + Text = "Focus Entry", AutomationId = "FocusButton" - }; + }; - var label = new Label - { - Text = "Cursor Position: 5", - FontSize = 16, - TextColor = Colors.Black, - HorizontalOptions = LayoutOptions.Center - }; + var label = new Label + { + Text = "Cursor Position: 5", + FontSize = 16, + TextColor = Colors.Black, + HorizontalOptions = LayoutOptions.Center + }; - var rangeLabel = new Label - { - AutomationId = "RangeLabel", - Text = "Range not set yet", - HorizontalOptions = LayoutOptions.Center - }; + var rangeLabel = new Label + { + AutomationId = "RangeLabel", + Text = "Range not set yet", + HorizontalOptions = LayoutOptions.Center + }; - button.Clicked += (sender, e) => - { - entry.Focus(); + button.Clicked += (sender, e) => + { + entry.Focus(); - #if IOS - if (entry.Handler?.PlatformView is UIKit.UITextField textField && textField.SelectedTextRange != null) - { - rangeLabel.Text = $"Start={textField.GetOffsetFromPosition(textField.BeginningOfDocument, textField.SelectedTextRange.Start)}, " + - $"End={textField.GetOffsetFromPosition(textField.BeginningOfDocument, textField.SelectedTextRange.End)}"; - } - #endif - }; +#if IOS + if (entry.Handler?.PlatformView is UIKit.UITextField textField && textField.SelectedTextRange != null) + { + rangeLabel.Text = $"Start={textField.GetOffsetFromPosition(textField.BeginningOfDocument, textField.SelectedTextRange.Start)}, " + + $"End={textField.GetOffsetFromPosition(textField.BeginningOfDocument, textField.SelectedTextRange.End)}"; + } +#endif + }; + + Content = new StackLayout + { + Children = { entry, button, label, rangeLabel }, + Padding = new Thickness(20), + Spacing = 10 + }; - Content = new StackLayout - { - Children = { entry, button, label, rangeLabel }, - Padding = new Thickness(20), - Spacing = 10 - }; - } } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue24996.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue24996.xaml.cs index d207bfdceb15..6471f6ef06bb 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue24996.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue24996.xaml.cs @@ -17,8 +17,10 @@ public Issue24996() InitializeComponent(); UpdateText(); - SizeChanged += delegate { - if (Width > 0) { + SizeChanged += delegate + { + if (Width > 0) + { // For some reason, constraining this layout to a fixed size causes a `SetNeedsLayout` to be called // when translating the Lvl2 view outside the bottom boundary. // This causes a layout pass to be called on the Root, Lvl1, Lvl2, and Lvl3. diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2775.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2775.cs index 45392b57995e..47af5801fda2 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue2775.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2775.cs @@ -50,7 +50,7 @@ protected override void Init() }; Content = new StackLayout - { + { Children = { list, listTransparent, diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue27992.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue27992.xaml.cs index d71e09117e20..9bbe1c785b39 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue27992.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue27992.xaml.cs @@ -7,7 +7,7 @@ public Issue27992() { InitializeComponent(); } - int i =0; + int i = 0; private void Entry_Completed(object sender, EventArgs e) { i++; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28098.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28098.xaml.cs index 0df7125d43ae..32bc05788c5e 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28098.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28098.xaml.cs @@ -8,9 +8,9 @@ public partial class Issue28098 : ContentPage public Issue28098() { InitializeComponent(); - #if ANDROID +#if ANDROID carouselView.HorizontalScrollBarVisibility = ScrollBarVisibility.Never; - #endif +#endif } protected override void OnAppearing() diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28330.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28330.cs index 021038902f33..2fca4b62fd3e 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28330.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28330.cs @@ -2,51 +2,51 @@ namespace Maui.Controls.Sample.Issues; [Issue(IssueTracker.Github, 28330, "Stepper allows to increment when value equals to maximum", PlatformAffected.All)] public class Issue28330 : TestContentPage { - protected override void Init() - { - var layout = new StackLayout { }; + protected override void Init() + { + var layout = new StackLayout { }; - Stepper Incrementstepper = new Stepper - { - AutomationId = "Incrementstepper", - HorizontalOptions = LayoutOptions.Center, - Increment = 1, - Minimum = 1, - Maximum = 1, - Value = 1 - }; + Stepper Incrementstepper = new Stepper + { + AutomationId = "Incrementstepper", + HorizontalOptions = LayoutOptions.Center, + Increment = 1, + Minimum = 1, + Maximum = 1, + Value = 1 + }; - Label Incrementlabel = new Label - { - AutomationId = "Incrementlabel", - HorizontalOptions = LayoutOptions.Center, - FontSize = 32 - }; - Incrementlabel.SetBinding(Label.TextProperty, new Binding("Value", source: Incrementstepper)); + Label Incrementlabel = new Label + { + AutomationId = "Incrementlabel", + HorizontalOptions = LayoutOptions.Center, + FontSize = 32 + }; + Incrementlabel.SetBinding(Label.TextProperty, new Binding("Value", source: Incrementstepper)); - Stepper Decrementstepper = new Stepper - { - AutomationId = "Decrementstepper", - HorizontalOptions = LayoutOptions.Center, - Increment = 1, - Maximum = 1, - Minimum = 1, - Value = 1 - }; + Stepper Decrementstepper = new Stepper + { + AutomationId = "Decrementstepper", + HorizontalOptions = LayoutOptions.Center, + Increment = 1, + Maximum = 1, + Minimum = 1, + Value = 1 + }; - Label Decrementlabel = new Label - { - AutomationId = "Decrementlabel", - HorizontalOptions = LayoutOptions.Center, - FontSize = 32 - }; - Decrementlabel.SetBinding(Label.TextProperty, new Binding("Value", source: Decrementstepper)); + Label Decrementlabel = new Label + { + AutomationId = "Decrementlabel", + HorizontalOptions = LayoutOptions.Center, + FontSize = 32 + }; + Decrementlabel.SetBinding(Label.TextProperty, new Binding("Value", source: Decrementstepper)); - layout.Children.Add(Incrementstepper); - layout.Children.Add(Incrementlabel); - layout.Children.Add(Decrementstepper); - layout.Children.Add(Decrementlabel); + layout.Children.Add(Incrementstepper); + layout.Children.Add(Incrementlabel); + layout.Children.Add(Decrementstepper); + layout.Children.Add(Decrementlabel); - Content = layout; - } + Content = layout; + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28343.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28343.cs index 19d21ada1f4a..2e8950507a6a 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28343.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28343.cs @@ -11,33 +11,33 @@ public Issue28343() var refreshView = new RefreshView { IsEnabled = false, - Content = CreateContent(), + Content = CreateContent(), }; Grid grid = new Grid { - { - new Label - { + { + new Label + { Text = "Refresh Not Triggered", AutomationId = "RefreshNotTriggered" }, 0, 0 }, - { - new Button - { - Text = "Set To Enabled", - AutomationId = "SetToEnabled", - Command = new Command(() => + { + new Button + { + Text = "Set To Enabled", + AutomationId = "SetToEnabled", + Command = new Command(() => { refreshView.IsEnabled = true; }) }, 0, 1 }, - { - new Button - { - Text = "Reset Content", - AutomationId = "ResetContent", - Command = new Command(() => + { + new Button + { + Text = "Reset Content", + AutomationId = "ResetContent", + Command = new Command(() => { refreshView.Content = CreateContent(); }) @@ -64,10 +64,10 @@ View CreateContent() return new CollectionView { AutomationId = "CollectionView", - ItemsSource = Enumerable.Range(0, 100).Select(x=> $"ListItem{x}"), + ItemsSource = Enumerable.Range(0, 100).Select(x => $"ListItem{x}"), ItemTemplate = new DataTemplate(() => { - var label = new Label + var label = new Label { HeightRequest = 100, BackgroundColor = Colors.Green, @@ -76,7 +76,7 @@ View CreateContent() label.SetBinding(Label.TextProperty, "."); label.SetBinding(Label.AutomationIdProperty, "."); - + return label; }) }; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28419.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28419.cs index c91dcf03961e..1364460b6937 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28419.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28419.cs @@ -3,26 +3,26 @@ [Issue(IssueTracker.Github, 28419, "SearchBar focus/unfocus do not fire on Windows", PlatformAffected.UWP)] public class Issue28419 : ContentPage { - public Issue28419() - { - var label = new Label(); - var searchBar = new SearchBar { Placeholder = "SearchBar", AutomationId = "SearchBar" }; - var entry = new Entry { Placeholder = "Entry", AutomationId = "Entry" }; + public Issue28419() + { + var label = new Label(); + var searchBar = new SearchBar { Placeholder = "SearchBar", AutomationId = "SearchBar" }; + var entry = new Entry { Placeholder = "Entry", AutomationId = "Entry" }; - searchBar.Focused += (sender, e) => - { - label.Text = "SearchBar Focused"; - }; + searchBar.Focused += (sender, e) => + { + label.Text = "SearchBar Focused"; + }; - searchBar.Unfocused += (sender, e) => - { - label.Text = "SearchBar Unfocused"; - }; + searchBar.Unfocused += (sender, e) => + { + label.Text = "SearchBar Unfocused"; + }; - Content = new VerticalStackLayout - { - Spacing = 10, - Children = { label, searchBar, entry } - }; - } + Content = new VerticalStackLayout + { + Spacing = 10, + Children = { label, searchBar, entry } + }; + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/ScrollViewObjectDisposed.cs b/src/Controls/tests/TestCases.HostApp/Issues/ScrollViewObjectDisposed.cs index c973847b56f2..d3cc89eb9287 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/ScrollViewObjectDisposed.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/ScrollViewObjectDisposed.cs @@ -17,7 +17,7 @@ public ScrollViewObjectDisposed() void InitTest() { - _status = new Label() { Text = "Test is running...", BackgroundColor = Colors.Red, TextColor = Colors.White }; + _status = new Label() { Text = "Test is running...", BackgroundColor = Colors.Red, TextColor = Colors.White }; _scroll = new ScrollView { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue9686.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue9686.cs index 0df650f1c5cc..d0773a0b3943 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue9686.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue9686.cs @@ -85,7 +85,8 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName protected bool SetField(ref T field, T value, [CallerMemberName] string propertyName = null) { - if (EqualityComparer.Default.Equals(field, value)) return false; + if (EqualityComparer.Default.Equals(field, value)) + return false; field = value; OnPropertyChanged(propertyName); return true; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/ShellFlyoutHeaderBehavior.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/ShellFlyoutHeaderBehavior.cs index e8c319d579e9..373026514882 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/ShellFlyoutHeaderBehavior.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/ShellFlyoutHeaderBehavior.cs @@ -63,6 +63,7 @@ ContentPage CreateContentPage() page.Content = layout; return page; - }; + } + ; } } diff --git a/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs b/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs index 3bb5faf37444..b78f51463041 100644 --- a/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs +++ b/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs @@ -86,13 +86,13 @@ async void OnPageLoaded(object sender, EventArgs e) await navigationPage.PushAsync(page); if (element is Image image) - { - await image.WaitUntilLoaded(); - } - else - { - await Task.Delay(500); // give the View time to load - } + { + await image.WaitUntilLoaded(); + } + else + { + await Task.Delay(500); // give the View time to load + } references.Add(new(element)); references.Add(new(element.Handler)); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.HeaderAndFooter.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.HeaderAndFooter.cs index 28cfdbc5e527..0dcd85ad33a7 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.HeaderAndFooter.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.HeaderAndFooter.cs @@ -30,73 +30,73 @@ public void HeaderFooterStringWorks() } #if IOS || ANDROID [Test] - [Category(UITestCategories.CollectionView)] - public void HeaderFooterViewWorks() - { - // Navigate to the selection galleries - VisitInitialGallery("Header Footer"); + [Category(UITestCategories.CollectionView)] + public void HeaderFooterViewWorks() + { + // Navigate to the selection galleries + VisitInitialGallery("Header Footer"); - // Navigate to the specific sample inside selection galleries - VisitSubGallery("Header/Footer (Forms View)"); + // Navigate to the specific sample inside selection galleries + VisitSubGallery("Header/Footer (Forms View)"); - App.WaitForElement("This Is A Header"); - App.WaitForElement("This Is A Footer"); - } + App.WaitForElement("This Is A Header"); + App.WaitForElement("This Is A Footer"); + } - [Test] - [Category(UITestCategories.CollectionView)] - public void HeaderFooterTemplateWorks() - { - // Navigate to the selection galleries - VisitInitialGallery("Header Footer"); + [Test] + [Category(UITestCategories.CollectionView)] + public void HeaderFooterTemplateWorks() + { + // Navigate to the selection galleries + VisitInitialGallery("Header Footer"); - // Navigate to the specific sample inside selection galleries - VisitSubGallery("Header/Footer (Template)"); + // Navigate to the specific sample inside selection galleries + VisitSubGallery("Header/Footer (Template)"); - VerifyScreenshot(); - } + VerifyScreenshot(); + } - [Test] - [Category(UITestCategories.CollectionView)] - public void HeaderFooterGridWorks() - { - // Navigate to the selection galleries - VisitInitialGallery("Header Footer"); + [Test] + [Category(UITestCategories.CollectionView)] + public void HeaderFooterGridWorks() + { + // Navigate to the selection galleries + VisitInitialGallery("Header Footer"); - // Navigate to the specific sample inside selection galleries - VisitSubGallery("Header/Footer (Grid)"); + // Navigate to the specific sample inside selection galleries + VisitSubGallery("Header/Footer (Grid)"); - App.WaitForElement("This Is A Header"); + App.WaitForElement("This Is A Header"); #if !ANDROID // Android screen is too small to show this label // but we can check for the footer via screenshot App.WaitForElement("This Is A Footer"); #endif - VerifyScreenshot(); - } + VerifyScreenshot(); + } #if TEST_FAILS_ON_IOS - // The screenshot that's currently generated for this test is wrong - // So, we're ignoring this test due to it causing confusion when other changes - // cause this test to fail. - [Test] - [Category(UITestCategories.CollectionView)] - public void HeaderFooterGridHorizontalWorks() - { - // Navigate to the selection galleries - VisitInitialGallery("Header Footer"); - - // Navigate to the specific sample inside selection galleries - VisitSubGallery("Header/Footer (Grid Horizontal)"); - - App.WaitForElement("This Is A Header"); - - // This is a bug in the test, the footer is not being found - //App.WaitForElement("This Is A Footer"); - - VerifyScreenshot(); - } + // The screenshot that's currently generated for this test is wrong + // So, we're ignoring this test due to it causing confusion when other changes + // cause this test to fail. + [Test] + [Category(UITestCategories.CollectionView)] + public void HeaderFooterGridHorizontalWorks() + { + // Navigate to the selection galleries + VisitInitialGallery("Header Footer"); + + // Navigate to the specific sample inside selection galleries + VisitSubGallery("Header/Footer (Grid Horizontal)"); + + App.WaitForElement("This Is A Header"); + + // This is a bug in the test, the footer is not being found + //App.WaitForElement("This Is A Footer"); + + VerifyScreenshot(); + } #endif #endif } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15649.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15649.cs index d9af439f8581..61cb21069e79 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15649.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15649.cs @@ -6,14 +6,14 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue15649(TestDevice testDevice) : _IssuesUITest(testDevice) { - public override string Issue => "Updating a ControlTemplate at runtime for a Content Page is not working."; + public override string Issue => "Updating a ControlTemplate at runtime for a Content Page is not working."; - [Test] - [Category(UITestCategories.Page)] - public void DynamicallyUpdatingContentPage() - { - App.WaitForElement("Page1Label"); - App.Tap("Button"); - App.WaitForElement("Page2Label"); - } + [Test] + [Category(UITestCategories.Page)] + public void DynamicallyUpdatingContentPage() + { + App.WaitForElement("Page1Label"); + App.Tap("Button"); + App.WaitForElement("Page2Label"); + } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18751.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18751.cs index a7729cada50d..7a565c955a5c 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18751.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18751.cs @@ -18,7 +18,7 @@ public Issue18751(TestDevice device) : base(device) public async Task Issue18751Test() { VerifyInternetConnectivity(); - + App.WaitForElement("WaitForStubControl"); // Load images. diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19007.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19007.cs index b53d8f490a4a..698001988972 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19007.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19007.cs @@ -5,17 +5,17 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue19007 : _IssuesUITest { - public Issue19007(TestDevice testDevice) : base(testDevice) - { - } + public Issue19007(TestDevice testDevice) : base(testDevice) + { + } - public override string Issue => "Incomplete Label Display on macOS and IOS When Padding is Applied"; + public override string Issue => "Incomplete Label Display on macOS and IOS When Padding is Applied"; - [Test] - [Category(UITestCategories.Label)] - public void LabelWithPadding() - { - App.WaitForElement("Label"); - VerifyScreenshot(); - } + [Test] + [Category(UITestCategories.Label)] + public void LabelWithPadding() + { + App.WaitForElement("Label"); + VerifyScreenshot(); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25201.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25201.cs index fc4b98460980..082c4b1f1033 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25201.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25201.cs @@ -7,10 +7,10 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { public class Issue25201 : _IssuesUITest { - public Issue25201(TestDevice testDevice) : base(testDevice){} + public Issue25201(TestDevice testDevice) : base(testDevice) { } public override string Issue => "[Android] ImageButton Padding Incorrect After IsVisible False"; - + [Test] [Category(UITestCategories.ImageButton)] public void ImageButtonPaddingDoesNotChangeWhenIsVisibleChanges() @@ -19,7 +19,7 @@ public void ImageButtonPaddingDoesNotChangeWhenIsVisibleChanges() // https://github.com/dotnet/maui/issues/25201 App.Tap("Switch1"); // ImageButton IsVisible changes to true - // https://github.com/dotnet/maui/issues/16713 + // https://github.com/dotnet/maui/issues/16713 App.Tap("Switch2"); // Hides overlay ContentView VerifyScreenshot(); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25889.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25889.cs index fe9e71cac742..c02035cceebd 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25889.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25889.cs @@ -19,7 +19,7 @@ public void RemainingItemsThresholdReachedCommandFired() App.WaitForElement("collectionView"); App.ScrollDown("collectionView", ScrollStrategy.Gesture, 0.99); // In CI, the CommandFired text does not update when using the ScrollDown action. To reliably trigger the command, first scroll up and then scroll down again. - App.ScrollUp("collectionView", ScrollStrategy.Gesture, swipePercentage:0.99); + App.ScrollUp("collectionView", ScrollStrategy.Gesture, swipePercentage: 0.99); App.WaitForElement("collectionView"); App.ScrollDown("collectionView", ScrollStrategy.Gesture, 0.99); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27766.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27766.cs index abf5e4016abb..54b5beb50563 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27766.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27766.cs @@ -6,25 +6,25 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue27766 : _IssuesUITest { - public override string Issue => "The bottom content inset value does not need to be updated for CollectionView items when the editor is an inner element"; + public override string Issue => "The bottom content inset value does not need to be updated for CollectionView items when the editor is an inner element"; - public Issue27766(TestDevice device) : base(device) - { - } + public Issue27766(TestDevice device) : base(device) + { + } - [Test] - [Category(UITestCategories.CollectionView)] - public void ShouldIgnoreBottomContentInsetForCollectionViewItems() - { - App.WaitForElement("Test 3"); - App.Tap("Test 3"); - Thread.Sleep(500); // Add some wait for poping up the keyboard to resolve flakiness in CI. + [Test] + [Category(UITestCategories.CollectionView)] + public void ShouldIgnoreBottomContentInsetForCollectionViewItems() + { + App.WaitForElement("Test 3"); + App.Tap("Test 3"); + Thread.Sleep(500); // Add some wait for poping up the keyboard to resolve flakiness in CI. - // CI tests sometimes fail due to a keyboard layout mismatch; in this case, the editor content is visible without the keyboard, so no keyboard is needed. + // CI tests sometimes fail due to a keyboard layout mismatch; in this case, the editor content is visible without the keyboard, so no keyboard is needed. #if ANDROID || IOS - VerifyScreenshot(cropBottom: 1200); + VerifyScreenshot(cropBottom: 1200); #else VerifyScreenshot(); #endif - } + } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27992.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27992.cs index ad8e63ff5b44..3e4b65fd55b1 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27992.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27992.cs @@ -14,17 +14,17 @@ public Issue27992(TestDevice device) : base(device) public override string Issue => "Entry Completed Event Triggered Twice"; - [Test] + [Test] [Category(UITestCategories.Entry)] public void EntryCompletedShouldOnlyFireOnce() { App.WaitForElement("MauiEntry"); - App.Tap("MauiEntry"); + App.Tap("MauiEntry"); - App.PressEnter(); + App.PressEnter(); - var text = App.WaitForElement("MauiLabel").GetText(); - Assert.That(text,Is.EqualTo("Completed Invoked 1 times")); + var text = App.WaitForElement("MauiLabel").GetText(); + Assert.That(text, Is.EqualTo("Completed Invoked 1 times")); } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28098.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28098.cs index fe91fbc237a1..3ae52cef6923 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28098.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28098.cs @@ -5,19 +5,19 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue28098 : _IssuesUITest { - public override string Issue => "Returning back from navigation to MainPage would result in a blank screen"; - public Issue28098(TestDevice device) : base(device) - { - } + public override string Issue => "Returning back from navigation to MainPage would result in a blank screen"; + public Issue28098(TestDevice device) : base(device) + { + } - [Test] - [Category(UITestCategories.Picker)] - public void BlankScreenOnNavigationBack() - { - App.WaitForElement("Button"); - App.Tap("Button"); - App.WaitForElement("BackButton"); - App.Tap("BackButton"); - VerifyScreenshot(); - } + [Test] + [Category(UITestCategories.Picker)] + public void BlankScreenOnNavigationBack() + { + App.WaitForElement("Button"); + App.Tap("Button"); + App.WaitForElement("BackButton"); + App.Tap("BackButton"); + VerifyScreenshot(); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28330.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28330.cs index 52fe15e871bc..bbb31936b7f7 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28330.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28330.cs @@ -5,20 +5,20 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue28330 : _IssuesUITest { - public Issue28330(TestDevice device) : base(device) - { - } + public Issue28330(TestDevice device) : base(device) + { + } - public override string Issue => "Stepper allows to increment when value equals to maximum"; + public override string Issue => "Stepper allows to increment when value equals to maximum"; - [Test] - [Category(UITestCategories.Stepper)] - public void Issue28330StepperIncrementShouldBeDisabled() - { - App.WaitForElement("Incrementlabel"); - App.IncreaseStepper("Incrementstepper"); - Assert.That(App.FindElement("Incrementlabel").GetText(), Is.EqualTo("1")); - App.DecreaseStepper("Decrementstepper"); - Assert.That(App.FindElement("Decrementlabel").GetText(), Is.EqualTo("1")); - } + [Test] + [Category(UITestCategories.Stepper)] + public void Issue28330StepperIncrementShouldBeDisabled() + { + App.WaitForElement("Incrementlabel"); + App.IncreaseStepper("Incrementstepper"); + Assert.That(App.FindElement("Incrementlabel").GetText(), Is.EqualTo("1")); + App.DecreaseStepper("Decrementstepper"); + Assert.That(App.FindElement("Decrementlabel").GetText(), Is.EqualTo("1")); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28343.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28343.cs index 322196b754ce..964db78be90a 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28343.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28343.cs @@ -27,7 +27,7 @@ public void ProgressSpinnerNotDisabledOnStartup() } - #if TEST_FAILS_ON_ANDROID // https://github.com/dotnet/maui/issues/28361 +#if TEST_FAILS_ON_ANDROID // https://github.com/dotnet/maui/issues/28361 [Test] public void ProgressSpinnerRemainsDisabledAfterSwappingContent() { @@ -39,7 +39,7 @@ public void ProgressSpinnerRemainsDisabledAfterSwappingContent() App.WaitForElement("RefreshNotTriggered"); VerifyScreenshot("Issue28343_ProgressSpinnerDisabled"); } - #endif +#endif [Test] public void ProgressSpinnerWorksWhenReEnabled() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28419.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28419.cs index fa9f3347b429..d4c5a4e2f275 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28419.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28419.cs @@ -5,18 +5,18 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue28419 : _IssuesUITest { - public Issue28419(TestDevice device) : base(device) { } + public Issue28419(TestDevice device) : base(device) { } - public override string Issue => "SearchBar focus/unfocus do not fire on Windows"; + public override string Issue => "SearchBar focus/unfocus do not fire on Windows"; - [Test] - [Category(UITestCategories.SearchBar)] - public void SearchBarShouldTriggerFocusedAndUnFocusedEvents() - { - App.WaitForElement("SearchBar"); - App.Tap("SearchBar"); - App.WaitForElement("SearchBar Focused"); - App.Tap("Entry"); - App.WaitForElement("SearchBar Unfocused"); - } + [Test] + [Category(UITestCategories.SearchBar)] + public void SearchBarShouldTriggerFocusedAndUnFocusedEvents() + { + App.WaitForElement("SearchBar"); + App.Tap("SearchBar"); + App.WaitForElement("SearchBar Focused"); + App.Tap("Entry"); + App.WaitForElement("SearchBar Unfocused"); + } } \ No newline at end of file diff --git a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs index 71ff326a12da..23bea48b6a68 100644 --- a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs +++ b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs @@ -178,7 +178,8 @@ void onData(object s, DataReceivedEventArgs e) builder.AppendLine(e.Data); Console.WriteLine(e.Data); } - }; + } + ; var ext = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ""; var dotnet = IOPath.Combine(testDirectory, "..", "..", "..", "..", "..", "..", "..", "bin", "dotnet", $"dotnet{ext}"); diff --git a/src/Core/src/Handlers/Editor/EditorHandler.Tizen.cs b/src/Core/src/Handlers/Editor/EditorHandler.Tizen.cs index 9745844826ef..1584d3db863e 100644 --- a/src/Core/src/Handlers/Editor/EditorHandler.Tizen.cs +++ b/src/Core/src/Handlers/Editor/EditorHandler.Tizen.cs @@ -31,7 +31,8 @@ TSize IMeasurable.Measure(double availableWidth, double availableHeight) else { return new TSize(Math.Max(PixelSize + 10, availableWidth), PixelSize + 10); - }; + } + ; } } diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs b/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs index 4643822f87dc..8d69a7d521a7 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs @@ -34,7 +34,8 @@ TSize IMeasurable.Measure(double availableWidth, double availableHeight) else { return new TSize(Math.Max(PixelSize + 10, availableWidth), PixelSize + 10); - }; + } + ; } } diff --git a/src/Core/src/Handlers/Entry/EntryHandler.iOS.cs b/src/Core/src/Handlers/Entry/EntryHandler.iOS.cs index c2919c789d34..20c31183773a 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.iOS.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.iOS.cs @@ -165,10 +165,12 @@ void OnEditingBegan(object? sender, EventArgs e) { if (sender is MauiTextField platformView && VirtualView is IEntry virtualView) { - if (virtualView.SelectionLength > 0) { + if (virtualView.SelectionLength > 0) + { platformView.UpdateSelectionLength(virtualView); } - else { + else + { platformView.UpdateCursorPosition(virtualView); } virtualView.IsFocused = true; diff --git a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.iOS.cs b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.iOS.cs index 90625381adb7..137f2950e66a 100644 --- a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.iOS.cs +++ b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.iOS.cs @@ -155,22 +155,22 @@ public async void StartUrlSchemeTask(WKWebView webView, IWKUrlSchemeTask urlSche var (bytes, contentType, statusCode) = await GetResponseBytesAsync(url); - using (var dic = new NSMutableDictionary()) - { - dic.Add((NSString)"Content-Length", (NSString)bytes.Length.ToString(CultureInfo.InvariantCulture)); - dic.Add((NSString)"Content-Type", (NSString)contentType); - // Disable local caching. This will prevent user scripts from executing correctly. - dic.Add((NSString)"Cache-Control", (NSString)"no-cache, max-age=0, must-revalidate, no-store"); + using (var dic = new NSMutableDictionary()) + { + dic.Add((NSString)"Content-Length", (NSString)bytes.Length.ToString(CultureInfo.InvariantCulture)); + dic.Add((NSString)"Content-Type", (NSString)contentType); + // Disable local caching. This will prevent user scripts from executing correctly. + dic.Add((NSString)"Cache-Control", (NSString)"no-cache, max-age=0, must-revalidate, no-store"); - if (urlSchemeTask.Request.Url != null) - { - using var response = new NSHttpUrlResponse(urlSchemeTask.Request.Url, statusCode, "HTTP/1.1", dic); - urlSchemeTask.DidReceiveResponse(response); - } + if (urlSchemeTask.Request.Url != null) + { + using var response = new NSHttpUrlResponse(urlSchemeTask.Request.Url, statusCode, "HTTP/1.1", dic); + urlSchemeTask.DidReceiveResponse(response); } + } - urlSchemeTask.DidReceiveData(NSData.FromArray(bytes)); - urlSchemeTask.DidFinish(); + urlSchemeTask.DidReceiveData(NSData.FromArray(bytes)); + urlSchemeTask.DidFinish(); } private async Task<(byte[] ResponseBytes, string ContentType, int StatusCode)> GetResponseBytesAsync(string? url) diff --git a/src/Core/src/Handlers/ImageButton/ImageButtonHandler.iOS.cs b/src/Core/src/Handlers/ImageButton/ImageButtonHandler.iOS.cs index 9be216cbfc09..2c251dfc22e8 100644 --- a/src/Core/src/Handlers/ImageButton/ImageButtonHandler.iOS.cs +++ b/src/Core/src/Handlers/ImageButton/ImageButtonHandler.iOS.cs @@ -19,7 +19,7 @@ protected override void SetupContainer() wrapperView.CrossPlatformLayout = VirtualView as ICrossPlatformLayout; } } - + protected override UIButton CreatePlatformView() { var platformView = new UIButton(UIButtonType.System) diff --git a/src/Core/src/Platform/Android/MauiHybridWebViewClient.cs b/src/Core/src/Platform/Android/MauiHybridWebViewClient.cs index 7aade3db85ce..fc1515db8e26 100644 --- a/src/Core/src/Platform/Android/MauiHybridWebViewClient.cs +++ b/src/Core/src/Platform/Android/MauiHybridWebViewClient.cs @@ -32,14 +32,28 @@ public MauiHybridWebViewClient(HybridWebViewHandler handler) public override WebResourceResponse? ShouldInterceptRequest(AWebView? view, IWebResourceRequest? request) { - var response = GetResponseStream(view, request); + try + { + var response = GetResponseStream(view, request); + + if (response is not null) + { + return response; + } - if (response is not null) + return base.ShouldInterceptRequest(view, request); + } + catch (Exception ex) { - return response; + if (Handler is null || Handler is IViewHandler ivh && ivh.VirtualView is null) + { + return null; + } + + Handler.MauiContext?.CreateLogger()?.LogError(ex, "Error invoking ShouldInterceptRequest: {ErrorMessage}", ex.Message); + throw; } - return base.ShouldInterceptRequest(view, request); } private WebResourceResponse? GetResponseStream(AWebView? view, IWebResourceRequest? request) @@ -189,18 +203,20 @@ public DotNetInvokeAsyncStream(Task invokeTask, HybridWebViewHandler ha resumeWriterThreshold: ResumeThreshold, useSynchronizationContext: false)); - InvokeMethodAndWriteBytes(); + Task.Run(InvokeMethodAndWriteBytes); } - private async void InvokeMethodAndWriteBytes() + private async Task InvokeMethodAndWriteBytes() { try { var data = await _task; // the stream or handler may be disposed after the method completes - ObjectDisposedException.ThrowIf(_isDisposed, nameof(DotNetInvokeAsyncStream)); - ArgumentNullException.ThrowIfNull(Handler, nameof(Handler)); + if (_isDisposed || Handler is null) + { + return; + } // copy the data into the pipe if (data is not null && data.Length > 0) @@ -210,13 +226,13 @@ private async void InvokeMethodAndWriteBytes() _pipe.Writer.Advance(data.Length); } - _pipe.Writer.Complete(); + await _pipe.Writer.CompleteAsync().ConfigureAwait(false); } catch (Exception ex) { Handler?.MauiContext?.CreateLogger()?.LogError(ex, "Error invoking .NET method from JavaScript: {ErrorMessage}", ex.Message); - _pipe.Writer.Complete(ex); + await _pipe.Writer.CompleteAsync().ConfigureAwait(false); } } diff --git a/src/Core/src/Platform/Android/MauiSwipeView.cs b/src/Core/src/Platform/Android/MauiSwipeView.cs index e164453bb413..0c28a0373930 100644 --- a/src/Core/src/Platform/Android/MauiSwipeView.cs +++ b/src/Core/src/Platform/Android/MauiSwipeView.cs @@ -78,12 +78,12 @@ protected override void OnAttachedToWindow() protected override void OnLayout(bool changed, int left, int top, int right, int bottom) { - base.OnLayout(changed, left, top, right, bottom); + base.OnLayout(changed, left, top, right, bottom); - if (_contentView is null || _actionView is null || GetNativeSwipeItems() is not {Count: > 0} swipeItems) - return; + if (_contentView is null || _actionView is null || GetNativeSwipeItems() is not { Count: > 0 } swipeItems) + return; - LayoutSwipeItems(swipeItems); + LayoutSwipeItems(swipeItems); } public override bool OnTouchEvent(MotionEvent? e) diff --git a/src/Core/src/Platform/Android/MauiTextView.cs b/src/Core/src/Platform/Android/MauiTextView.cs index 1f96c7926c1a..e29d4d3e2e1a 100644 --- a/src/Core/src/Platform/Android/MauiTextView.cs +++ b/src/Core/src/Platform/Android/MauiTextView.cs @@ -1,8 +1,8 @@ using System; using Android.Content; -using AndroidX.AppCompat.Widget; using Android.Text; using Android.Views; +using AndroidX.AppCompat.Widget; namespace Microsoft.Maui.Platform { diff --git a/src/Core/src/Platform/Android/ViewExtensions.cs b/src/Core/src/Platform/Android/ViewExtensions.cs index 9f83e8e1c3ff..bbae2580152b 100644 --- a/src/Core/src/Platform/Android/ViewExtensions.cs +++ b/src/Core/src/Platform/Android/ViewExtensions.cs @@ -786,7 +786,8 @@ void ShowSoftInput() } view.ShowSoftInput(); - }; + } + ; view.Post(ShowSoftInput); } diff --git a/src/Core/src/Platform/Windows/SliderExtensions.cs b/src/Core/src/Platform/Windows/SliderExtensions.cs index 246d11370c4b..5c0f0e29e0a6 100644 --- a/src/Core/src/Platform/Windows/SliderExtensions.cs +++ b/src/Core/src/Platform/Windows/SliderExtensions.cs @@ -145,7 +145,8 @@ void OnImageOpened(object sender, RoutedEventArgs e) if (nativeSlider.Parent is FrameworkElement frameworkElement) frameworkElement.InvalidateMeasure(); - }; + } + ; } nativeSlider.ThumbImageSource = nativeThumbImageSource?.Value; diff --git a/src/Core/src/Platform/iOS/MauiRefreshView.cs b/src/Core/src/Platform/iOS/MauiRefreshView.cs index 5c0536bbf84b..0151c4b8d6c4 100644 --- a/src/Core/src/Platform/iOS/MauiRefreshView.cs +++ b/src/Core/src/Platform/iOS/MauiRefreshView.cs @@ -132,7 +132,7 @@ bool TryRemoveRefresh(UIView view, int index = 0) bool TryInsertRefresh(UIView view, int index = 0) { - if(!_refreshControl.Enabled) + if (!_refreshControl.Enabled) { return false; } diff --git a/src/Core/src/Platform/iOS/ViewExtensions.cs b/src/Core/src/Platform/iOS/ViewExtensions.cs index 0d5fb61fff6f..ed85f0606503 100644 --- a/src/Core/src/Platform/iOS/ViewExtensions.cs +++ b/src/Core/src/Platform/iOS/ViewExtensions.cs @@ -741,7 +741,8 @@ void OnLoadedCheck(NSObservedChange? nSObservedChange = null) uiView.BeginInvokeOnMainThread(() => OnLoadedCheck(null)); } } - }; + } + ; return disposable; } @@ -801,7 +802,8 @@ void UnLoadedCheck() disposable = null; action(); } - }; + } + ; return disposable; } @@ -1014,7 +1016,7 @@ internal static float GetDisplayDensity(this UIView? view) => private const nint NativeViewControlledByCrossPlatformLayout = 0x63D2A1; internal static bool IsFinalMeasureHandledBySuperView(this UIView? view) => view?.Superview is ICrossPlatformLayoutBacking { CrossPlatformLayout: not null } or { Tag: NativeViewControlledByCrossPlatformLayout }; - + internal static void MarkAsCrossPlatformLayoutBacking(this UIView view) { view.Tag = NativeViewControlledByCrossPlatformLayout; diff --git a/src/Core/tests/DeviceTests/Graphics/GraphicsTests.Android.cs b/src/Core/tests/DeviceTests/Graphics/GraphicsTests.Android.cs index b5d5607c648c..ab0a04d2b1b0 100644 --- a/src/Core/tests/DeviceTests/Graphics/GraphicsTests.Android.cs +++ b/src/Core/tests/DeviceTests/Graphics/GraphicsTests.Android.cs @@ -205,7 +205,7 @@ public void RadialGradientPaintTest(string startHexColor, string endHexColor) public void NullRadialGradientPaintTest() { RadialGradientPaintStub nullRadialGradientPaint = null; - + Assert.False(nullRadialGradientPaint.IsSolid()); } } \ No newline at end of file diff --git a/src/Core/tests/UnitTests/PaintTests.cs b/src/Core/tests/UnitTests/PaintTests.cs index 760068d8ab17..b30ee342eb47 100644 --- a/src/Core/tests/UnitTests/PaintTests.cs +++ b/src/Core/tests/UnitTests/PaintTests.cs @@ -40,7 +40,7 @@ public void TestNullOrEmptyLinearGradientPaint() LinearGradientPaint emptyLinearGradientPaint = new LinearGradientPaint(); Assert.False(emptyLinearGradientPaint.IsNullOrEmpty()); - PaintGradientStop[] linearGradientStops = + PaintGradientStop[] linearGradientStops = { new PaintGradientStop(0.1f, Colors.Orange), new PaintGradientStop(0.8f, Colors.Red) diff --git a/src/SingleProject/Resizetizer/src/TizenSplashUpdater.cs b/src/SingleProject/Resizetizer/src/TizenSplashUpdater.cs index 2e2a8f0c310e..a58e75036185 100644 --- a/src/SingleProject/Resizetizer/src/TizenSplashUpdater.cs +++ b/src/SingleProject/Resizetizer/src/TizenSplashUpdater.cs @@ -75,12 +75,12 @@ void UpdateColorAndMoveFile(ResizeImageInfo splashInfo, SKSizeI screenSize, stri Log.LogWarning($"Unable to parse color for '{splashInfo.Filename}'."); color = SKColors.White; } - + using var img = SKImage.FromEncodedData(sourceFilePath); - + var info = new SKImageInfo(screenSize.Width, screenSize.Height); using var surface = SKSurface.Create(info); - + var canvas = surface.Canvas; canvas.Clear(color.Value); @@ -101,9 +101,9 @@ void UpdateColorAndMoveFile(ResizeImageInfo splashInfo, SKSizeI screenSize, stri canvas.DrawImage(img, dest, sampling, paint); canvas.Flush(); - + using var updatedsplash = surface.Snapshot(); - + using var data = updatedsplash.Encode(SKEncodedImageFormat.Png, 100); using var stream = File.Create(destFilePath); data.SaveTo(stream); diff --git a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs index 7feae18b0847..b6a927543c60 100644 --- a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs +++ b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs @@ -112,7 +112,7 @@ public static Task AttachAndRun(this UIView view, Func action) => private class TestWrapperView : UIView { private readonly TaskCompletionSource _tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); - + public Task WaitForLayoutPassAsync() => _tcs.Task; public override void LayoutSubviews() @@ -121,7 +121,7 @@ public override void LayoutSubviews() _tcs.TrySetResult(); } } - + public static async Task AttachAndRun(this UIView view, Func> action) { var currentView = FindContentView(); @@ -188,7 +188,7 @@ public static UIView FindContentView() { return _contentView; } - + if (GetKeyWindow(UIApplication.SharedApplication) is not UIWindow window) { throw new InvalidOperationException("Could not attach view - unable to find UIWindow"); diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumWindowsAlertActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumWindowsAlertActions.cs index 0d355176615d..a8d634b7ff04 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumWindowsAlertActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumWindowsAlertActions.cs @@ -42,10 +42,10 @@ public CommandResponse Execute(string commandName, IDictionary p CommandResponse GetAlerts(IDictionary parameters) { var result = _appiumApp.Driver.FindElements(By.XPath("//Window[@ClassName=\"Popup\"][@IsModal=\"True\"]")); - + if (result is null || result.Count == 0) return CommandResponse.FailedEmptyResponse; - + var alerts = result.Select(e => new AppiumDriverElement(e, _appiumApp)).ToList(); return new CommandResponse(alerts, CommandResponseResult.Success);