From 197e22fbd941ec9c5f4bf0e0d49c884ea4971007 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 00:19:21 +0000 Subject: [PATCH] [create-pull-request] automated change --- .../CollectionView/ItemsViewRenderer.cs | 3 +- .../src/iOS/Renderers/NavigationRenderer.cs | 3 +- .../src/BindingSourceGen/PathParser.cs | 6 +- .../src/Build.Tasks/NodeILExtensions.cs | 6 +- .../src/Build.Tasks/SetPropertiesVisitor.cs | 4 +- src/Controls/src/Build.Tasks/XamlCache.cs | 2 +- src/Controls/src/Core/AppThemeBinding.cs | 3 +- .../FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs | 30 +- .../Handlers/ListView/iOS/ListViewRenderer.cs | 2 +- .../NavigationPage/iOS/NavigationRenderer.cs | 3 +- .../Android/SearchHandlerAppearanceTracker.cs | 6 +- .../Shell/Android/ShellItemRendererBase.cs | 3 +- .../Shell/iOS/ShellPageRendererTracker.cs | 2 +- .../Items/ItemsViewHandler.Windows.cs | 3 +- .../iOS/SelectableItemsViewController.cs | 2 +- .../Core/Handlers/Items/iOS/TemplatedCell.cs | 6 +- .../Items2/iOS/CarouselViewController2.cs | 2 +- .../Handlers/Items2/iOS/LayoutFactory2.cs | 3 +- .../iOS/SelectableItemsViewController2.cs | 2 +- .../iOS/StructuredItemsViewController2.cs | 2 +- src/Controls/src/Core/Shell/ShellSection.cs | 3 +- .../src/Core/VisualElement/VisualElement.cs | 14 +- src/Controls/src/Xaml/XamlServiceProvider.cs | 2 +- .../tests/Core.UnitTests/BindingUnitTests.cs | 3 +- .../Elements/Border/BorderTests.Windows.cs | 10 +- .../Elements/Border/BorderTests.cs | 2 +- .../Elements/BoxView/BoxViewTests.Android.cs | 156 +- .../Elements/BoxView/BoxViewTests.Windows.cs | 12 +- .../Elements/BoxView/BoxViewTests.cs | 18 +- .../Elements/BoxView/BoxViewTests.iOS.cs | 6 +- .../Elements/Button/ButtonTests.Android.cs | 2 +- .../Elements/Button/ButtonTests.Windows.cs | 4 +- .../CheckBox/CheckBoxTests.Android.cs | 152 +- .../CheckBox/CheckBoxTests.Windows.cs | 2 +- .../Elements/CheckBox/CheckBoxTests.cs | 10 +- .../Elements/CheckBox/CheckBoxTests.iOS.cs | 4 +- .../CollectionViewTests.Android.cs | 8 +- .../CollectionView/CollectionViewTests.iOS.cs | 4 +- .../DatePicker/DatePickerTests.Windows.cs | 2 +- .../Elements/Editor/EditorTests.Android.cs | 6 +- .../Elements/Editor/EditorTests.Windows.cs | 2 +- .../Elements/Editor/EditorTests.cs | 2 +- .../Elements/Editor/EditorTests.iOS.cs | 6 +- .../Elements/Entry/EntryTests.Windows.cs | 2 +- .../DeviceTests/Elements/Entry/EntryTests.cs | 2 +- .../Elements/Entry/EntryTests.iOS.cs | 6 +- .../DeviceTests/Elements/Image/ImageTests.cs | 2 +- .../Elements/Label/LabelTests.Android.cs | 6 +- .../Elements/Label/LabelTests.iOS.cs | 4 +- .../Elements/Page/PageTests.Android.cs | 2 +- .../Elements/Page/PageTests.iOS.cs | 2 +- .../Elements/Picker/PickerTests.Android.cs | 2 +- .../Elements/Picker/PickerTests.iOS.cs | 34 +- .../RadioButton/RadioButtonTests.Windows.cs | 8 +- .../ScrollView/ScrollViewTests.iOS.cs | 3 +- .../SearchBar/SearchBarTests.Android.cs | 4 +- .../SearchBar/SearchBarTests.Windows.cs | 2 +- .../Elements/SearchBar/SearchBarTests.cs | 12 +- .../Elements/Shell/ShellTests.Android.cs | 4 +- .../SwipeView/SwipeViewTests.Android.cs | 20 +- .../Elements/SwipeView/SwipeViewTests.iOS.cs | 18 +- .../Elements/TabbedPage/TabbedPageTests.cs | 3 +- .../TemplatedViewTests.Android.cs | 138 +- .../CollectionViewGroupingPage.xaml.cs | 2 +- .../GroupingOptionsPage.xaml.cs | 2 +- .../CollectionView/CollectionViewViewModel.cs | 928 ++++++------ .../CollectionViewEmptyViewPage.xaml.cs | 2 +- .../EmptyView/EmptyViewOptionsPage.xaml.cs | 500 +++---- .../CollectionViewHeaderPage.xaml.cs | 2 +- .../HeaderFooterOptionsPage.xaml.cs | 518 +++---- .../CollectionViewScrollPage.xaml.cs | 14 +- .../ScrollBehaviorOptionsPage.xaml.cs | 36 +- .../TestCases.HostApp/Issues/Issue14497.cs | 84 +- .../Issues/Issue15649.xaml.cs | 16 +- .../TestCases.HostApp/Issues/Issue17105.cs | 36 +- .../TestCases.HostApp/Issues/Issue18158.cs | 6 +- .../TestCases.HostApp/Issues/Issue19007.cs | 42 +- .../TestCases.HostApp/Issues/Issue19109.cs | 84 +- .../Issues/Issue24996.xaml.cs | 6 +- .../Issues/Issue2680ScrollView.cs | 16 +- .../TestCases.HostApp/Issues/Issue2775.cs | 2 +- .../Issues/Issue27803.xaml.cs | 8 +- .../Issues/Issue27992.xaml.cs | 2 +- .../Issues/Issue28098.xaml.cs | 4 +- .../Issues/Issue28130_flyout.cs | 6 +- .../Issues/Issue28130_shell.cs | 6 +- .../TestCases.HostApp/Issues/Issue28330.cs | 82 +- .../TestCases.HostApp/Issues/Issue28343.cs | 38 +- .../TestCases.HostApp/Issues/Issue28419.cs | 38 +- .../TestCases.HostApp/Issues/Issue28838.cs | 116 +- .../TestCases.HostApp/Issues/Issue7144.cs | 3 +- .../Issues/ScrollViewObjectDisposed.cs | 2 +- .../Issues/XFIssue/Issue9686.cs | 3 +- .../XFIssue/ShellFlyoutHeaderBehavior.cs | 3 +- .../Utils/GarbageCollectionHelper.cs | 14 +- .../CollectionViewUITests.HeaderAndFooter.cs | 112 +- .../CollectionView_EmptyViewFeatureTests.cs | 28 +- ...CollectionView_HeaderFooterFeatureTests.cs | 4 +- .../CollectionView_ScrollingFeatureTests.cs | 8 +- .../FeatureMatrix/GroupingFeatureTests.cs | 1332 ++++++++--------- .../Tests/Issues/Issue14497.cs | 2 +- .../Tests/Issues/Issue15649.cs | 18 +- .../Tests/Issues/Issue18751.cs | 2 +- .../Tests/Issues/Issue19007.cs | 22 +- .../Tests/Issues/Issue19831.cs | 2 +- .../Tests/Issues/Issue25201.cs | 6 +- .../Tests/Issues/Issue25889.cs | 2 +- .../Tests/Issues/Issue27766.cs | 28 +- .../Tests/Issues/Issue27803.cs | 18 +- .../Tests/Issues/Issue27992.cs | 10 +- .../Tests/Issues/Issue28098.cs | 28 +- .../Tests/Issues/Issue28330.cs | 28 +- .../Tests/Issues/Issue28343.cs | 4 +- .../Tests/Issues/Issue28419.cs | 24 +- .../Tests/Issues/Issue28838.cs | 18 +- .../Tests/Issues/Issue28930.cs | 4 +- .../Tests/Issues/XFIssue/ShellInsets.cs | 2 +- .../Xaml.UnitTests/MSBuild/MSBuildTests.cs | 3 +- .../ServiceProviderTests.xaml.cs | 2 +- .../Handlers/Editor/EditorHandler.Tizen.cs | 3 +- .../src/Handlers/Entry/EntryHandler.Tizen.cs | 3 +- .../src/Handlers/Entry/EntryHandler.iOS.cs | 6 +- .../HybridWebView/HybridWebViewHandler.iOS.cs | 26 +- .../ImageButton/ImageButtonHandler.iOS.cs | 2 +- .../ImageSources/iOS/ImageSourceExtensions.cs | 4 +- .../src/Platform/Android/MauiSwipeView.cs | 8 +- src/Core/src/Platform/Android/MauiTextView.cs | 2 +- .../src/Platform/Android/ViewExtensions.cs | 3 +- .../src/Platform/Windows/MauiPageControl.cs | 2 +- .../src/Platform/Windows/SliderExtensions.cs | 3 +- src/Core/src/Platform/iOS/MauiRefreshView.cs | 2 +- src/Core/src/Platform/iOS/MauiView.cs | 2 +- src/Core/src/Platform/iOS/ViewExtensions.cs | 10 +- .../ImageAnalysis/RawBitmap.cs | 4 +- .../Graphics/GraphicsTests.Android.cs | 2 +- .../Handlers/WebView/WebViewHandlerTests.cs | 6 +- .../FileImageSourceServiceTests.cs | 46 +- .../StreamImageSourceServiceTests.iOS.cs | 2 +- src/Core/tests/UnitTests/PaintTests.cs | 2 +- .../Resizetizer/src/TizenSplashUpdater.cs | 10 +- .../src/DeviceTests/AssertionExtensions.cs | 68 +- .../DeviceTests/AssertionExtensions.iOS.cs | 6 +- .../Actions/AppiumWindowsAlertActions.cs | 4 +- .../src/UITest.Appium/HelperExtensions.cs | 2 +- 144 files changed, 2690 insertions(+), 2663 deletions(-) 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/Build.Tasks/NodeILExtensions.cs b/src/Controls/src/Build.Tasks/NodeILExtensions.cs index a97b3fb61c44..37701251d9f0 100644 --- a/src/Controls/src/Build.Tasks/NodeILExtensions.cs +++ b/src/Controls/src/Build.Tasks/NodeILExtensions.cs @@ -655,9 +655,9 @@ public static IEnumerable PushServiceProvider(this INode node, ILCo } else yield return Create(Ldnull); - + yield return Create(Newobj, module.ImportCtorReference(context.Cache, - type: ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "SimpleValueTargetProvider"), + type: ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "SimpleValueTargetProvider"), parameterTypes: [ ("mscorlib", "System", "Object[]"), ("mscorlib", "System", "Object"), @@ -677,7 +677,7 @@ public static IEnumerable PushServiceProvider(this INode node, ILCo yield return Create(Call, module.ImportMethodReference(context.Cache, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true)); yield return Create(Ldloc, refProvider); yield return Create(Callvirt, addService); - + yield return Create(Dup); //Keep the serviceProvider on the stack yield return Create(Ldtoken, module.ImportReference(context.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IRootObjectProvider"))); yield return Create(Call, module.ImportMethodReference(context.Cache, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true)); diff --git a/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs b/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs index a51cf6a2c0a9..c2ed777870a0 100644 --- a/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs +++ b/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs @@ -1410,7 +1410,7 @@ static IEnumerable SetBinding(VariableDefinition parent, FieldRefer static bool CanSetValue(FieldReference bpRef, bool attached, INode node, IXmlLineInfo iXmlLineInfo, ILContext context) { - static bool CanSetValue (TypeReference bpTypeRef, VariableDefinition varValue, ILContext context, IXmlLineInfo iXmlLineInfo) + static bool CanSetValue(TypeReference bpTypeRef, VariableDefinition varValue, ILContext context, IXmlLineInfo iXmlLineInfo) { // If it's an attached BP, there's no second chance to handle IMarkupExtensions, so we try here. // Worst case scenario ? InvalidCastException at runtime @@ -1527,7 +1527,7 @@ static IEnumerable SetValue(VariableDefinition parent, FieldReferen yield return instruction; if (bpTypeRef.IsValueType) { - if ( bpTypeRef.ResolveCached(context.Cache).FullName == "System.Nullable`1" + if (bpTypeRef.ResolveCached(context.Cache).FullName == "System.Nullable`1" && TypeRefComparer.Default.Equals(varValue.VariableType, ((GenericInstanceType)bpTypeRef).GenericArguments[0])) bpTypeRef = ((GenericInstanceType)bpTypeRef).GenericArguments[0]; yield return Create(Box, module.ImportReference(bpTypeRef)); diff --git a/src/Controls/src/Build.Tasks/XamlCache.cs b/src/Controls/src/Build.Tasks/XamlCache.cs index 5d7c96e95a7e..8287c85c034e 100644 --- a/src/Controls/src/Build.Tasks/XamlCache.cs +++ b/src/Controls/src/Build.Tasks/XamlCache.cs @@ -42,7 +42,7 @@ public FieldReference GetOrAddFieldReference((ModuleDefinition module, string fi public TypeReference GetOrAddTypeReference(ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type) => GetOrAdd(_typeReferenceCache, (module, type.ToString()), x => { if (type.typeName.EndsWith("[]", StringComparison.InvariantCultureIgnoreCase)) - return x.module.GetTypeDefinition(this, (type.assemblyName, type.clrNamespace, type.typeName.Substring(0, type.typeName.Length-2))).MakeArrayType(); + return x.module.GetTypeDefinition(this, (type.assemblyName, type.clrNamespace, type.typeName.Substring(0, type.typeName.Length - 2))).MakeArrayType(); else return x.module.ImportReference(x.module.GetTypeDefinition(this, type)); }); 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/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs index 68cdf4a7a017..7ca799a8f51f 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs @@ -366,8 +366,8 @@ void HandlePropertyChanged(object sender, PropertyChangedEventArgs e) UpdateBackground(); else if (e.PropertyName == PlatformConfiguration.iOSSpecific.FlyoutPage.ApplyShadowProperty.PropertyName) UpdateApplyShadow(((FlyoutPage)Element).OnThisPlatform().GetApplyShadow()); - else if (e.PropertyName == Microsoft.Maui.Controls.FlyoutPage.FlyoutLayoutBehaviorProperty.PropertyName) - UpdateFlyoutLayoutBehaviorChanges(); + else if (e.PropertyName == Microsoft.Maui.Controls.FlyoutPage.FlyoutLayoutBehaviorProperty.PropertyName) + UpdateFlyoutLayoutBehaviorChanges(); else if (e.PropertyName == PlatformConfiguration.iOSSpecific.Page.PrefersHomeIndicatorAutoHiddenProperty.PropertyName || e.PropertyName == PlatformConfiguration.iOSSpecific.Page.PrefersStatusBarHiddenProperty.PropertyName) UpdatePageSpecifics(); @@ -481,20 +481,20 @@ void LayoutChildren(bool animated) void UpdateFlyoutLayoutBehaviorChanges() { LayoutChildren(true); - if (FlyoutPage is null) + if (FlyoutPage is null) return; - FlyoutLayoutBehavior flyoutBehavior = FlyoutPage.FlyoutLayoutBehavior; - bool shouldPresent = FlyoutPageController.ShouldShowSplitMode; - if (flyoutBehavior == FlyoutLayoutBehavior.Popover || flyoutBehavior == FlyoutLayoutBehavior.Default) - { - shouldPresent = false; - } - - if (shouldPresent != FlyoutPage.IsPresented) - { - ((IElementController)Element).SetValueFromRenderer(FlyoutPage.IsPresentedProperty, shouldPresent); - UpdateLeftBarButton(); - } + FlyoutLayoutBehavior flyoutBehavior = FlyoutPage.FlyoutLayoutBehavior; + bool shouldPresent = FlyoutPageController.ShouldShowSplitMode; + if (flyoutBehavior == FlyoutLayoutBehavior.Popover || flyoutBehavior == FlyoutLayoutBehavior.Default) + { + shouldPresent = false; + } + + if (shouldPresent != FlyoutPage.IsPresented) + { + ((IElementController)Element).SetValueFromRenderer(FlyoutPage.IsPresentedProperty, shouldPresent); + UpdateLeftBarButton(); + } } void PackContainers() 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/SearchHandlerAppearanceTracker.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/SearchHandlerAppearanceTracker.cs index 52fadb15e8fe..db8981fe9f27 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/SearchHandlerAppearanceTracker.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/SearchHandlerAppearanceTracker.cs @@ -98,14 +98,14 @@ void UpdateText() bool selectionExists = _editText.HasSelection; _editText.Text = _searchHandler.Query ?? string.Empty; - + UpdateTextTransform(); - + // If we had a selection, place the cursor at the end of text // Otherwise try to maintain the cursor at its previous position int textLength = _editText.Text?.Length ?? 0; int newPosition = selectionExists ? textLength : Math.Min(cursorPosition, textLength); - + // Prevents the cursor from resetting to position zero when text is set programmatically _editText.SetSelection(newPosition); } 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/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs index f7a6bcb76003..8e67b1295549 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs @@ -480,7 +480,7 @@ UIImage DrawHamburger() float size = 3f; float start = 4f; context.CGContext.SetLineWidth(size); - + for (int i = 0; i < 3; i++) { context.CGContext.MoveTo(1f, start + i * (size * 2)); 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 b0a15d4f3562..30a8403900f0 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 958e155fa54a..ceb8065ff450 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs @@ -303,7 +303,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 b5e40f0ecb5d..f0e90555ad66 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs @@ -192,7 +192,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/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/src/Core/VisualElement/VisualElement.cs b/src/Controls/src/Core/VisualElement/VisualElement.cs index 4827cea259dd..be0597200cbe 100644 --- a/src/Controls/src/Core/VisualElement/VisualElement.cs +++ b/src/Controls/src/Core/VisualElement/VisualElement.cs @@ -1416,13 +1416,13 @@ private protected void InvokeMeasureInvalidated(InvalidationTrigger trigger) } /// - /// A flag that determines whether the measure invalidated event should not be propagated up the visual tree. - /// - /// - /// Propagation will still occur within legacy layout subtrees. - /// - internal static bool SkipMeasureInvalidatedPropagation { get; set /* for testing purpose */; } = - AppContext.TryGetSwitch("Microsoft.Maui.RuntimeFeature.SkipMeasureInvalidatedPropagation", out var enabled) && enabled; + /// A flag that determines whether the measure invalidated event should not be propagated up the visual tree. + /// + /// + /// Propagation will still occur within legacy layout subtrees. + /// + internal static bool SkipMeasureInvalidatedPropagation { get; set /* for testing purpose */; } = + AppContext.TryGetSwitch("Microsoft.Maui.RuntimeFeature.SkipMeasureInvalidatedPropagation", out var enabled) && enabled; internal virtual void OnChildMeasureInvalidated(VisualElement child, InvalidationTrigger trigger) { diff --git a/src/Controls/src/Xaml/XamlServiceProvider.cs b/src/Controls/src/Xaml/XamlServiceProvider.cs index 6c5adaed3a69..b4265e682ff0 100644 --- a/src/Controls/src/Xaml/XamlServiceProvider.cs +++ b/src/Controls/src/Xaml/XamlServiceProvider.cs @@ -167,7 +167,7 @@ public SimpleValueTargetProvider(object[] objectAndParents, object targetPropert this.rootObject = rootObject ?? objectAndParents[objectAndParents.Length - 1]; } - public object RootObject => rootObject; + public object RootObject => rootObject; IEnumerable IProvideParentValues.ParentObjects => objectAndParents; object IProvideValueTarget.TargetObject => objectAndParents[0]; object IProvideValueTarget.TargetProperty => targetProperty; 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 1add2de04889..bd5784bd80a2 100644 --- a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs @@ -11,10 +11,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) { @@ -24,83 +24,83 @@ 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); - } - - [Fact] - [Description("The IsEnabled property of a BoxView should match with native IsEnabled")] + [Fact] + [Description("The IsEnabled property of a BoxView should match with native IsEnabled")] public async Task VerifyBoxViewIsEnabledProperty() { var boxView = new BoxView @@ -116,8 +116,8 @@ await InvokeOnMainThreadAsync(() => var isEnabled = nativeView.Enabled; Assert.Equal(expectedValue, isEnabled); }); - } - + } + 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 da087c8ae9d7..e0bb0042583d 100644 --- a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Windows.cs @@ -1,12 +1,12 @@ using System; +using System.ComponentModel; using System.Threading.Tasks; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Handlers; using Microsoft.Maui.Graphics.Platform; using Microsoft.Maui.Graphics.Win2D; using Microsoft.Maui.Handlers; using Xunit; -using System.ComponentModel; -using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.Handlers; namespace Microsoft.Maui.DeviceTests { @@ -23,9 +23,9 @@ Task GetPlatformOpacity(ShapeViewHandler handler) return (float)nativeView.Opacity; }); } - + [Fact] - [Description("The IsEnabled property of a BoxView should match with native IsEnabled")] + [Description("The IsEnabled property of a BoxView should match with native IsEnabled")] public async Task BoxViewIsEnabled() { var boxView = new BoxView @@ -40,7 +40,7 @@ await InvokeOnMainThreadAsync(() => { var isEnabled = nativeView.IsEnabled; Assert.Equal(expectedValue, isEnabled); - }); + }); } Task GetPlatformIsVisible(ShapeViewHandler boxViewHandler) diff --git a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs index 5f271391ad18..f6d2d9ec6de6 100644 --- a/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs @@ -2,9 +2,9 @@ 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.Controls.Handlers; using Microsoft.Maui.Hosting; using Xunit; @@ -53,12 +53,12 @@ public async Task BoxViewBackgroundConsistent() { var boxView = new BoxView { - HeightRequest = 100, + HeightRequest = 100, WidthRequest = 200, Background = Brush.Red }; var expected = (boxView.Background as SolidColorBrush)?.Color; - + await ValidateHasColor(boxView, expected, typeof(BoxViewHandler)); } @@ -79,9 +79,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(); @@ -89,11 +89,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 e31c3eab2fa5..d523f38a7a1c 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 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 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 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 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 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); - } - [Fact("The IsEnabled of a CheckBox should match with native IsEnabled")] public async Task CheckBoxIsEnabled() { diff --git a/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Windows.cs index da7a3b43ae4f..84114188290f 100644 --- a/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Windows.cs @@ -20,7 +20,7 @@ Task GetPlatformOpacity(CheckBoxHandler checkBoxHandler) return (float)nativeView.Opacity; }); } - + [Fact("The IsEnabled of a CheckBox should match with native IsEnabled")] public async Task CheckBoxIsEnabled() { 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/CheckBox/CheckBoxTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.iOS.cs index c1cbbfe2a5a5..a53c5f5dab59 100644 --- a/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.iOS.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; -using Microsoft.Maui.Graphics; using Microsoft.Maui.Controls; +using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using Xunit; @@ -22,7 +22,7 @@ Task GetPlatformOpacity(CheckBoxHandler checkBoxHandler) return (float)nativeView.Alpha; }); } - + [Fact("The IsEnabled of a CheckBox should match with native IsEnabled")] public async Task CheckBoxIsEnabled() { 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.Android.cs b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Android.cs index 0df2cb8c285a..01dafc85895e 100644 --- a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Android.cs @@ -152,7 +152,7 @@ public async Task RotationConsistent() } [Fact] - [Description("The IsEnabled property of a Editor should match with native IsEnabled")] + [Description("The IsEnabled property of a Editor should match with native IsEnabled")] public async Task VerifyEditorIsEnabledProperty() { var editor = new Editor @@ -168,7 +168,7 @@ await InvokeOnMainThreadAsync(() => var isEnabled = nativeView.Enabled; Assert.Equal(expectedValue, isEnabled); - }); - } + }); + } } } diff --git a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Windows.cs index 6dc9ab2f9d7c..94e2dff8bde7 100644 --- a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Windows.cs @@ -1,5 +1,4 @@ #nullable enable -using Xunit; using System; using System.ComponentModel; using System.Threading.Tasks; @@ -7,6 +6,7 @@ using Microsoft.Maui.Dispatching; using Microsoft.Maui.Handlers; using Microsoft.UI.Xaml.Controls; +using Xunit; using WFlowDirection = Microsoft.UI.Xaml.FlowDirection; using WTextAlignment = Microsoft.UI.Xaml.TextAlignment; 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 6f89153da58c..1a234254f127 100644 --- a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.iOS.cs @@ -1,5 +1,4 @@ -using UIKit; -using Xunit; +using System.ComponentModel; using System.Linq; using System.Threading.Tasks; using Microsoft.Maui.Controls; @@ -7,8 +6,9 @@ using Microsoft.Maui.Handlers; using Microsoft.Maui.Hosting; using Microsoft.Maui.Platform; +using UIKit; +using Xunit; using static Microsoft.Maui.DeviceTests.AssertHelpers; -using System.ComponentModel; namespace Microsoft.Maui.DeviceTests { diff --git a/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Windows.cs index a41c816bea69..fea2baaec0a1 100644 --- a/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Windows.cs @@ -1,11 +1,11 @@ #nullable enable -using Xunit; using System.ComponentModel; using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Dispatching; using Microsoft.Maui.Handlers; using Microsoft.UI.Xaml.Controls; +using Xunit; using WTextAlignment = Microsoft.UI.Xaml.TextAlignment; namespace Microsoft.Maui.DeviceTests 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 282b8a5647ef..70c6a4384cf2 100644 --- a/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.iOS.cs @@ -1,6 +1,4 @@ -using UIKit; -using Xunit; -using System.ComponentModel; +using System.ComponentModel; using System.Linq; using System.Threading.Tasks; using Microsoft.Maui.Controls; @@ -10,6 +8,8 @@ using Microsoft.Maui.Handlers; using Microsoft.Maui.Hosting; using Microsoft.Maui.Platform; +using UIKit; +using Xunit; using static Microsoft.Maui.DeviceTests.AssertHelpers; namespace Microsoft.Maui.DeviceTests 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.Android.cs b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.Android.cs index e584366a7174..59a3cf4768f2 100644 --- a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.Android.cs @@ -163,8 +163,8 @@ public async Task RotationConsistent() Assert.Equal(expected, platformRotation); } - [Fact] - [Description("The IsEnabled property of a Label should match with native IsEnabled")] + [Fact] + [Description("The IsEnabled property of a Label should match with native IsEnabled")] public async Task VerifyLabelIsEnabledProperty() { var label = new Label @@ -179,7 +179,7 @@ await InvokeOnMainThreadAsync(() => { var isEnabled = nativeView.Enabled; Assert.Equal(expectedValue, isEnabled); - }); + }); } TextView GetPlatformLabel(LabelHandler labelHandler) => 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/Page/PageTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Page/PageTests.Android.cs index 8ee2bf4a9524..aa2c437da829 100644 --- a/src/Controls/tests/DeviceTests/Elements/Page/PageTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Page/PageTests.Android.cs @@ -1,11 +1,11 @@ using System.Threading.Tasks; +using AndroidX.Fragment.App; using Microsoft.Maui.Controls; using Microsoft.Maui.Dispatching; using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; using Xunit; using AView = Android.Views.View; -using AndroidX.Fragment.App; namespace Microsoft.Maui.DeviceTests { diff --git a/src/Controls/tests/DeviceTests/Elements/Page/PageTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Page/PageTests.iOS.cs index 045e31fb2c72..408f2ebc8817 100644 --- a/src/Controls/tests/DeviceTests/Elements/Page/PageTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Page/PageTests.iOS.cs @@ -4,10 +4,10 @@ using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; using Microsoft.Maui.Dispatching; -using Microsoft.Maui.Platform; using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; using Microsoft.Maui.Hosting; +using Microsoft.Maui.Platform; using UIKit; using Xunit; 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 84e80f647bcd..a7a7f6a58821 100644 --- a/src/Controls/tests/DeviceTests/Elements/RadioButton/RadioButtonTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/RadioButton/RadioButtonTests.Windows.cs @@ -1,8 +1,8 @@ using System.ComponentModel; -using Xunit; using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Handlers; +using Xunit; namespace Microsoft.Maui.DeviceTests { @@ -87,9 +87,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); + }); } } } \ No newline at end of file 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 8d573064ac4b..49e910697f2d 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() @@ -118,7 +118,7 @@ public async Task RotationConsistent() } [Fact] - [Description("The IsEnabled of a SearchBar should match with native IsEnabled")] + [Description("The IsEnabled of a SearchBar should match with native IsEnabled")] public async Task VerifySearchBarIsEnabledProperty() { var searchBar = new SearchBar diff --git a/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Windows.cs index 3fbf5f0cdfdf..28f5b5a0c7b5 100644 --- a/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Windows.cs @@ -55,7 +55,7 @@ Task GetPlatformOpacity(SearchBarHandler searchBarHandler) return (float)nativeView.Opacity; }); } - + [Fact] [Description("The IsEnabled of a SearchBar should match with native IsEnabled")] public async Task VerifySearchBarIsEnabledProperty() 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 da925a7dfb15..bf29a1b1a387 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,13 +185,13 @@ 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); + }); } [Fact] - [Description("The IsEnabled of a SwipeView should match with native IsEnabled")] + [Description("The IsEnabled of a SwipeView should match with native IsEnabled")] public async Task VerifySwipeViewIsEnabledProperty() { var swipeView = new SwipeView @@ -206,7 +206,7 @@ await InvokeOnMainThreadAsync(() => { var isEnabled = nativeView.Enabled; Assert.Equal(expectedValue, isEnabled); - }); + }); } } } \ 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/FeatureMatrix/CollectionView/CollectionViewGrouping/CollectionViewGroupingPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewGrouping/CollectionViewGroupingPage.xaml.cs index dfa2f131fc22..db38b46d5a54 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewGrouping/CollectionViewGroupingPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewGrouping/CollectionViewGroupingPage.xaml.cs @@ -1,6 +1,6 @@ using System; -using Microsoft.Maui.Controls; using System.Collections.ObjectModel; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample; diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewGrouping/GroupingOptionsPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewGrouping/GroupingOptionsPage.xaml.cs index a1fc4ba83060..07a6b3e4dedc 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewGrouping/GroupingOptionsPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewGrouping/GroupingOptionsPage.xaml.cs @@ -1,7 +1,7 @@ using System; -using Microsoft.Maui.Controls; using System.Collections.ObjectModel; using Maui.Controls.Sample.CollectionViewGalleries; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample; diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewViewModel.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewViewModel.cs index e8f5849d7743..4adeb09db863 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewViewModel.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/CollectionViewViewModel.cs @@ -4,482 +4,482 @@ using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; +using System.Windows.Input; +using Maui.Controls.Sample.CollectionViewGalleries; using Microsoft.Maui.Controls; using Microsoft.Maui.Graphics; -using Maui.Controls.Sample.CollectionViewGalleries; -using System.Windows.Input; namespace Maui.Controls.Sample; public class Grouping : ObservableCollection { - public TKey Key { get; } + public TKey Key { get; } - public Grouping(TKey key, IEnumerable items) : base(items) - { - Key = key; - } + public Grouping(TKey key, IEnumerable items) : base(items) + { + Key = key; + } } public enum ItemsSourceType { - None, - ObservableCollectionT, - ObservableCollectionT2, - ObservableCollectionT3, - ObservableCollection25T, - ObservableCollection5T, - GroupedListT, - EmptyGroupedListT, - EmptyObservableCollectionT, - GroupedListT2, - GroupedListT3 + None, + ObservableCollectionT, + ObservableCollectionT2, + ObservableCollectionT3, + ObservableCollection25T, + ObservableCollection5T, + GroupedListT, + EmptyGroupedListT, + EmptyObservableCollectionT, + GroupedListT2, + GroupedListT3 } public class CollectionViewViewModel : INotifyPropertyChanged { - private object _emptyView; - private object _header; - private object _footer; - private DataTemplate _emptyViewTemplate; - private DataTemplate _headerTemplate; - private DataTemplate _footerTemplate; - private DataTemplate _groupHeaderTemplate; - private DataTemplate _groupFooterTemplate; - private DataTemplate _itemTemplate; - private IItemsLayout _itemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); - private ItemsSourceType _itemsSourceType = ItemsSourceType.None; - private bool _isGrouped = false; - private bool _canReorderItems = false; - private bool _canMixGroups = false; - private ItemSizingStrategy _itemSizingStrategy; - private ItemsUpdatingScrollMode _itemsUpdatingScrollMode; - private ObservableCollection _observableCollection; - private ObservableCollection _observableCollection25; - private ObservableCollection _observableCollection5; - private ObservableCollection _emptyObservableCollection; - private List> _groupedList; - private List> _emptyGroupedList; - private ObservableCollection _observableCollection3; - private ObservableCollection _observableCollection2; - private List> _groupedList3; - private List> _groupedList2; - - public bool ShowAddRemoveButtons => ItemsSourceType == ItemsSourceType.ObservableCollectionT3 || ItemsSourceType == ItemsSourceType.GroupedListT3; - - - public event PropertyChangedEventHandler PropertyChanged; - - private readonly string[] _addSequenceFruits = - { - "Dragonfruit", "Passionfruit", "Starfruit", "Rambutan", "Durian", "Persimmon" - }; - private int _addIndex = 0; - - public ICommand AddItemCommand { get; } - - public CollectionViewViewModel() - { - LoadItems(); - - AddItemCommand = new Command(AddItem); - - GroupHeaderTemplate = new DataTemplate(() => - { - var stackLayout = new StackLayout - { - BackgroundColor = Colors.LightGray - }; - var label = new Label - { - FontAttributes = FontAttributes.Bold, - FontSize = 24, - }; - label.SetBinding(Label.TextProperty, "Key"); - stackLayout.Children.Add(label); - return stackLayout; - }); - - SetItemTemplate(); - } - - public object EmptyView - { - get => _emptyView; - set { _emptyView = value; OnPropertyChanged(); } - } - - public object Header - { - get => _header; - set { _header = value; OnPropertyChanged(); } - } - - public object Footer - { - get => _footer; - set { _footer = value; OnPropertyChanged(); } - } - - public DataTemplate EmptyViewTemplate - { - get => _emptyViewTemplate; - set { _emptyViewTemplate = value; OnPropertyChanged(); } - } - - public DataTemplate HeaderTemplate - { - get => _headerTemplate; - set { _headerTemplate = value; OnPropertyChanged(); } - } - - public DataTemplate FooterTemplate - { - get => _footerTemplate; - set { _footerTemplate = value; OnPropertyChanged(); } - } - - public DataTemplate GroupHeaderTemplate - { - get => _groupHeaderTemplate; - set { _groupHeaderTemplate = value; OnPropertyChanged(); } - } - - public DataTemplate GroupFooterTemplate - { - get => _groupFooterTemplate; - set { _groupFooterTemplate = value; OnPropertyChanged(); } - } - - public DataTemplate ItemTemplate - { - get => _itemTemplate; - set { _itemTemplate = value; OnPropertyChanged(); } - } - - public IItemsLayout ItemsLayout - { - get => _itemsLayout; - set - { - if (_itemsLayout != value) - { - _itemsLayout = value; - OnPropertyChanged(); - } - } - } - - public ItemsSourceType ItemsSourceType - { - get => _itemsSourceType; - set - { - if (_itemsSourceType != value) - { - _itemsSourceType = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(ItemsSource)); - OnPropertyChanged(nameof(ShowAddRemoveButtons)); - SetItemTemplate(); - } - } - } - - public bool CanReorderItems - { - get => _canReorderItems; - set - { - if (_canReorderItems != value) - { - _canReorderItems = value; - OnPropertyChanged(); - } - } - } - public bool CanMixGroups - { - get => _canMixGroups; - set - { - if (_canMixGroups != value) - { - _canMixGroups = value; - OnPropertyChanged(); - } - } - } - - public bool IsGrouped - { - get => _isGrouped; - set - { - if (_isGrouped != value) - { - _isGrouped = value; - OnPropertyChanged(); - } - } - } - - public object ItemsSource - { - get - { - return ItemsSourceType switch - { - ItemsSourceType.ObservableCollectionT => _observableCollection, - ItemsSourceType.ObservableCollection25T => _observableCollection25, - ItemsSourceType.ObservableCollection5T => _observableCollection5, - ItemsSourceType.ObservableCollectionT3 => _observableCollection3, - ItemsSourceType.ObservableCollectionT2 => _observableCollection2, - ItemsSourceType.GroupedListT => _groupedList, - ItemsSourceType.GroupedListT2 => _groupedList2, - ItemsSourceType.EmptyGroupedListT => _emptyGroupedList, - ItemsSourceType.GroupedListT3 => _groupedList3, - ItemsSourceType.EmptyObservableCollectionT => _emptyObservableCollection, - ItemsSourceType.None => null, - _ => null - }; - } - } - - public ItemSizingStrategy ItemSizingStrategy - { - get => _itemSizingStrategy; - set - { - if (_itemSizingStrategy != value) - { - _itemSizingStrategy = value; - OnPropertyChanged(); - } - } - } - - public ItemsUpdatingScrollMode ItemsUpdatingScrollMode - { - get => _itemsUpdatingScrollMode; - set - { - if (_itemsUpdatingScrollMode != value) - { - _itemsUpdatingScrollMode = value; - OnPropertyChanged(); - } - } - } - - - private void LoadItems() - { - _observableCollection = new ObservableCollection(); - AddItems(_observableCollection, 7, "Fruits"); - AddItems(_observableCollection, 7, "Vegetables"); - - _observableCollection25 = new ObservableCollection(); - _observableCollection5 = new ObservableCollection(); - AddItems(_observableCollection5, 5, "Fruits"); - AddItems(_observableCollection25, 10, "Fruits"); - AddItems(_observableCollection25, 10, "Vegetables"); - - _emptyObservableCollection = new ObservableCollection(); - - _groupedList = new List> - { - new Grouping("Fruits", new List()), - new Grouping("Vegetables", new List()) - }; - - AddItems(_groupedList[0], 4, "Fruits"); - AddItems(_groupedList[1], 4, "Vegetables"); - - _emptyGroupedList = new List>(); - - _observableCollection2 = new ObservableCollection(); - AddItems2(_observableCollection2, 10); - - _observableCollection3 = new ObservableCollection(); - AddItems(_observableCollection3, 15, "Fruits"); - AddItems(_observableCollection3, 15, "Vegetables"); - - _groupedList3 = new List> - { - new Grouping("Fruits", new List()), - new Grouping("Vegetables", new List()) - - }; - - AddItems(_groupedList3[0], 12, "Fruits"); - AddItems(_groupedList3[1], 12, "Vegetables"); - - _groupedList2 = new List> - { - new Grouping("Group1", new List()), - new Grouping("Group2", new List()) - }; - AddItems2(_groupedList2[0], 3); - AddItems2(_groupedList2[1], 2); - - } - - - private void AddItems(IList list, int count, string category) - { - string[] fruits = - { - "Apple", "Banana", "Orange", "Grapes", "Mango", - "Pineapple", "Strawberry", "Blueberry", "Peach", "Cherry", - "Watermelon", "Papaya", "Kiwi", "Pear", "Plum", - "Avocado", "Fig", "Guava", "Lychee", "Pomegranate", - "Lime", "Lemon", "Coconut", "Apricot", "Blackberry" - }; - - string[] vegetables = - { - "Carrot", "Broccoli", "Spinach", "Potato", "Tomato", - "Cucumber", "Lettuce", "Onion", "Garlic", "Pepper", - "Zucchini", "Pumpkin", "Radish", "Beetroot", "Cabbage", - "Sweet Potato", "Turnip", "Cauliflower", "Celery", "Asparagus", - "Eggplant", "Chili", "Corn", "Peas", "Mushroom" - }; - - string[] items = category == "Fruits" ? fruits : vegetables; - - for (int n = 0; n < count; n++) - { - list.Add(new CollectionViewTestItem(items[n % items.Length], n)); - } - } - - private void AddItems2(IList list, int count) - { - string loremParagraph = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - string[] sentences = loremParagraph.Split(new[] { ". " }, StringSplitOptions.RemoveEmptyEntries); - - double fixedFontSize = 16; - - for (int i = 0; i < count; i++) - { - int sentenceCount = (i % sentences.Length) + 1; - string text = string.Join(". ", sentences.Take(sentenceCount)) + "."; - list.Add(new ItemModel(text, fixedFontSize)); - } - } - - private void AddItem() - { - if (_addIndex >= _addSequenceFruits.Length) - _addIndex = 0; - - var fruitName = _addSequenceFruits[_addIndex++]; - var newItem = new CollectionViewTestItem(fruitName, _addIndex - 1); - - if (ItemsSourceType == ItemsSourceType.ObservableCollectionT3) - { - _observableCollection3.Insert(0, newItem); - } - else if (ItemsSourceType == ItemsSourceType.GroupedListT3 && _groupedList3.Count > 0) - { - _groupedList3[0].Insert(0, newItem); - } - - OnPropertyChanged(nameof(ItemsSource)); - } - - private void SetItemTemplate() - { - if (ItemsSourceType == ItemsSourceType.ObservableCollectionT2 || ItemsSourceType == ItemsSourceType.GroupedListT2) - { - - ItemTemplate = new DataTemplate(() => - { - var stackLayout = new StackLayout - { - BackgroundColor = Colors.LightBlue, - Margin = new Thickness(1), - - }; - - var label = new Label - { - TextColor = Colors.Black - }; - - label.SetBinding(Label.TextProperty, "Caption"); - label.SetBinding(Label.FontSizeProperty, "FontSize"); - - stackLayout.Children.Add(label); - - return stackLayout; - }); - } - else - { - ItemTemplate = new DataTemplate(() => - { - var label = new Label - { - VerticalOptions = LayoutOptions.Center, - HorizontalOptions = LayoutOptions.Center - }; - label.SetBinding(Label.TextProperty, "Caption"); - return new StackLayout - { - Padding = new Thickness(10), - Children = { label } - }; - }); - } - } - - protected void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - if (propertyName == nameof(IsGrouped)) - { - OnPropertyChanged(nameof(ItemsSource)); - } - - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - - public class CustomDataTemplateSelector : DataTemplateSelector - { - public DataTemplate Template1 { get; set; } - public DataTemplate Template2 { get; set; } - - protected override DataTemplate OnSelectTemplate(object item, BindableObject container) - { - if (item is CollectionViewTestItem testItem) - { - return testItem.Index % 2 == 0 ? Template1 : Template2; - } - - return Template1; - } - } - - public class CollectionViewTestItem - { - public string Caption { get; set; } - public int Index { get; set; } - - public CollectionViewTestItem(string caption, int index) - { - Caption = caption; - Index = index; - } - } - - public class ItemModel - { - public string Caption { get; set; } - public double FontSize { get; set; } - - public ItemModel(string caption, double fontSize) - { - Caption = caption; - FontSize = fontSize; - } - } + private object _emptyView; + private object _header; + private object _footer; + private DataTemplate _emptyViewTemplate; + private DataTemplate _headerTemplate; + private DataTemplate _footerTemplate; + private DataTemplate _groupHeaderTemplate; + private DataTemplate _groupFooterTemplate; + private DataTemplate _itemTemplate; + private IItemsLayout _itemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); + private ItemsSourceType _itemsSourceType = ItemsSourceType.None; + private bool _isGrouped = false; + private bool _canReorderItems = false; + private bool _canMixGroups = false; + private ItemSizingStrategy _itemSizingStrategy; + private ItemsUpdatingScrollMode _itemsUpdatingScrollMode; + private ObservableCollection _observableCollection; + private ObservableCollection _observableCollection25; + private ObservableCollection _observableCollection5; + private ObservableCollection _emptyObservableCollection; + private List> _groupedList; + private List> _emptyGroupedList; + private ObservableCollection _observableCollection3; + private ObservableCollection _observableCollection2; + private List> _groupedList3; + private List> _groupedList2; + + public bool ShowAddRemoveButtons => ItemsSourceType == ItemsSourceType.ObservableCollectionT3 || ItemsSourceType == ItemsSourceType.GroupedListT3; + + + public event PropertyChangedEventHandler PropertyChanged; + + private readonly string[] _addSequenceFruits = + { + "Dragonfruit", "Passionfruit", "Starfruit", "Rambutan", "Durian", "Persimmon" + }; + private int _addIndex = 0; + + public ICommand AddItemCommand { get; } + + public CollectionViewViewModel() + { + LoadItems(); + + AddItemCommand = new Command(AddItem); + + GroupHeaderTemplate = new DataTemplate(() => + { + var stackLayout = new StackLayout + { + BackgroundColor = Colors.LightGray + }; + var label = new Label + { + FontAttributes = FontAttributes.Bold, + FontSize = 24, + }; + label.SetBinding(Label.TextProperty, "Key"); + stackLayout.Children.Add(label); + return stackLayout; + }); + + SetItemTemplate(); + } + + public object EmptyView + { + get => _emptyView; + set { _emptyView = value; OnPropertyChanged(); } + } + + public object Header + { + get => _header; + set { _header = value; OnPropertyChanged(); } + } + + public object Footer + { + get => _footer; + set { _footer = value; OnPropertyChanged(); } + } + + public DataTemplate EmptyViewTemplate + { + get => _emptyViewTemplate; + set { _emptyViewTemplate = value; OnPropertyChanged(); } + } + + public DataTemplate HeaderTemplate + { + get => _headerTemplate; + set { _headerTemplate = value; OnPropertyChanged(); } + } + + public DataTemplate FooterTemplate + { + get => _footerTemplate; + set { _footerTemplate = value; OnPropertyChanged(); } + } + + public DataTemplate GroupHeaderTemplate + { + get => _groupHeaderTemplate; + set { _groupHeaderTemplate = value; OnPropertyChanged(); } + } + + public DataTemplate GroupFooterTemplate + { + get => _groupFooterTemplate; + set { _groupFooterTemplate = value; OnPropertyChanged(); } + } + + public DataTemplate ItemTemplate + { + get => _itemTemplate; + set { _itemTemplate = value; OnPropertyChanged(); } + } + + public IItemsLayout ItemsLayout + { + get => _itemsLayout; + set + { + if (_itemsLayout != value) + { + _itemsLayout = value; + OnPropertyChanged(); + } + } + } + + public ItemsSourceType ItemsSourceType + { + get => _itemsSourceType; + set + { + if (_itemsSourceType != value) + { + _itemsSourceType = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(ItemsSource)); + OnPropertyChanged(nameof(ShowAddRemoveButtons)); + SetItemTemplate(); + } + } + } + + public bool CanReorderItems + { + get => _canReorderItems; + set + { + if (_canReorderItems != value) + { + _canReorderItems = value; + OnPropertyChanged(); + } + } + } + public bool CanMixGroups + { + get => _canMixGroups; + set + { + if (_canMixGroups != value) + { + _canMixGroups = value; + OnPropertyChanged(); + } + } + } + + public bool IsGrouped + { + get => _isGrouped; + set + { + if (_isGrouped != value) + { + _isGrouped = value; + OnPropertyChanged(); + } + } + } + + public object ItemsSource + { + get + { + return ItemsSourceType switch + { + ItemsSourceType.ObservableCollectionT => _observableCollection, + ItemsSourceType.ObservableCollection25T => _observableCollection25, + ItemsSourceType.ObservableCollection5T => _observableCollection5, + ItemsSourceType.ObservableCollectionT3 => _observableCollection3, + ItemsSourceType.ObservableCollectionT2 => _observableCollection2, + ItemsSourceType.GroupedListT => _groupedList, + ItemsSourceType.GroupedListT2 => _groupedList2, + ItemsSourceType.EmptyGroupedListT => _emptyGroupedList, + ItemsSourceType.GroupedListT3 => _groupedList3, + ItemsSourceType.EmptyObservableCollectionT => _emptyObservableCollection, + ItemsSourceType.None => null, + _ => null + }; + } + } + + public ItemSizingStrategy ItemSizingStrategy + { + get => _itemSizingStrategy; + set + { + if (_itemSizingStrategy != value) + { + _itemSizingStrategy = value; + OnPropertyChanged(); + } + } + } + + public ItemsUpdatingScrollMode ItemsUpdatingScrollMode + { + get => _itemsUpdatingScrollMode; + set + { + if (_itemsUpdatingScrollMode != value) + { + _itemsUpdatingScrollMode = value; + OnPropertyChanged(); + } + } + } + + + private void LoadItems() + { + _observableCollection = new ObservableCollection(); + AddItems(_observableCollection, 7, "Fruits"); + AddItems(_observableCollection, 7, "Vegetables"); + + _observableCollection25 = new ObservableCollection(); + _observableCollection5 = new ObservableCollection(); + AddItems(_observableCollection5, 5, "Fruits"); + AddItems(_observableCollection25, 10, "Fruits"); + AddItems(_observableCollection25, 10, "Vegetables"); + + _emptyObservableCollection = new ObservableCollection(); + + _groupedList = new List> + { + new Grouping("Fruits", new List()), + new Grouping("Vegetables", new List()) + }; + + AddItems(_groupedList[0], 4, "Fruits"); + AddItems(_groupedList[1], 4, "Vegetables"); + + _emptyGroupedList = new List>(); + + _observableCollection2 = new ObservableCollection(); + AddItems2(_observableCollection2, 10); + + _observableCollection3 = new ObservableCollection(); + AddItems(_observableCollection3, 15, "Fruits"); + AddItems(_observableCollection3, 15, "Vegetables"); + + _groupedList3 = new List> + { + new Grouping("Fruits", new List()), + new Grouping("Vegetables", new List()) + + }; + + AddItems(_groupedList3[0], 12, "Fruits"); + AddItems(_groupedList3[1], 12, "Vegetables"); + + _groupedList2 = new List> + { + new Grouping("Group1", new List()), + new Grouping("Group2", new List()) + }; + AddItems2(_groupedList2[0], 3); + AddItems2(_groupedList2[1], 2); + + } + + + private void AddItems(IList list, int count, string category) + { + string[] fruits = + { + "Apple", "Banana", "Orange", "Grapes", "Mango", + "Pineapple", "Strawberry", "Blueberry", "Peach", "Cherry", + "Watermelon", "Papaya", "Kiwi", "Pear", "Plum", + "Avocado", "Fig", "Guava", "Lychee", "Pomegranate", + "Lime", "Lemon", "Coconut", "Apricot", "Blackberry" + }; + + string[] vegetables = + { + "Carrot", "Broccoli", "Spinach", "Potato", "Tomato", + "Cucumber", "Lettuce", "Onion", "Garlic", "Pepper", + "Zucchini", "Pumpkin", "Radish", "Beetroot", "Cabbage", + "Sweet Potato", "Turnip", "Cauliflower", "Celery", "Asparagus", + "Eggplant", "Chili", "Corn", "Peas", "Mushroom" + }; + + string[] items = category == "Fruits" ? fruits : vegetables; + + for (int n = 0; n < count; n++) + { + list.Add(new CollectionViewTestItem(items[n % items.Length], n)); + } + } + + private void AddItems2(IList list, int count) + { + string loremParagraph = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + string[] sentences = loremParagraph.Split(new[] { ". " }, StringSplitOptions.RemoveEmptyEntries); + + double fixedFontSize = 16; + + for (int i = 0; i < count; i++) + { + int sentenceCount = (i % sentences.Length) + 1; + string text = string.Join(". ", sentences.Take(sentenceCount)) + "."; + list.Add(new ItemModel(text, fixedFontSize)); + } + } + + private void AddItem() + { + if (_addIndex >= _addSequenceFruits.Length) + _addIndex = 0; + + var fruitName = _addSequenceFruits[_addIndex++]; + var newItem = new CollectionViewTestItem(fruitName, _addIndex - 1); + + if (ItemsSourceType == ItemsSourceType.ObservableCollectionT3) + { + _observableCollection3.Insert(0, newItem); + } + else if (ItemsSourceType == ItemsSourceType.GroupedListT3 && _groupedList3.Count > 0) + { + _groupedList3[0].Insert(0, newItem); + } + + OnPropertyChanged(nameof(ItemsSource)); + } + + private void SetItemTemplate() + { + if (ItemsSourceType == ItemsSourceType.ObservableCollectionT2 || ItemsSourceType == ItemsSourceType.GroupedListT2) + { + + ItemTemplate = new DataTemplate(() => + { + var stackLayout = new StackLayout + { + BackgroundColor = Colors.LightBlue, + Margin = new Thickness(1), + + }; + + var label = new Label + { + TextColor = Colors.Black + }; + + label.SetBinding(Label.TextProperty, "Caption"); + label.SetBinding(Label.FontSizeProperty, "FontSize"); + + stackLayout.Children.Add(label); + + return stackLayout; + }); + } + else + { + ItemTemplate = new DataTemplate(() => + { + var label = new Label + { + VerticalOptions = LayoutOptions.Center, + HorizontalOptions = LayoutOptions.Center + }; + label.SetBinding(Label.TextProperty, "Caption"); + return new StackLayout + { + Padding = new Thickness(10), + Children = { label } + }; + }); + } + } + + protected void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + if (propertyName == nameof(IsGrouped)) + { + OnPropertyChanged(nameof(ItemsSource)); + } + + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public class CustomDataTemplateSelector : DataTemplateSelector + { + public DataTemplate Template1 { get; set; } + public DataTemplate Template2 { get; set; } + + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) + { + if (item is CollectionViewTestItem testItem) + { + return testItem.Index % 2 == 0 ? Template1 : Template2; + } + + return Template1; + } + } + + public class CollectionViewTestItem + { + public string Caption { get; set; } + public int Index { get; set; } + + public CollectionViewTestItem(string caption, int index) + { + Caption = caption; + Index = index; + } + } + + public class ItemModel + { + public string Caption { get; set; } + public double FontSize { get; set; } + + public ItemModel(string caption, double fontSize) + { + Caption = caption; + FontSize = fontSize; + } + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/CollectionViewEmptyViewPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/CollectionViewEmptyViewPage.xaml.cs index 6fd053d87662..979788331528 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/CollectionViewEmptyViewPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/CollectionViewEmptyViewPage.xaml.cs @@ -1,6 +1,6 @@ using System; -using Microsoft.Maui.Controls; using System.Collections.ObjectModel; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample { diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/EmptyViewOptionsPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/EmptyViewOptionsPage.xaml.cs index 94dd21a57762..4186e8905925 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/EmptyViewOptionsPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/EmptyView/EmptyViewOptionsPage.xaml.cs @@ -1,270 +1,270 @@ using System; -using Microsoft.Maui.Controls; using System.Collections.ObjectModel; using Maui.Controls.Sample.CollectionViewGalleries; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample { - public partial class EmptyViewOptionsPage : ContentPage - { - private CollectionViewViewModel _viewModel; + public partial class EmptyViewOptionsPage : ContentPage + { + private CollectionViewViewModel _viewModel; - public EmptyViewOptionsPage(CollectionViewViewModel viewModel) - { - InitializeComponent(); - _viewModel = viewModel; - BindingContext = _viewModel; - } + public EmptyViewOptionsPage(CollectionViewViewModel viewModel) + { + InitializeComponent(); + _viewModel = viewModel; + BindingContext = _viewModel; + } - private void ApplyButton_Clicked(object sender, EventArgs e) - { - Navigation.PopAsync(); - } + private void ApplyButton_Clicked(object sender, EventArgs e) + { + Navigation.PopAsync(); + } - private void OnEmptyViewChanged(object sender, CheckedChangedEventArgs e) - { - if (EmptyViewNone.IsChecked) - { - _viewModel.EmptyView = null; - } - else if (EmptyViewString.IsChecked) - { - _viewModel.EmptyView = "No Items Available(String)"; - } - else if (EmptyViewGrid.IsChecked) - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10), - }; - grid.Children.Add(new Label - { - Text = "No Items Available(Grid View)", - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Blue - }); - _viewModel.EmptyView = grid; - } - else if (EmptyViewCustomSize.IsChecked) - { - Frame customView = new Frame - { - BackgroundColor = Colors.LightBlue, - HeightRequest = 200, - AutomationId = "EmptyViewLabel", - WidthRequest = 300, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - Content = new Label - { - Text = "Custom Empty View (Sized)", - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - } - }; - _viewModel.EmptyView = customView; - } - } + private void OnEmptyViewChanged(object sender, CheckedChangedEventArgs e) + { + if (EmptyViewNone.IsChecked) + { + _viewModel.EmptyView = null; + } + else if (EmptyViewString.IsChecked) + { + _viewModel.EmptyView = "No Items Available(String)"; + } + else if (EmptyViewGrid.IsChecked) + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10), + }; + grid.Children.Add(new Label + { + Text = "No Items Available(Grid View)", + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Blue + }); + _viewModel.EmptyView = grid; + } + else if (EmptyViewCustomSize.IsChecked) + { + Frame customView = new Frame + { + BackgroundColor = Colors.LightBlue, + HeightRequest = 200, + AutomationId = "EmptyViewLabel", + WidthRequest = 300, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Content = new Label + { + Text = "Custom Empty View (Sized)", + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + } + }; + _viewModel.EmptyView = customView; + } + } - private void OnHeaderChanged(object sender, CheckedChangedEventArgs e) - { - if (HeaderNone.IsChecked) - { - _viewModel.Header = null; - } - else if (HeaderString.IsChecked) - { - _viewModel.Header = "CollectionView Header(String)"; - } - else if (HeaderGrid.IsChecked) - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "CollectionView Header(Grid View)", - HorizontalOptions = LayoutOptions.Center, - TextColor = Colors.Blue - }); - _viewModel.Header = grid; - } - } + private void OnHeaderChanged(object sender, CheckedChangedEventArgs e) + { + if (HeaderNone.IsChecked) + { + _viewModel.Header = null; + } + else if (HeaderString.IsChecked) + { + _viewModel.Header = "CollectionView Header(String)"; + } + else if (HeaderGrid.IsChecked) + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "CollectionView Header(Grid View)", + HorizontalOptions = LayoutOptions.Center, + TextColor = Colors.Blue + }); + _viewModel.Header = grid; + } + } - private void OnFooterChanged(object sender, CheckedChangedEventArgs e) - { - if (FooterNone.IsChecked) - { - _viewModel.Footer = null; - } - else if (FooterString.IsChecked) - { - _viewModel.Footer = "CollectionView Footer(String)"; - } - else if (FooterGrid.IsChecked) - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "CollectionView Footer(Grid View)", - HorizontalOptions = LayoutOptions.Center, - TextColor = Colors.Red - }); - _viewModel.Footer = grid; - } - } + private void OnFooterChanged(object sender, CheckedChangedEventArgs e) + { + if (FooterNone.IsChecked) + { + _viewModel.Footer = null; + } + else if (FooterString.IsChecked) + { + _viewModel.Footer = "CollectionView Footer(String)"; + } + else if (FooterGrid.IsChecked) + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "CollectionView Footer(Grid View)", + HorizontalOptions = LayoutOptions.Center, + TextColor = Colors.Red + }); + _viewModel.Footer = grid; + } + } - private void OnEmptyViewTemplateChanged(object sender, CheckedChangedEventArgs e) - { - if (EmptyViewTemplateNone.IsChecked) - { - _viewModel.EmptyViewTemplate = null; - } - else if (EmptyViewTemplateGrid.IsChecked) - { - _viewModel.EmptyViewTemplate = new DataTemplate(() => - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "No Template Items Available(Grid View)", - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Blue - }); - return grid; - }); - } - else if (EmptyViewTemplateCustomSize.IsChecked) - { - _viewModel.EmptyViewTemplate = new DataTemplate(() => - { - Frame customView = new Frame - { - BackgroundColor = Colors.LightBlue, - HeightRequest = 200, - BorderColor = Colors.Green, - AutomationId = "EmptyViewTemplateLabel", - WidthRequest = 300, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - Content = new Label - { - Text = "Custom EmptyViewTemplate (Sized)", - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - } - }; - return customView; - }); - } - } + private void OnEmptyViewTemplateChanged(object sender, CheckedChangedEventArgs e) + { + if (EmptyViewTemplateNone.IsChecked) + { + _viewModel.EmptyViewTemplate = null; + } + else if (EmptyViewTemplateGrid.IsChecked) + { + _viewModel.EmptyViewTemplate = new DataTemplate(() => + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "No Template Items Available(Grid View)", + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Blue + }); + return grid; + }); + } + else if (EmptyViewTemplateCustomSize.IsChecked) + { + _viewModel.EmptyViewTemplate = new DataTemplate(() => + { + Frame customView = new Frame + { + BackgroundColor = Colors.LightBlue, + HeightRequest = 200, + BorderColor = Colors.Green, + AutomationId = "EmptyViewTemplateLabel", + WidthRequest = 300, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Content = new Label + { + Text = "Custom EmptyViewTemplate (Sized)", + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + } + }; + return customView; + }); + } + } - private void OnItemTemplateChanged(object sender, CheckedChangedEventArgs e) - { - if (ItemTemplateNone.IsChecked) - { - _viewModel.ItemTemplate = null; - } - else if (ItemTemplateBasic.IsChecked) - { - _viewModel.ItemTemplate = new DataTemplate(() => - { - var label = new Label(); - label.SetBinding(Label.TextProperty, new Binding("Caption")); - return label; - }); - } - else if (ItemTemplateGrid.IsChecked) - { - _viewModel.ItemTemplate = new DataTemplate(() => - { - var grid = new Grid - { - ColumnDefinitions = - { - new ColumnDefinition { Width = GridLength.Star }, - new ColumnDefinition { Width = GridLength.Star } - }, - Padding = new Thickness(10), - BackgroundColor = Colors.LightBlue + private void OnItemTemplateChanged(object sender, CheckedChangedEventArgs e) + { + if (ItemTemplateNone.IsChecked) + { + _viewModel.ItemTemplate = null; + } + else if (ItemTemplateBasic.IsChecked) + { + _viewModel.ItemTemplate = new DataTemplate(() => + { + var label = new Label(); + label.SetBinding(Label.TextProperty, new Binding("Caption")); + return label; + }); + } + else if (ItemTemplateGrid.IsChecked) + { + _viewModel.ItemTemplate = new DataTemplate(() => + { + var grid = new Grid + { + ColumnDefinitions = + { + new ColumnDefinition { Width = GridLength.Star }, + new ColumnDefinition { Width = GridLength.Star } + }, + Padding = new Thickness(10), + BackgroundColor = Colors.LightBlue - }; + }; - var label1 = new Label - { - VerticalOptions = LayoutOptions.Center, - HorizontalOptions = LayoutOptions.Start, - FontAttributes = FontAttributes.Bold, - TextColor = Colors.Green - }; - label1.SetBinding(Label.TextProperty, "Caption"); - grid.Children.Add(label1); - return grid; - }); - } - } + var label1 = new Label + { + VerticalOptions = LayoutOptions.Center, + HorizontalOptions = LayoutOptions.Start, + FontAttributes = FontAttributes.Bold, + TextColor = Colors.Green + }; + label1.SetBinding(Label.TextProperty, "Caption"); + grid.Children.Add(label1); + return grid; + }); + } + } - private void OnIsGroupedChanged(object sender, CheckedChangedEventArgs e) - { - if (IsGroupedFalse.IsChecked) - { - _viewModel.IsGrouped = false; - } - else if (IsGroupedTrue.IsChecked) - { - _viewModel.IsGrouped = true; - } - } + private void OnIsGroupedChanged(object sender, CheckedChangedEventArgs e) + { + if (IsGroupedFalse.IsChecked) + { + _viewModel.IsGrouped = false; + } + else if (IsGroupedTrue.IsChecked) + { + _viewModel.IsGrouped = true; + } + } - private void OnItemsSourceChanged(object sender, CheckedChangedEventArgs e) - { - if (!(sender is RadioButton radioButton) || !e.Value) - return; - // Set IsGrouped based on selection + private void OnItemsSourceChanged(object sender, CheckedChangedEventArgs e) + { + if (!(sender is RadioButton radioButton) || !e.Value) + return; + // Set IsGrouped based on selection - if (radioButton == ItemsSourceObservableCollection5) - _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollection5T; - else if (radioButton == ItemsSourceEmptyObservableCollection) - _viewModel.ItemsSourceType = ItemsSourceType.EmptyObservableCollectionT; - else if (radioButton == ItemsSourceGroupedList) - _viewModel.ItemsSourceType = ItemsSourceType.GroupedListT; - else if (radioButton == ItemsSourceEmptyGroupedList) - _viewModel.ItemsSourceType = ItemsSourceType.EmptyGroupedListT; - else if (radioButton == ItemsSourceNone) - _viewModel.ItemsSourceType = ItemsSourceType.None; - } + if (radioButton == ItemsSourceObservableCollection5) + _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollection5T; + else if (radioButton == ItemsSourceEmptyObservableCollection) + _viewModel.ItemsSourceType = ItemsSourceType.EmptyObservableCollectionT; + else if (radioButton == ItemsSourceGroupedList) + _viewModel.ItemsSourceType = ItemsSourceType.GroupedListT; + else if (radioButton == ItemsSourceEmptyGroupedList) + _viewModel.ItemsSourceType = ItemsSourceType.EmptyGroupedListT; + else if (radioButton == ItemsSourceNone) + _viewModel.ItemsSourceType = ItemsSourceType.None; + } - private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e) - { - if (ItemsLayoutVerticalList.IsChecked) - { - _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); - } - else if (ItemsLayoutHorizontalList.IsChecked) - { - _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); - } - else if (ItemsLayoutVerticalGrid.IsChecked) - { - _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Vertical); // 2 columns - } - else if (ItemsLayoutHorizontalGrid.IsChecked) - { - _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows - } - } - } + private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e) + { + if (ItemsLayoutVerticalList.IsChecked) + { + _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); + } + else if (ItemsLayoutHorizontalList.IsChecked) + { + _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); + } + else if (ItemsLayoutVerticalGrid.IsChecked) + { + _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Vertical); // 2 columns + } + else if (ItemsLayoutHorizontalGrid.IsChecked) + { + _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows + } + } + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml.cs index aafbd2ab27c9..ba04633c718e 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml.cs @@ -1,6 +1,6 @@ using System; -using Microsoft.Maui.Controls; using System.Collections.ObjectModel; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample; public partial class CollectionViewHeaderPage : ContentPage diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/HeaderFooterOptionsPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/HeaderFooterOptionsPage.xaml.cs index f15e6b3841ec..fa80a64b9880 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/HeaderFooterOptionsPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/HeaderFooterOptionsPage.xaml.cs @@ -1,278 +1,278 @@ using System; -using Microsoft.Maui.Controls; using System.Collections.ObjectModel; using Maui.Controls.Sample.CollectionViewGalleries; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample { - public partial class HeaderFooterOptionsPage : ContentPage - { - private CollectionViewViewModel _viewModel; + public partial class HeaderFooterOptionsPage : ContentPage + { + private CollectionViewViewModel _viewModel; - public HeaderFooterOptionsPage(CollectionViewViewModel viewModel) - { - InitializeComponent(); - _viewModel = viewModel; - BindingContext = _viewModel; - } + public HeaderFooterOptionsPage(CollectionViewViewModel viewModel) + { + InitializeComponent(); + _viewModel = viewModel; + BindingContext = _viewModel; + } - private void ApplyButton_Clicked(object sender, EventArgs e) - { - Navigation.PopAsync(); - } + private void ApplyButton_Clicked(object sender, EventArgs e) + { + Navigation.PopAsync(); + } - private void OnEmptyViewChanged(object sender, CheckedChangedEventArgs e) - { - if (EmptyViewNone.IsChecked) - { - _viewModel.EmptyView = null; - } - else if (EmptyViewString.IsChecked) - { - _viewModel.EmptyView = "No Items Available(String)"; - } - } + private void OnEmptyViewChanged(object sender, CheckedChangedEventArgs e) + { + if (EmptyViewNone.IsChecked) + { + _viewModel.EmptyView = null; + } + else if (EmptyViewString.IsChecked) + { + _viewModel.EmptyView = "No Items Available(String)"; + } + } - private void OnHeaderChanged(object sender, CheckedChangedEventArgs e) - { - if (HeaderNone.IsChecked) - { - _viewModel.Header = null; - } - else if (HeaderString.IsChecked) - { - _viewModel.Header = "CollectionView Header(String)"; - } - else if (HeaderGrid.IsChecked) - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "CollectionView Header(Grid View)", - FontSize = 18, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Blue, - AutomationId = "HeaderViewLabel" - }); - _viewModel.Header = grid; - } - } + private void OnHeaderChanged(object sender, CheckedChangedEventArgs e) + { + if (HeaderNone.IsChecked) + { + _viewModel.Header = null; + } + else if (HeaderString.IsChecked) + { + _viewModel.Header = "CollectionView Header(String)"; + } + else if (HeaderGrid.IsChecked) + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "CollectionView Header(Grid View)", + FontSize = 18, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Blue, + AutomationId = "HeaderViewLabel" + }); + _viewModel.Header = grid; + } + } - private void OnFooterChanged(object sender, CheckedChangedEventArgs e) - { - if (FooterNone.IsChecked) - { - _viewModel.Footer = null; - } - else if (FooterString.IsChecked) - { - _viewModel.Footer = "CollectionView Footer(String)"; - } - else if (FooterGrid.IsChecked) - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "CollectionView Footer(Grid View)", - FontSize = 18, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Red, - AutomationId = "FooterViewLabel" - }); - _viewModel.Footer = grid; - } - } + private void OnFooterChanged(object sender, CheckedChangedEventArgs e) + { + if (FooterNone.IsChecked) + { + _viewModel.Footer = null; + } + else if (FooterString.IsChecked) + { + _viewModel.Footer = "CollectionView Footer(String)"; + } + else if (FooterGrid.IsChecked) + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "CollectionView Footer(Grid View)", + FontSize = 18, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Red, + AutomationId = "FooterViewLabel" + }); + _viewModel.Footer = grid; + } + } - private void OnHeaderTemplateChanged(object sender, CheckedChangedEventArgs e) - { - if (HeaderTemplateNone.IsChecked) - { - _viewModel.HeaderTemplate = null; - } - else if (HeaderTemplateGrid.IsChecked) - { - _viewModel.HeaderTemplate = new DataTemplate(() => - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "Header Template(Grid View)", - FontSize = 18, - FontAttributes = FontAttributes.Bold, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Blue, - AutomationId = "HeaderTemplateLabel" - }); - return grid; - }); - } - } + private void OnHeaderTemplateChanged(object sender, CheckedChangedEventArgs e) + { + if (HeaderTemplateNone.IsChecked) + { + _viewModel.HeaderTemplate = null; + } + else if (HeaderTemplateGrid.IsChecked) + { + _viewModel.HeaderTemplate = new DataTemplate(() => + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "Header Template(Grid View)", + FontSize = 18, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Blue, + AutomationId = "HeaderTemplateLabel" + }); + return grid; + }); + } + } - private void OnFooterTemplateChanged(object sender, CheckedChangedEventArgs e) - { - if (FooterTemplateNone.IsChecked) - { - _viewModel.FooterTemplate = null; - } - else if (FooterTemplateGrid.IsChecked) - { - _viewModel.FooterTemplate = new DataTemplate(() => - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "Footer Template(Grid View)", - FontSize = 18, - FontAttributes = FontAttributes.Bold, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Green, - AutomationId = "FooterTemplateLabel" - }); - return grid; - }); - } - } + private void OnFooterTemplateChanged(object sender, CheckedChangedEventArgs e) + { + if (FooterTemplateNone.IsChecked) + { + _viewModel.FooterTemplate = null; + } + else if (FooterTemplateGrid.IsChecked) + { + _viewModel.FooterTemplate = new DataTemplate(() => + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "Footer Template(Grid View)", + FontSize = 18, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Green, + AutomationId = "FooterTemplateLabel" + }); + return grid; + }); + } + } - private void OnGroupHeaderTemplateChanged(object sender, CheckedChangedEventArgs e) - { - if (GroupHeaderTemplateNone.IsChecked) - { - _viewModel.GroupHeaderTemplate = null; - } - else if (GroupHeaderTemplateGrid.IsChecked) - { - _viewModel.GroupHeaderTemplate = new DataTemplate(() => - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "Group Header Template(Grid View)", - FontSize = 18, - FontAttributes = FontAttributes.Bold, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Green, - AutomationId = "GroupHeaderTemplateLabel" - }); - return grid; - }); - } - } - private void OnGroupFooterTemplateChanged(object sender, CheckedChangedEventArgs e) - { - if (GroupFooterTemplateNone.IsChecked) - { - _viewModel.GroupFooterTemplate = null; - } - else if (GroupFooterTemplateGrid.IsChecked) - { - _viewModel.GroupFooterTemplate = new DataTemplate(() => - { - Grid grid = new Grid - { - BackgroundColor = Colors.LightGray, - Padding = new Thickness(10) - }; - grid.Children.Add(new Label - { - Text = "Group Footer Template(Grid View)", - FontSize = 18, - FontAttributes = FontAttributes.Bold, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - TextColor = Colors.Red, - AutomationId = "GroupFooterTemplateLabel" - }); - return grid; - }); - } - } - private void OnIsGroupedChanged(object sender, CheckedChangedEventArgs e) - { - if (IsGroupedFalse.IsChecked) - { - _viewModel.IsGrouped = false; - } - else if (IsGroupedTrue.IsChecked) - { - _viewModel.IsGrouped = true; - } - } + private void OnGroupHeaderTemplateChanged(object sender, CheckedChangedEventArgs e) + { + if (GroupHeaderTemplateNone.IsChecked) + { + _viewModel.GroupHeaderTemplate = null; + } + else if (GroupHeaderTemplateGrid.IsChecked) + { + _viewModel.GroupHeaderTemplate = new DataTemplate(() => + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "Group Header Template(Grid View)", + FontSize = 18, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Green, + AutomationId = "GroupHeaderTemplateLabel" + }); + return grid; + }); + } + } + private void OnGroupFooterTemplateChanged(object sender, CheckedChangedEventArgs e) + { + if (GroupFooterTemplateNone.IsChecked) + { + _viewModel.GroupFooterTemplate = null; + } + else if (GroupFooterTemplateGrid.IsChecked) + { + _viewModel.GroupFooterTemplate = new DataTemplate(() => + { + Grid grid = new Grid + { + BackgroundColor = Colors.LightGray, + Padding = new Thickness(10) + }; + grid.Children.Add(new Label + { + Text = "Group Footer Template(Grid View)", + FontSize = 18, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + TextColor = Colors.Red, + AutomationId = "GroupFooterTemplateLabel" + }); + return grid; + }); + } + } + private void OnIsGroupedChanged(object sender, CheckedChangedEventArgs e) + { + if (IsGroupedFalse.IsChecked) + { + _viewModel.IsGrouped = false; + } + else if (IsGroupedTrue.IsChecked) + { + _viewModel.IsGrouped = true; + } + } - private void OnItemTemplateChanged(object sender, CheckedChangedEventArgs e) - { - if (ItemTemplateNone.IsChecked) - { - _viewModel.ItemTemplate = null; - } - else if (ItemTemplateBasic.IsChecked) - { - _viewModel.ItemTemplate = new DataTemplate(() => - { - var label = new Label(); - label.SetBinding(Label.TextProperty, new Binding("Caption")); + private void OnItemTemplateChanged(object sender, CheckedChangedEventArgs e) + { + if (ItemTemplateNone.IsChecked) + { + _viewModel.ItemTemplate = null; + } + else if (ItemTemplateBasic.IsChecked) + { + _viewModel.ItemTemplate = new DataTemplate(() => + { + var label = new Label(); + label.SetBinding(Label.TextProperty, new Binding("Caption")); - return label; - }); - } - } + return label; + }); + } + } - private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e) - { - if (ItemsLayoutVerticalList.IsChecked) - { - _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); - } - else if (ItemsLayoutHorizontalList.IsChecked) - { - _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); - } - else if (ItemsLayoutVerticalGrid.IsChecked) - { - _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Vertical); // 2 columns - } - else if (ItemsLayoutHorizontalGrid.IsChecked) - { - _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows - } - } + private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e) + { + if (ItemsLayoutVerticalList.IsChecked) + { + _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); + } + else if (ItemsLayoutHorizontalList.IsChecked) + { + _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); + } + else if (ItemsLayoutVerticalGrid.IsChecked) + { + _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Vertical); // 2 columns + } + else if (ItemsLayoutHorizontalGrid.IsChecked) + { + _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows + } + } - private void OnItemsSourceChanged(object sender, CheckedChangedEventArgs e) - { - if (!(sender is RadioButton radioButton) || !e.Value) - return; - if (radioButton == ItemsSourceObservableCollection25) - _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollection25T; - else if (radioButton == ItemsSourceObservableCollection5) - _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollection5T; - else if (radioButton == ItemsSourceGroupedList) - _viewModel.ItemsSourceType = ItemsSourceType.GroupedListT; - else if (radioButton == ItemsSourceNone) - _viewModel.ItemsSourceType = ItemsSourceType.None; - } - } + private void OnItemsSourceChanged(object sender, CheckedChangedEventArgs e) + { + if (!(sender is RadioButton radioButton) || !e.Value) + return; + if (radioButton == ItemsSourceObservableCollection25) + _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollection25T; + else if (radioButton == ItemsSourceObservableCollection5) + _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollection5T; + else if (radioButton == ItemsSourceGroupedList) + _viewModel.ItemsSourceType = ItemsSourceType.GroupedListT; + else if (radioButton == ItemsSourceNone) + _viewModel.ItemsSourceType = ItemsSourceType.None; + } + } } diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/CollectionViewScrollPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/CollectionViewScrollPage.xaml.cs index 9158c10243bc..055c94aa792e 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/CollectionViewScrollPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/CollectionViewScrollPage.xaml.cs @@ -1,5 +1,5 @@ -using Microsoft.Maui.Controls; using System.Collections.ObjectModel; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample; public partial class CollectionViewScrollPage : ContentPage { @@ -12,10 +12,10 @@ public CollectionViewScrollPage() BindingContext = _viewModel; } - private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e) - { - BindingContext = _viewModel = new CollectionViewViewModel(); - _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollectionT3; - await Navigation.PushAsync(new ScrollBehaviorOptionsPage(_viewModel)); - } + private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e) + { + BindingContext = _viewModel = new CollectionViewViewModel(); + _viewModel.ItemsSourceType = ItemsSourceType.ObservableCollectionT3; + await Navigation.PushAsync(new ScrollBehaviorOptionsPage(_viewModel)); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/ScrollBehaviorOptionsPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/ScrollBehaviorOptionsPage.xaml.cs index 7bd630e275e6..766394abc621 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/ScrollBehaviorOptionsPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/ScrollingFeature/ScrollBehaviorOptionsPage.xaml.cs @@ -68,22 +68,22 @@ private void OnIsGroupedChanged(object sender, CheckedChangedEventArgs e) } private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e) - { - if (ItemsLayoutVerticalList.IsChecked) - { - _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); - } - else if (ItemsLayoutHorizontalList.IsChecked) - { - _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); - } - else if (ItemsLayoutVerticalGrid.IsChecked) - { - _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Vertical); // 2 columns - } - else if (ItemsLayoutHorizontalGrid.IsChecked) - { - _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows - } - } + { + if (ItemsLayoutVerticalList.IsChecked) + { + _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical); + } + else if (ItemsLayoutHorizontalList.IsChecked) + { + _viewModel.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); + } + else if (ItemsLayoutVerticalGrid.IsChecked) + { + _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Vertical); // 2 columns + } + else if (ItemsLayoutHorizontalGrid.IsChecked) + { + _viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows + } + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue14497.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue14497.cs index 85ef977a95a0..a3babe67d6ab 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue14497.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue14497.cs @@ -3,55 +3,55 @@ namespace Maui.Controls.Sample.Issues; [Issue(IssueTracker.Github, 14497, "Dynamically setting SearchHandler Query property does not update text in the search box", PlatformAffected.Android | PlatformAffected.iOS)] public class Issue14497 : Shell { - public Issue14497() - { - ShellContent shellContent = new ShellContent - { - Title = "Home", - ContentTemplate = new DataTemplate(typeof(Issue14497Page)), - Route = "MainPage" - }; - - Items.Add(shellContent); - } + public Issue14497() + { + ShellContent shellContent = new ShellContent + { + Title = "Home", + ContentTemplate = new DataTemplate(typeof(Issue14497Page)), + Route = "MainPage" + }; + + Items.Add(shellContent); + } } public class Issue14497Page : ContentPage { - Issue14497CustomSearchHandler _searchHandler; - public Issue14497Page() - { - _searchHandler = new Issue14497CustomSearchHandler(); - - Button button = new Button - { - Text = "Change Search Text", - AutomationId = "ChangeSearchText" - }; - - button.Clicked += (s,e) => _searchHandler.SetQuery("Hello World"); - - VerticalStackLayout stackLayout = new VerticalStackLayout - { - Children = { button } - }; - - Content = stackLayout; - Shell.SetSearchHandler(this, _searchHandler); - } + Issue14497CustomSearchHandler _searchHandler; + public Issue14497Page() + { + _searchHandler = new Issue14497CustomSearchHandler(); + + Button button = new Button + { + Text = "Change Search Text", + AutomationId = "ChangeSearchText" + }; + + button.Clicked += (s, e) => _searchHandler.SetQuery("Hello World"); + + VerticalStackLayout stackLayout = new VerticalStackLayout + { + Children = { button } + }; + + Content = stackLayout; + Shell.SetSearchHandler(this, _searchHandler); + } } public class Issue14497CustomSearchHandler : SearchHandler { - public Issue14497CustomSearchHandler() - { - Placeholder = "Search..."; - ShowsResults = false; - } - - public void SetQuery(string searchText) - { - Query = searchText; - } + public Issue14497CustomSearchHandler() + { + Placeholder = "Search..."; + ShowsResults = false; + } + + public void SetQuery(string searchText) + { + Query = searchText; + } } \ No newline at end of file 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/Issue17105.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue17105.cs index 76b35752f145..e175524d4e2a 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue17105.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue17105.cs @@ -6,25 +6,25 @@ namespace Maui.Controls.Sample.Issues; [Issue(IssueTracker.Github, 17105, "Hide password hint which is showing when the entry is focused", PlatformAffected.macOS)] public class Issue17105 : ContentPage { - public Issue17105() - { - var stackLayout = new StackLayout - { - Padding = new Thickness(30, 0), - Spacing = 25 - }; + public Issue17105() + { + var stackLayout = new StackLayout + { + Padding = new Thickness(30, 0), + Spacing = 25 + }; - var entry = new UITestEntry - { - HorizontalOptions = LayoutOptions.Fill, - Placeholder = "Password: testing_password", - IsCursorVisible = false, - IsPassword = true, - AutomationId = "Entry" - }; + var entry = new UITestEntry + { + HorizontalOptions = LayoutOptions.Fill, + Placeholder = "Password: testing_password", + IsCursorVisible = false, + IsPassword = true, + AutomationId = "Entry" + }; - stackLayout.Children.Add(entry); - Content = stackLayout; - } + stackLayout.Children.Add(entry); + Content = stackLayout; + } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue18158.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue18158.cs index d6536aa3f500..0c7b174513a6 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue18158.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue18158.cs @@ -10,13 +10,13 @@ public class Issue18158 : TestFlyoutPage Button _button; protected override void Init() { - _button = new Button{ Text="Click", AutomationId = "Button"}; + _button = new Button { Text = "Click", AutomationId = "Button" }; FlyoutLayoutBehavior = FlyoutLayoutBehavior.Split; // Define the Flyout page Flyout = new ContentPage { Title = "Menu", - + Content = new StackLayout { Children = @@ -26,7 +26,7 @@ protected override void Init() } }; - _button.Clicked += (s,e) => + _button.Clicked += (s, e) => { if (this.FlyoutLayoutBehavior == FlyoutLayoutBehavior.Split) { 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/Issue2680ScrollView.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2680ScrollView.cs index 5ac041126626..88024538ff6a 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue2680ScrollView.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2680ScrollView.cs @@ -30,12 +30,12 @@ protected override void Init() longStackLayout.Children.Add(toggleButton); firstItemLabel = new Label - { - Text = "Not scrolled", - AutomationId = FirstItemMark - }; + { + Text = "Not scrolled", + AutomationId = FirstItemMark + }; - longStackLayout.Children.Add(firstItemLabel); + longStackLayout.Children.Add(firstItemLabel); Enumerable.Range(2, 50).Select(i => new Label { Text = $"Test label {i}" }) .ToList().ForEach(label => longStackLayout.Children.Add(label)); @@ -59,9 +59,9 @@ void ToggleButtonOnClicked(object sender, EventArgs e) } void ScrollViewOnScrolled(object sender, ScrolledEventArgs e) - { - firstItemLabel.Text = "Scrolled"; - } + { + firstItemLabel.Text = "Scrolled"; + } ScrollView scrollView; Button toggleButton; 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/Issue27803.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue27803.xaml.cs index 832c9be980d9..31ebe70c71f6 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue27803.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue27803.xaml.cs @@ -1,10 +1,10 @@ namespace Controls.TestCases.HostApp.Issues; -[Issue(IssueTracker.Github,27803,"DatePicker default format on iOS",PlatformAffected.iOS)] +[Issue(IssueTracker.Github, 27803, "DatePicker default format on iOS", PlatformAffected.iOS)] public partial class Issue27803 : ContentPage { private DateTime workDate = new DateTime(2025, 2, 25); - public DateTime WorkDate + public DateTime WorkDate { get => workDate; set @@ -28,12 +28,12 @@ public Issue27803() { InitializeComponent(); BindingContext = this; - + } private void Button_Clicked(object sender, EventArgs e) { DatePickerTextColor = Color.FromArgb("#FF0000"); - + } } \ No newline at end of file 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/Issue28130_flyout.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28130_flyout.cs index e143f740b7d5..38561cf8289b 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28130_flyout.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28130_flyout.cs @@ -9,14 +9,14 @@ protected override void Init() { Flyout = CreateFlyoutContent(); FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover; - Detail = _navigationPage = new NavigationPage(new Issue28130_DetailPage(pageTitle) { AutomationId = pageTitle}); + Detail = _navigationPage = new NavigationPage(new Issue28130_DetailPage(pageTitle) { AutomationId = pageTitle }); } ContentPage CreateFlyoutContent() { - var flyoutContent = new ContentPage() { Title = "Menu"}; + var flyoutContent = new ContentPage() { Title = "Menu" }; var layout = new VerticalStackLayout(); - var navigateButton = new Button() { Text = "Navigate to Page 2", AutomationId = "NavigateButton"}; + var navigateButton = new Button() { Text = "Navigate to Page 2", AutomationId = "NavigateButton" }; navigateButton.Clicked += (s, e) => _navigationPage.PushAsync(new Issue28130_Page1()); layout.Add(navigateButton); flyoutContent.Content = layout; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28130_shell.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28130_shell.cs index 7d7adac12c32..c6163f16aafa 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28130_shell.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28130_shell.cs @@ -1,9 +1,9 @@ namespace Maui.Controls.Sample.Issues { - [Issue(IssueTracker.None,28130, "[Windows] Shell Flyout Menu Icon disappears from Window Title Bar after Navigation", PlatformAffected.UWP)] + [Issue(IssueTracker.None, 28130, "[Windows] Shell Flyout Menu Icon disappears from Window Title Bar after Navigation", PlatformAffected.UWP)] public class Issue28130_Shell : TestShell { - + protected override void Init() { Routing.RegisterRoute(nameof(Issue28130_Page1), typeof(Issue28130_Page1)); @@ -17,7 +17,7 @@ protected override void Init() Button CreateShellItemTemplate() { - var navigateButton = new Button() { Text = "Navigate to Page 2" ,AutomationId = "NavigateButton"}; + var navigateButton = new Button() { Text = "Navigate to Page 2", AutomationId = "NavigateButton" }; navigateButton.Clicked += NavigateButton_Clicked; return navigateButton; } 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/Issue28838.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28838.cs index 89eb6fafb853..2e2cccb38dcc 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28838.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28838.cs @@ -2,74 +2,74 @@ [Issue(IssueTracker.Github, 28838, "Incorrect Text Color Applied to Selected Tab in TabbedPage on Android", PlatformAffected.Android)] public class Issue28838 : TabbedPage { - public Issue28838() - { - // Set the UnselectedTabColor property , it should be applied only to the unselected tab. - UnselectedTabColor = Colors.Red; + public Issue28838() + { + // Set the UnselectedTabColor property , it should be applied only to the unselected tab. + UnselectedTabColor = Colors.Red; - // Add tabs (pages) - Children.Add(new Issue28838Tab1()); - Children.Add(new Issue28838Tab2()); - Children.Add(new Issue28838Tab3()); - } + // Add tabs (pages) + Children.Add(new Issue28838Tab1()); + Children.Add(new Issue28838Tab2()); + Children.Add(new Issue28838Tab3()); + } } public class Issue28838Tab1 : ContentPage { - public Issue28838Tab1() - { - Title = "Tab 1"; - var verticalStackLayout = new VerticalStackLayout - { - VerticalOptions = LayoutOptions.Center, - Children = { - new Label - { - HorizontalOptions = LayoutOptions.Center, - Text = "Tab 1", - AutomationId = "Tab1" - }, - } - }; - Content = verticalStackLayout; - } + public Issue28838Tab1() + { + Title = "Tab 1"; + var verticalStackLayout = new VerticalStackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + new Label + { + HorizontalOptions = LayoutOptions.Center, + Text = "Tab 1", + AutomationId = "Tab1" + }, + } + }; + Content = verticalStackLayout; + } } public class Issue28838Tab2 : ContentPage { - public Issue28838Tab2() - { - Title = "Tab 2"; - var verticalStackLayout = new VerticalStackLayout - { - VerticalOptions = LayoutOptions.Center, - Children = { - new Label - { - HorizontalOptions = LayoutOptions.Center, - Text = "Tab 2" - } - } - }; - Content = verticalStackLayout; - } + public Issue28838Tab2() + { + Title = "Tab 2"; + var verticalStackLayout = new VerticalStackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + new Label + { + HorizontalOptions = LayoutOptions.Center, + Text = "Tab 2" + } + } + }; + Content = verticalStackLayout; + } } public class Issue28838Tab3 : ContentPage { - public Issue28838Tab3() - { - Title = "Tab 3"; - var verticalStackLayout = new VerticalStackLayout - { - VerticalOptions = LayoutOptions.Center, - Children = { - new Label - { - HorizontalOptions = LayoutOptions.Center, - Text = "Tab 3" - } - } - }; - Content = verticalStackLayout; - } + public Issue28838Tab3() + { + Title = "Tab 3"; + var verticalStackLayout = new VerticalStackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + new Label + { + HorizontalOptions = LayoutOptions.Center, + Text = "Tab 3" + } + } + }; + Content = verticalStackLayout; + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue7144.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue7144.cs index 702dbfd84ab2..6cd3225f36f3 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue7144.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue7144.cs @@ -49,7 +49,8 @@ public Issue7144() HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; - label.SetBinding(Label.TextProperty, ".");; + label.SetBinding(Label.TextProperty, "."); + ; stackLayout.Children.Add(label); 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 f028ca257b72..2737bb66aef5 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 @@ -31,17 +31,17 @@ public void HeaderFooterStringWorks() } #if IOS || ANDROID [Test] - [Category(UITestCategories.CollectionView)] - public async Task HeaderFooterViewWorks() - { - // Navigate to the selection galleries - VisitInitialGallery("Header Footer"); + [Category(UITestCategories.CollectionView)] + public async Task 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"); // Now let's add items until the footer goes out of the screen // and then remove them all and verify the footer is visible again (#29137) @@ -49,14 +49,14 @@ public async Task HeaderFooterViewWorks() while (--i > 0) { App.WaitForElement("Add 2 Items").Tap(); - App.ScrollDownTo("Add 2 Items", "CV"); + App.ScrollDownTo("Add 2 Items", "CV"); } - App.WaitForElement("Clear All Items").Tap(); - await Task.Delay(300); + App.WaitForElement("Clear All Items").Tap(); + await Task.Delay(300); - ClassicAssert.IsTrue(App.WaitForElement("This Is A Footer").IsDisplayed()); - } + ClassicAssert.IsTrue(App.WaitForElement("This Is A Footer").IsDisplayed()); + } [Test] [Category(UITestCategories.CollectionView)] @@ -70,7 +70,7 @@ public void HeaderFooterHorizontalViewWorks() // Verify the header is visible App.WaitForElement("This Is A Header"); - + // Scroll right to ensure the footer is visible and positioned at the end for (int i = 0; i < 5; i++) { @@ -81,60 +81,60 @@ public void HeaderFooterHorizontalViewWorks() 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/FeatureMatrix/CollectionView_EmptyViewFeatureTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_EmptyViewFeatureTests.cs index d6a2564365cd..bb67ddf55b56 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_EmptyViewFeatureTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_EmptyViewFeatureTests.cs @@ -153,7 +153,7 @@ public void ValidateEmptyViewStringDisplayedSetFirst_AndItemSourceEmptyGroupedLi App.Tap("Apply"); App.WaitForElement("No Items Available(String)"); } - + [Test] [Category(UITestCategories.CollectionView)] public void ValidateEmptyViewStringDisplayed_GroupedListSetFirst() @@ -311,7 +311,7 @@ public void ValidateCustomEmptyViewDisplayedSetFirst_AndGroupedList() App.Tap("Apply"); App.WaitForNoElement("No Items Available(Grid View)"); } - + [Test] [Category(UITestCategories.CollectionView)] public void ValidateCustomEmptyViewSizeDisplayed_AndEmptyObservableCollectionSetFirst() @@ -431,7 +431,7 @@ public void ValidateCustomEmptyViewSizeDisplayedSetFirst_AndGroupedList() App.Tap("Apply"); App.WaitForNoElement("Custom Empty View (Sized)"); } - + [Test] [Category(UITestCategories.CollectionView)] public void ValidateEmptyViewStringDisplayed_AndEmptyViewTemplate() @@ -1003,22 +1003,22 @@ public void ValidateEmptyViewSize() App.Tap("Apply"); var emptyViewBounds = App.WaitForElement("EmptyViewLabel").GetRect(); Assert.That(emptyViewBounds, Is.Not.Null); - #if ANDROID +#if ANDROID int expectedWidth = 788; int expectedHeight = 525; - #elif MACCATALYST +#elif MACCATALYST int expectedWidth = 235; int expectedHeight = 150; - #else +#else int expectedWidth = 300; int expectedHeight = 200; - #endif +#endif Assert.That(emptyViewBounds.Width, Is.EqualTo(expectedWidth).Within(5)); - Assert.That(emptyViewBounds.Height, Is.EqualTo(expectedHeight).Within(5)); + Assert.That(emptyViewBounds.Height, Is.EqualTo(expectedHeight).Within(5)); } #if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST -//When setting HeightRequest and WidthRequest in the EmptyViewTemplate, as the values were not applied, preventing proper resizing. Issue Link: https://github.com/dotnet/maui/issues/28605 + //When setting HeightRequest and WidthRequest in the EmptyViewTemplate, as the values were not applied, preventing proper resizing. Issue Link: https://github.com/dotnet/maui/issues/28605 [Test] [Category(UITestCategories.CollectionView)] public void ValidateEmptyViewTemplateSize() @@ -1030,18 +1030,18 @@ public void ValidateEmptyViewTemplateSize() App.WaitForElement("Apply"); App.Tap("Apply"); var emptyViewBounds = App.WaitForElement("EmptyViewTemplateLabel").GetRect(); - #if ANDROID +#if ANDROID int expectedWidth = 788; int expectedHeight = 525; - #elif MACCATALYST +#elif MACCATALYST int expectedWidth = 235; int expectedHeight = 150; - #else +#else int expectedWidth = 300; int expectedHeight = 200; - #endif +#endif Assert.That(emptyViewBounds.Width, Is.EqualTo(expectedWidth).Within(5)); - Assert.That(emptyViewBounds.Height, Is.EqualTo(expectedHeight).Within(5)); + Assert.That(emptyViewBounds.Height, Is.EqualTo(expectedHeight).Within(5)); } #endif diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_HeaderFooterFeatureTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_HeaderFooterFeatureTests.cs index 9a2268e06fe7..5682d1edb974 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_HeaderFooterFeatureTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_HeaderFooterFeatureTests.cs @@ -10,10 +10,10 @@ public class CollectionView_HeaderFooterFeatureTests : UITest public const string Apply = "Apply"; public const string EmptyViewString = "EmptyViewString"; public const string HeaderString = "HeaderString"; - public const string HeaderGrid = "HeaderGrid"; + public const string HeaderGrid = "HeaderGrid"; public const string FooterString = "FooterString"; public const string FooterGrid = "FooterGrid"; - public const string HeaderTemplateGrid = "HeaderTemplateGrid"; + public const string HeaderTemplateGrid = "HeaderTemplateGrid"; public const string FooterTemplateGrid = "FooterTemplateGrid"; public const string ItemsSourceGroupedList = "ItemsSourceGroupedList"; public const string ItemsSourceObservableCollection5 = "ItemsSourceObservableCollection5"; diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_ScrollingFeatureTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_ScrollingFeatureTests.cs index 3e91468dfce8..0181c7b65ee9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_ScrollingFeatureTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_ScrollingFeatureTests.cs @@ -511,8 +511,8 @@ public void VerifyKeepItemsInViewWithGroupedListWhenHorizontalGrid() #endif #if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS -//Scroll mode "KeepLastItemInView" does not keep the last item at the end of the displayed list when adding new items Issue Link: https://github.com/dotnet/maui/issues/28716 -//KeepLastItemInView Does Not Scroll to Last Item When Adding Items at Top, Instead Scrolls to SecondLast Item : https://github.com/dotnet/maui/issues/29207 + //Scroll mode "KeepLastItemInView" does not keep the last item at the end of the displayed list when adding new items Issue Link: https://github.com/dotnet/maui/issues/28716 + //KeepLastItemInView Does Not Scroll to Last Item When Adding Items at Top, Instead Scrolls to SecondLast Item : https://github.com/dotnet/maui/issues/29207 [Test] [Category(UITestCategories.CollectionView)] @@ -580,7 +580,7 @@ public void VerifyKeepLastItemInViewWithObservableListWhenHorizontalGrid() App.WaitForElement("Cabbage"); } -#if TEST_FAILS_ON_ANDROID +#if TEST_FAILS_ON_ANDROID //[Android] ArgumentOutOfRangeException Occurs with KeepLastItemInView for Grouped List Issue Link: https://github.com/dotnet/maui/issues/29153 [Test] [Category(UITestCategories.CollectionView)] @@ -666,7 +666,7 @@ public void VerifyKeepLastItemInViewWithGroupedListWhenHorizontalGrid() #endif #endif -#if TEST_FAILS_ON_ANDROID +#if TEST_FAILS_ON_ANDROID //[Android] KeepScrollOffset doesn't not works as expected when new items are added in CollectionView Issue Link: https://github.com/dotnet/maui/issues/29131 [Test] [Category(UITestCategories.CollectionView)] diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/GroupingFeatureTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/GroupingFeatureTests.cs index c50e80417451..85ca89b241b9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/GroupingFeatureTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/GroupingFeatureTests.cs @@ -1,594 +1,594 @@ using NUnit.Framework; using UITest.Appium; using UITest.Core; - + namespace Microsoft.Maui.TestCases.Tests; public class GroupingFeatureTests : UITest { - public const string GroupingFeatureMatrix = "CollectionView Feature Matrix"; - public const string Options = "Options"; - public const string Apply = "Apply"; - public const string GroupHeaderTemplateGrid = "GroupHeaderTemplateGrid"; - public const string GroupFooterTemplateGrid = "GroupFooterTemplateGrid"; - public const string IsGroupedTrue = "IsGroupedTrue"; - public const string ItemsSourceGroupedList = "ItemsSourceGroupedList"; - public const string FooterString = "FooterString"; - public const string HeaderString = "HeaderString"; - public const string ItemTemplateBasic = "ItemTemplateBasic"; - public const string ItemsLayoutHorizontalList = "ItemsLayoutHorizontalList"; - public const string ItemsLayoutHorizontalGrid = "ItemsLayoutHorizontalGrid"; - public const string ItemsLayoutVerticalGrid = "ItemsLayoutVerticalGrid"; - - - public GroupingFeatureTests(TestDevice device) - : base(device) - { - } - protected override void FixtureSetup() - { - base.FixtureSetup(); - App.NavigateToGallery(GroupingFeatureMatrix); - } - - [Test, Order(1)] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupFooterTemplate_WithFooterString() - { - App.WaitForElement("GroupingButton"); - App.Tap("GroupingButton"); - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(FooterString); - App.Tap(FooterString); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("CollectionView Footer(String)"); - App.WaitForNoElement("GroupFooterTemplate"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupFooterTemplate_WithHeaderString() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(HeaderString); - App.Tap(HeaderString); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("CollectionView Header(String)"); - App.WaitForNoElement("GroupFooterTemplate"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupFooterTemplate_WithBasicItemTemplate() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemTemplateBasic); - App.Tap(ItemTemplateBasic); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Apple"); - App.WaitForElement("Banana"); - App.WaitForNoElement("GroupFooterTemplate"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderTemplate_WithFooterString() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(FooterString); - App.Tap(FooterString); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("CollectionView Footer(String)"); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForNoElement("GroupHeaderTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderTemplate_WithHeaderString() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(HeaderString); - App.Tap(HeaderString); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("CollectionView Header(String)"); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForNoElement("GroupHeaderTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderTemplate_WithBasicItemTemplate() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(ItemTemplateBasic); - App.Tap(ItemTemplateBasic); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Apple"); - App.WaitForElement("Banana"); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForNoElement("GroupHeaderTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithObservableCollection() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForNoElement("GroupHeaderTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithItemSourceNull() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement("ItemsSourceNone"); - App.Tap("ItemsSourceNone"); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGroupedFalse_WithItemSourceObservableCollection() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Apple"); - App.WaitForElement("Banana"); - App.WaitForNoElement("Fruits"); - App.WaitForNoElement("Vegetables"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGroupedFalse_WithHeaderAndFooterString() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(HeaderString); - App.Tap(HeaderString); - App.WaitForElement(FooterString); - App.Tap(FooterString); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("CollectionView Header(String)"); - App.WaitForElement("CollectionView Footer(String)"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGroupedFalse_WithBasicItemTemplate() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemTemplateBasic); - App.Tap(ItemTemplateBasic); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Apple"); - App.WaitForElement("Banana"); - } - + public const string GroupingFeatureMatrix = "CollectionView Feature Matrix"; + public const string Options = "Options"; + public const string Apply = "Apply"; + public const string GroupHeaderTemplateGrid = "GroupHeaderTemplateGrid"; + public const string GroupFooterTemplateGrid = "GroupFooterTemplateGrid"; + public const string IsGroupedTrue = "IsGroupedTrue"; + public const string ItemsSourceGroupedList = "ItemsSourceGroupedList"; + public const string FooterString = "FooterString"; + public const string HeaderString = "HeaderString"; + public const string ItemTemplateBasic = "ItemTemplateBasic"; + public const string ItemsLayoutHorizontalList = "ItemsLayoutHorizontalList"; + public const string ItemsLayoutHorizontalGrid = "ItemsLayoutHorizontalGrid"; + public const string ItemsLayoutVerticalGrid = "ItemsLayoutVerticalGrid"; + + + public GroupingFeatureTests(TestDevice device) + : base(device) + { + } + protected override void FixtureSetup() + { + base.FixtureSetup(); + App.NavigateToGallery(GroupingFeatureMatrix); + } + + [Test, Order(1)] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupFooterTemplate_WithFooterString() + { + App.WaitForElement("GroupingButton"); + App.Tap("GroupingButton"); + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(FooterString); + App.Tap(FooterString); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("CollectionView Footer(String)"); + App.WaitForNoElement("GroupFooterTemplate"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupFooterTemplate_WithHeaderString() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(HeaderString); + App.Tap(HeaderString); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("CollectionView Header(String)"); + App.WaitForNoElement("GroupFooterTemplate"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupFooterTemplate_WithBasicItemTemplate() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemTemplateBasic); + App.Tap(ItemTemplateBasic); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Apple"); + App.WaitForElement("Banana"); + App.WaitForNoElement("GroupFooterTemplate"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderTemplate_WithFooterString() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(FooterString); + App.Tap(FooterString); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("CollectionView Footer(String)"); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForNoElement("GroupHeaderTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderTemplate_WithHeaderString() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(HeaderString); + App.Tap(HeaderString); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("CollectionView Header(String)"); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForNoElement("GroupHeaderTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderTemplate_WithBasicItemTemplate() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(ItemTemplateBasic); + App.Tap(ItemTemplateBasic); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Apple"); + App.WaitForElement("Banana"); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForNoElement("GroupHeaderTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithObservableCollection() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForNoElement("GroupHeaderTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithItemSourceNull() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement("ItemsSourceNone"); + App.Tap("ItemsSourceNone"); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGroupedFalse_WithItemSourceObservableCollection() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Apple"); + App.WaitForElement("Banana"); + App.WaitForNoElement("Fruits"); + App.WaitForNoElement("Vegetables"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGroupedFalse_WithHeaderAndFooterString() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(HeaderString); + App.Tap(HeaderString); + App.WaitForElement(FooterString); + App.Tap(FooterString); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("CollectionView Header(String)"); + App.WaitForElement("CollectionView Footer(String)"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGroupedFalse_WithBasicItemTemplate() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemTemplateBasic); + App.Tap(ItemTemplateBasic); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Apple"); + App.WaitForElement("Banana"); + } + #if TEST_FAILS_ON_WINDOWS // [Windows] NullReferenceException thrown When Toggling IsGrouped to True in ObservableCollection Binding Issue Link: https://github.com/dotnet/maui/issues/28824 - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGrouped_WithFooterString() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(FooterString); - App.Tap(FooterString); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("CollectionView Footer(String)"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGrouped_WithHeaderString() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(HeaderString); - App.Tap(HeaderString); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("CollectionView Header(String)"); - } + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGrouped_WithFooterString() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(FooterString); + App.Tap(FooterString); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("CollectionView Footer(String)"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGrouped_WithHeaderString() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(HeaderString); + App.Tap(HeaderString); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("CollectionView Header(String)"); + } #endif - + #if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_IOS -//Test fails on CV2 , GroupHeader and GroupFooter template is not visible Issue Link: https://github.com/dotnet/maui/issues/28509 -//Test fails on CV2 , ItemsLayout does not change Issue Link: https://github.com/dotnet/maui/issues/28656 - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithVerticalListAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.WaitForElement("Carrot"); - App.WaitForElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("GroupHeaderTemplate"); - App.WaitForElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGrouped_WithGroupHeaderAndGroupFooterTemplate() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("GroupHeaderTemplate"); - App.WaitForElement("GroupFooterTemplate"); - App.WaitForElement("GroupHeaderTemplate"); - App.WaitForElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGroupedTrue_WithItemSourceGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Fruits"); - App.WaitForElement("Vegetables"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGrouped_WithVerticalListAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Fruits"); - App.WaitForElement("Apple"); - App.WaitForElement("Carrot"); - App.WaitForElement("Vegetables"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGroupedTrue_WithBasicTemplateWhenGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemTemplateBasic); - App.Tap(ItemTemplateBasic); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Apple"); - App.WaitForElement("Banana"); - App.WaitForElement("Fruits"); - App.WaitForElement("Vegetables"); - } - + //Test fails on CV2 , GroupHeader and GroupFooter template is not visible Issue Link: https://github.com/dotnet/maui/issues/28509 + //Test fails on CV2 , ItemsLayout does not change Issue Link: https://github.com/dotnet/maui/issues/28656 + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithVerticalListAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.WaitForElement("Carrot"); + App.WaitForElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("GroupHeaderTemplate"); + App.WaitForElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGrouped_WithGroupHeaderAndGroupFooterTemplate() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("GroupHeaderTemplate"); + App.WaitForElement("GroupFooterTemplate"); + App.WaitForElement("GroupHeaderTemplate"); + App.WaitForElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGroupedTrue_WithItemSourceGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Fruits"); + App.WaitForElement("Vegetables"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGrouped_WithVerticalListAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Fruits"); + App.WaitForElement("Apple"); + App.WaitForElement("Carrot"); + App.WaitForElement("Vegetables"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGroupedTrue_WithBasicTemplateWhenGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemTemplateBasic); + App.Tap(ItemTemplateBasic); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Apple"); + App.WaitForElement("Banana"); + App.WaitForElement("Fruits"); + App.WaitForElement("Vegetables"); + } + #if TEST_FAILS_ON_WINDOWS -//ItemsLayout does not change its default value on windows Issue Link: https://github.com/dotnet/maui/issues/27946 - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalListAndObservableCollection() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsLayoutHorizontalList); - App.Tap(ItemsLayoutHorizontalList); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.ScrollRight("CollectionViewControl"); - App.WaitForElement("Carrot"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalGridAndObservableCollection() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsLayoutHorizontalGrid); - App.Tap(ItemsLayoutHorizontalGrid); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.ScrollRight("CollectionViewControl"); - App.WaitForElement("Carrot"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithVerticalGridAndObservableCollection() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsLayoutVerticalGrid); - App.Tap(ItemsLayoutVerticalGrid); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.WaitForElement("Carrot"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithVerticalListAndObservableCollection() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForNoElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.WaitForElement("Carrot"); - App.WaitForNoElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGrouped_WithHorizontalListAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsLayoutHorizontalList); - App.Tap(ItemsLayoutHorizontalList); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Fruits"); - App.WaitForElement("Apple"); - App.ScrollRight("CollectionViewControl"); - App.WaitForElement("Carrot"); - App.WaitForElement("Vegetables"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGrouped_WithHorizontalGridAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsLayoutHorizontalGrid); - App.Tap(ItemsLayoutHorizontalGrid); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Fruits"); - App.WaitForElement("Apple"); - App.ScrollRight("CollectionViewControl"); - App.WaitForElement("Carrot"); - App.WaitForElement("Vegetables"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalListAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsLayoutHorizontalList); - App.Tap(ItemsLayoutHorizontalList); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); - App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); - App.WaitForElement("Carrot"); - App.WaitForElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalGridAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsLayoutHorizontalGrid); - App.Tap(ItemsLayoutHorizontalGrid); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); - App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); - App.WaitForElement("Carrot"); - App.WaitForElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyGroupHeaderAndFooterTemplate_WithVerticalGridAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(GroupHeaderTemplateGrid); - App.Tap(GroupHeaderTemplateGrid); - App.WaitForElement(GroupFooterTemplateGrid); - App.Tap(GroupFooterTemplateGrid); - App.WaitForElement(ItemsLayoutVerticalGrid); - App.Tap(ItemsLayoutVerticalGrid); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("GroupHeaderTemplate"); - App.WaitForElement("Apple"); - App.WaitForElement("Carrot"); - App.WaitForElement("GroupFooterTemplate"); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyIsGrouped_WithVerticalGridAndGroupedList() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsLayoutVerticalGrid); - App.Tap(ItemsLayoutVerticalGrid); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - App.WaitForElement("Fruits"); - App.WaitForElement("Apple"); - App.WaitForElement("Carrot"); - App.WaitForElement("Vegetables"); - } + //ItemsLayout does not change its default value on windows Issue Link: https://github.com/dotnet/maui/issues/27946 + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalListAndObservableCollection() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsLayoutHorizontalList); + App.Tap(ItemsLayoutHorizontalList); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.ScrollRight("CollectionViewControl"); + App.WaitForElement("Carrot"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalGridAndObservableCollection() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsLayoutHorizontalGrid); + App.Tap(ItemsLayoutHorizontalGrid); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.ScrollRight("CollectionViewControl"); + App.WaitForElement("Carrot"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithVerticalGridAndObservableCollection() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsLayoutVerticalGrid); + App.Tap(ItemsLayoutVerticalGrid); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.WaitForElement("Carrot"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithVerticalListAndObservableCollection() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForNoElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.WaitForElement("Carrot"); + App.WaitForNoElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGrouped_WithHorizontalListAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsLayoutHorizontalList); + App.Tap(ItemsLayoutHorizontalList); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Fruits"); + App.WaitForElement("Apple"); + App.ScrollRight("CollectionViewControl"); + App.WaitForElement("Carrot"); + App.WaitForElement("Vegetables"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGrouped_WithHorizontalGridAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsLayoutHorizontalGrid); + App.Tap(ItemsLayoutHorizontalGrid); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Fruits"); + App.WaitForElement("Apple"); + App.ScrollRight("CollectionViewControl"); + App.WaitForElement("Carrot"); + App.WaitForElement("Vegetables"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalListAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsLayoutHorizontalList); + App.Tap(ItemsLayoutHorizontalList); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); + App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); + App.WaitForElement("Carrot"); + App.WaitForElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithHorizontalGridAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsLayoutHorizontalGrid); + App.Tap(ItemsLayoutHorizontalGrid); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); + App.ScrollRight("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500); + App.WaitForElement("Carrot"); + App.WaitForElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyGroupHeaderAndFooterTemplate_WithVerticalGridAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(GroupHeaderTemplateGrid); + App.Tap(GroupHeaderTemplateGrid); + App.WaitForElement(GroupFooterTemplateGrid); + App.Tap(GroupFooterTemplateGrid); + App.WaitForElement(ItemsLayoutVerticalGrid); + App.Tap(ItemsLayoutVerticalGrid); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("GroupHeaderTemplate"); + App.WaitForElement("Apple"); + App.WaitForElement("Carrot"); + App.WaitForElement("GroupFooterTemplate"); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyIsGrouped_WithVerticalGridAndGroupedList() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsLayoutVerticalGrid); + App.Tap(ItemsLayoutVerticalGrid); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("Fruits"); + App.WaitForElement("Apple"); + App.WaitForElement("Carrot"); + App.WaitForElement("Vegetables"); + } #endif #endif - + #if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS //CollectionView Displays Blank UI When Changing IsGrouped and ItemsSourceType Issue Link: https://github.com/dotnet/maui/issues/28826 //[Windows] NullReferenceException thrown When Toggling IsGrouped to True in ObservableCollection Binding: https://github.com/dotnet/maui/issues/28824 @@ -733,93 +733,93 @@ public void VerifyIsGrouped_WithGroupHeaderAndFooterTemplateAndObservableCollect App.WaitForElement("Carrot"); } #endif - + #if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_IOS -//CanMixGroups Set to False Still Allows Reordering Between Groups in CollectionView on Catalyst Issue Link : https://github.com/dotnet/maui/issues/28530 -//Test fails on CV2 . GroupHeader and GroupFooter template is not visible Issue Link: https://github.com/dotnet/maui/issues/28509 -//.NET MAUI CollectionView does not reorder when grouped on windows Issue Link: https://github.com/dotnet/maui/issues/13027 - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyCanMixGroupsFalseWithCanReorderItems() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement("CanReorderItemsTrue"); - App.Tap("CanReorderItemsTrue"); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - var initialY = App.WaitForElement("Apple").GetRect().Y; - App.DragAndDrop("Apple", "Potato"); - var newY = App.WaitForElement("Carrot").GetRect().Y; - Assert.That(newY, Is.GreaterThan(initialY), "The Y position of 'Carrot' should be greater than Apple after the drag-and-drop operation."); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyCanMixGroupsTrueWithCanReorderItems() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement("CanMixGroupsTrue"); - App.Tap("CanMixGroupsTrue"); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement("CanReorderItemsTrue"); - App.Tap("CanReorderItemsTrue"); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - var initialY = App.WaitForElement("Apple").GetRect().Y; - App.DragAndDrop("Apple", "Potato"); - var newY = App.WaitForElement("Apple").GetRect().Y; - Assert.That(newY, Is.GreaterThan(initialY), "The Y position of 'Apple' should be greater after the drag-and-drop operation."); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyCanReorderItemsTrueWithCanMixGroups() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement("CanReorderItemsTrue"); - App.Tap("CanReorderItemsTrue"); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement("CanMixGroupsTrue"); - App.Tap("CanMixGroupsTrue"); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - var initialY = App.WaitForElement("Apple").GetRect().Y; - App.DragAndDrop("Apple", "Potato"); - var newY = App.WaitForElement("Apple").GetRect().Y; - Assert.That(newY, Is.GreaterThan(initialY), "The Y position of 'Apple' should be greater after the drag-and-drop operation."); - } - - [Test] - [Category(UITestCategories.CollectionView)] - public void VerifyCanReorderItemsFalseWithCanMixGroups() - { - App.WaitForElement(Options); - App.Tap(Options); - App.WaitForElement(ItemsSourceGroupedList); - App.Tap(ItemsSourceGroupedList); - App.WaitForElement("CanMixGroupsTrue"); - App.Tap("CanMixGroupsTrue"); - App.WaitForElement(IsGroupedTrue); - App.Tap(IsGroupedTrue); - App.WaitForElement(Apply); - App.Tap(Apply); - var initialY = App.WaitForElement("Apple").GetRect().Y; - App.DragAndDrop("Apple", "Potato"); - var newY = App.WaitForElement("Apple").GetRect().Y; - Assert.That(newY, Is.EqualTo(initialY), "The Y position of 'Apple' should be Same Value after the drag-and-drop operation."); - } + //CanMixGroups Set to False Still Allows Reordering Between Groups in CollectionView on Catalyst Issue Link : https://github.com/dotnet/maui/issues/28530 + //Test fails on CV2 . GroupHeader and GroupFooter template is not visible Issue Link: https://github.com/dotnet/maui/issues/28509 + //.NET MAUI CollectionView does not reorder when grouped on windows Issue Link: https://github.com/dotnet/maui/issues/13027 + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyCanMixGroupsFalseWithCanReorderItems() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement("CanReorderItemsTrue"); + App.Tap("CanReorderItemsTrue"); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + var initialY = App.WaitForElement("Apple").GetRect().Y; + App.DragAndDrop("Apple", "Potato"); + var newY = App.WaitForElement("Carrot").GetRect().Y; + Assert.That(newY, Is.GreaterThan(initialY), "The Y position of 'Carrot' should be greater than Apple after the drag-and-drop operation."); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyCanMixGroupsTrueWithCanReorderItems() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement("CanMixGroupsTrue"); + App.Tap("CanMixGroupsTrue"); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement("CanReorderItemsTrue"); + App.Tap("CanReorderItemsTrue"); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + var initialY = App.WaitForElement("Apple").GetRect().Y; + App.DragAndDrop("Apple", "Potato"); + var newY = App.WaitForElement("Apple").GetRect().Y; + Assert.That(newY, Is.GreaterThan(initialY), "The Y position of 'Apple' should be greater after the drag-and-drop operation."); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyCanReorderItemsTrueWithCanMixGroups() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement("CanReorderItemsTrue"); + App.Tap("CanReorderItemsTrue"); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement("CanMixGroupsTrue"); + App.Tap("CanMixGroupsTrue"); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + var initialY = App.WaitForElement("Apple").GetRect().Y; + App.DragAndDrop("Apple", "Potato"); + var newY = App.WaitForElement("Apple").GetRect().Y; + Assert.That(newY, Is.GreaterThan(initialY), "The Y position of 'Apple' should be greater after the drag-and-drop operation."); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void VerifyCanReorderItemsFalseWithCanMixGroups() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ItemsSourceGroupedList); + App.Tap(ItemsSourceGroupedList); + App.WaitForElement("CanMixGroupsTrue"); + App.Tap("CanMixGroupsTrue"); + App.WaitForElement(IsGroupedTrue); + App.Tap(IsGroupedTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + var initialY = App.WaitForElement("Apple").GetRect().Y; + App.DragAndDrop("Apple", "Potato"); + var newY = App.WaitForElement("Apple").GetRect().Y; + Assert.That(newY, Is.EqualTo(initialY), "The Y position of 'Apple' should be Same Value after the drag-and-drop operation."); + } #endif } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14497.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14497.cs index 825c93d804c0..baf470132526 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14497.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14497.cs @@ -18,6 +18,6 @@ public void DynamicallyQueryNotUpdating() App.WaitForElement(ChangeSearchText); App.Tap(ChangeSearchText); var searchHandlerString = App.GetShellSearchHandler().GetText(); - Assert.That(searchHandlerString, Is.EqualTo("Hello World")); + Assert.That(searchHandlerString, Is.EqualTo("Hello World")); } } \ No newline at end of file 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/Issue19831.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19831.cs index 3b7366dc6d9c..02e5237c904d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19831.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19831.cs @@ -13,7 +13,7 @@ public Issue19831(TestDevice device) : base(device) { } - [Test] + [Test] [Category(UITestCategories.ListView)] public void ActionModeMenuShouldNotBeVisibleAfterSwitchingTab() { 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/Issue27803.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27803.cs index 23463e41c0d1..5331321340b4 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27803.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27803.cs @@ -1,4 +1,4 @@ -#if TEST_FAILS_ON_CATALYST //https://github.com/dotnet/maui/issues/20904 +#if TEST_FAILS_ON_CATALYST //https://github.com/dotnet/maui/issues/20904 using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -13,15 +13,15 @@ public Issue27803(TestDevice device) : base(device) public override string Issue => "DatePicker default format on iOS"; - [Test] - [Category(UITestCategories.DatePicker)] - public void DatePickerTextColorShouldUpdate() - { - App.WaitForElement("MauiButton"); + [Test] + [Category(UITestCategories.DatePicker)] + public void DatePickerTextColorShouldUpdate() + { + App.WaitForElement("MauiButton"); - App.Tap("MauiButton"); + App.Tap("MauiButton"); - VerifyScreenshot(); - } + VerifyScreenshot(); + } } #endif \ No newline at end of file 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 497cfc4f6964..2e7fec6985f5 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28098.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28098.cs @@ -5,23 +5,23 @@ 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"); + [Test] + [Category(UITestCategories.Picker)] + public void BlankScreenOnNavigationBack() + { + App.WaitForElement("Button"); + App.Tap("Button"); + App.WaitForElement("BackButton"); + App.Tap("BackButton"); #if WINDOWS VerifyScreenshot(cropBottom: 250); #else - VerifyScreenshot(); + VerifyScreenshot(); #endif - } + } } \ 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/TestCases.Shared.Tests/Tests/Issues/Issue28838.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28838.cs index 143b675e018e..59ba07e8abcd 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28838.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28838.cs @@ -5,15 +5,15 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue28838 : _IssuesUITest { - public Issue28838(TestDevice device) : base(device) { } + public Issue28838(TestDevice device) : base(device) { } - public override string Issue => "Incorrect Text Color Applied to Selected Tab in TabbedPage on Android"; + public override string Issue => "Incorrect Text Color Applied to Selected Tab in TabbedPage on Android"; - [Test] - [Category(UITestCategories.TabbedPage)] - public void DefaultSelectedTabTextColorShouldApplyProperly() - { - App.WaitForElement("Tab1"); - VerifyScreenshot(); - } + [Test] + [Category(UITestCategories.TabbedPage)] + public void DefaultSelectedTabTextColorShouldApplyProperly() + { + App.WaitForElement("Tab1"); + VerifyScreenshot(); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28930.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28930.cs index e482d8f6d52b..0000f13b2643 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28930.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28930.cs @@ -20,9 +20,9 @@ public void LineBreakModeInCarouselViewShouldWork() App.WaitForElement("dotnetbot2"); App.WaitForElement("dotnetbot3"); App.WaitForElement("dotnetbot4"); - + App.ScrollRight("MyCarousel", swipePercentage: 0.9, swipeSpeed: 200); - + Assert.That(App.WaitForElementTillPageNavigationSettled("Item 2").GetText(), Is.EqualTo("Item 2")); } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/ShellInsets.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/ShellInsets.cs index 46bc62808af5..4c973b9b0e87 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/ShellInsets.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/ShellInsets.cs @@ -129,7 +129,7 @@ public void PaddingWithoutSafeArea() Assert.That(zeroPadding, Is.EqualTo(1)); App.WaitForElement(ResetButton); App.Tap(ResetButton); - App.WaitForElement(PaddingEntry); + App.WaitForElement(PaddingEntry); App.EnterText(PaddingEntry, "100"); App.WaitForElement(PaddingTest); App.Tap(PaddingTest); 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/Controls/tests/Xaml.UnitTests/ServiceProviderTests.xaml.cs b/src/Controls/tests/Xaml.UnitTests/ServiceProviderTests.xaml.cs index ecc50787a573..3e43cf27f103 100644 --- a/src/Controls/tests/Xaml.UnitTests/ServiceProviderTests.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/ServiceProviderTests.xaml.cs @@ -68,7 +68,7 @@ public class Tests [TearDown] public void TearDown() => DispatcherProvider.SetCurrent(null); [Test] - public void TestServiceProviders([Values]bool useCompiledXaml) + public void TestServiceProviders([Values] bool useCompiledXaml) { var page = new ServiceProviderTests(useCompiledXaml); 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/ImageSources/iOS/ImageSourceExtensions.cs b/src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs index 56d7e8408d94..adc17c4890e7 100644 --- a/src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs +++ b/src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs @@ -52,8 +52,8 @@ public static partial class ImageSourceExtensions imagesize.Width, imagesize.Height)); - // Using UIRenderingMode.Automatic when the FontImageSource color is null (where 'Automatic' adapts based on the context and properly applies color) - // and UIRenderingMode.AlwaysOriginal when the FontImageSource color is specified ensures the given color is applied correctly + // Using UIRenderingMode.Automatic when the FontImageSource color is null (where 'Automatic' adapts based on the context and properly applies color) + // and UIRenderingMode.AlwaysOriginal when the FontImageSource color is specified ensures the given color is applied correctly }).ImageWithRenderingMode(imageSource.Color == null ? UIImageRenderingMode.Automatic : UIImageRenderingMode.AlwaysOriginal); } 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/MauiPageControl.cs b/src/Core/src/Platform/Windows/MauiPageControl.cs index 6ef6ca0e4627..46f6f28d2894 100644 --- a/src/Core/src/Platform/Windows/MauiPageControl.cs +++ b/src/Core/src/Platform/Windows/MauiPageControl.cs @@ -37,7 +37,7 @@ public void SetIndicatorView(IIndicatorView indicatorView) } internal void UpdateIndicatorsColor() - { + { if (UseShapeIndicator) { return; 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/MauiView.cs b/src/Core/src/Platform/iOS/MauiView.cs index e5b09f47a171..e75efec5ce7b 100644 --- a/src/Core/src/Platform/iOS/MauiView.cs +++ b/src/Core/src/Platform/iOS/MauiView.cs @@ -139,7 +139,7 @@ public override void LayoutSubviews() // But we _do_ need LayoutSubviews to make a measurement pass if the parent is something else (for example, // the window); there's no guarantee that SizeThatFits has been called in that case. if (!IsMeasureValid(widthConstraint, heightConstraint) && !this.IsFinalMeasureHandledBySuperView() || - !HasBeenMeasured() && HasFixedConstraints) + !HasBeenMeasured() && HasFixedConstraints) { CrossPlatformMeasure(widthConstraint, heightConstraint); CacheMeasureConstraints(widthConstraint, heightConstraint); diff --git a/src/Core/src/Platform/iOS/ViewExtensions.cs b/src/Core/src/Platform/iOS/ViewExtensions.cs index b834a925c274..5ae1fe1f275c 100644 --- a/src/Core/src/Platform/iOS/ViewExtensions.cs +++ b/src/Core/src/Platform/iOS/ViewExtensions.cs @@ -744,7 +744,8 @@ void OnLoadedCheck(NSObservedChange? nSObservedChange = null) uiView.BeginInvokeOnMainThread(() => OnLoadedCheck(null)); } } - }; + } + ; return disposable; } @@ -804,7 +805,8 @@ void UnLoadedCheck() disposable = null; action(); } - }; + } + ; return disposable; } @@ -1016,9 +1018,9 @@ internal static float GetDisplayDensity(this UIView? view) => private const nint NativeViewControlledByCrossPlatformLayout = 0x63D2A1; - internal static bool IsFinalMeasureHandledBySuperView(this UIView? view) + 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.Shared/ImageAnalysis/RawBitmap.cs b/src/Core/tests/DeviceTests.Shared/ImageAnalysis/RawBitmap.cs index dcb8a9307faf..bcad39b6a605 100644 --- a/src/Core/tests/DeviceTests.Shared/ImageAnalysis/RawBitmap.cs +++ b/src/Core/tests/DeviceTests.Shared/ImageAnalysis/RawBitmap.cs @@ -82,8 +82,8 @@ private static async Task CaptureView(UIView view) { var renderer = new UIGraphicsImageRenderer(rect.Size, new UIGraphicsImageRendererFormat() { - Opaque = false, - Scale = UIScreen.MainScreen.Scale, + Opaque = false, + Scale = UIScreen.MainScreen.Scale, }); using var image = renderer.CreateImage((context) => 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/DeviceTests/Handlers/WebView/WebViewHandlerTests.cs b/src/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.cs index fabe42c79718..9ed9ee05fa87 100644 --- a/src/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.cs +++ b/src/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.cs @@ -127,9 +127,9 @@ await img.AssertContainsColor(expectedColorInPlayingVideo, imageRect => public async Task WebViewShouldLoadEncodedUrl(string encodedUrl) { if (await AssertionExtensions.SkipTestIfNoInternetConnection()) - { - return; - } + { + return; + } var webView = new WebView(); var tcs = new TaskCompletionSource(); diff --git a/src/Core/tests/DeviceTests/Services/ImageSource/FileImageSourceServiceTests.cs b/src/Core/tests/DeviceTests/Services/ImageSource/FileImageSourceServiceTests.cs index 98bb7e77f582..b060019015f0 100644 --- a/src/Core/tests/DeviceTests/Services/ImageSource/FileImageSourceServiceTests.cs +++ b/src/Core/tests/DeviceTests/Services/ImageSource/FileImageSourceServiceTests.cs @@ -33,18 +33,18 @@ public async Task GetImageAsyncWithResource(string filename, string colorHex) await MainThread.InvokeOnMainThreadAsync(async () => { #endif - var expectedColor = Color.FromArgb(colorHex); + var expectedColor = Color.FromArgb(colorHex); - var service = new FileImageSourceService(); + var service = new FileImageSourceService(); - var imageSource = new FileImageSourceStub(filename); + var imageSource = new FileImageSourceStub(filename); - using var result = await service.GetImageAsync(imageSource); - var image = result.Value; + using var result = await service.GetImageAsync(imageSource); + var image = result.Value; - image.AssertColorAtCenter(expectedColor.ToPlatform()); + image.AssertColorAtCenter(expectedColor.ToPlatform()); #if IOS || MACCATALYST - }); + }); #endif } @@ -58,19 +58,19 @@ public async Task GetImageAsyncWithFile(string colorHex) await MainThread.InvokeOnMainThreadAsync(async () => { #endif - var expectedColor = Color.FromArgb(colorHex); + var expectedColor = Color.FromArgb(colorHex); - var service = new FileImageSourceService(); + var service = new FileImageSourceService(); - var filename = CreateBitmapFile(100, 100, expectedColor); - var imageSource = new FileImageSourceStub(filename); + var filename = CreateBitmapFile(100, 100, expectedColor); + var imageSource = new FileImageSourceStub(filename); - using var result = await service.GetImageAsync(imageSource); - var image = result.Value; + using var result = await service.GetImageAsync(imageSource); + var image = result.Value; - image.AssertColorAtCenter(expectedColor.ToPlatform()); + image.AssertColorAtCenter(expectedColor.ToPlatform()); #if IOS || MACCATALYST - }); + }); #endif } @@ -85,19 +85,19 @@ public async Task GetImageAsyncWithFileLoadsFileInsteadOfResource(string colorHe await MainThread.InvokeOnMainThreadAsync(async () => { #endif - var expectedColor = Color.FromArgb(colorHex); + var expectedColor = Color.FromArgb(colorHex); - var service = new FileImageSourceService(); + var service = new FileImageSourceService(); - var filename = CreateBitmapFile(100, 100, expectedColor, "blue.png"); - var imageSource = new FileImageSourceStub(filename); + var filename = CreateBitmapFile(100, 100, expectedColor, "blue.png"); + var imageSource = new FileImageSourceStub(filename); - using var result = await service.GetImageAsync(imageSource); - var image = result.Value; + using var result = await service.GetImageAsync(imageSource); + var image = result.Value; - image.AssertColorAtCenter(expectedColor.ToPlatform()); + image.AssertColorAtCenter(expectedColor.ToPlatform()); #if IOS || MACCATALYST - }); + }); #endif } #endif diff --git a/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.iOS.cs b/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.iOS.cs index d34277813316..39165c08ce86 100644 --- a/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.iOS.cs +++ b/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.iOS.cs @@ -1,11 +1,11 @@ using System; using System.Threading.Tasks; +using Microsoft.Maui.ApplicationModel; using Microsoft.Maui.DeviceTests.Stubs; using Microsoft.Maui.Graphics; using ObjCRuntime; using UIKit; using Xunit; -using Microsoft.Maui.ApplicationModel; namespace Microsoft.Maui.DeviceTests { 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.cs b/src/TestUtils/src/DeviceTests/AssertionExtensions.cs index feeb7e140452..515d998dc557 100644 --- a/src/TestUtils/src/DeviceTests/AssertionExtensions.cs +++ b/src/TestUtils/src/DeviceTests/AssertionExtensions.cs @@ -1,9 +1,9 @@ using System; +using System.Net.Http; using System.Reflection.Metadata; using System.Text; using System.Threading; using System.Threading.Tasks; -using System.Net.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Maui.Dispatching; using Microsoft.Maui.Platform; @@ -268,38 +268,38 @@ public static async Task AssertEventually(this Func assertion, int timeout } } // Add these methods to AssertionExtensions class - /// - /// Checks if internet connection is available by making an HTTP request - /// - /// True if internet connection is available - public static async Task HasInternetConnection() - { - try - { - using var httpClient = new HttpClient(); - httpClient.Timeout = TimeSpan.FromSeconds(5); - using var response = await httpClient.GetAsync("https://1.1.1.1"); - return response.IsSuccessStatusCode; - } - catch - { - return false; - } - } - - /// - /// Skips the current test if no internet connection is available - /// - /// Custom message to display when skipping the test - /// True if test should be skipped (no internet), false if test can continue - public static async Task SkipTestIfNoInternetConnection(string message = "Test requires internet connection") - { - if (!await HasInternetConnection()) - { - Assert.True(true, $"TEST SKIPPED: {message}"); - return true; // Test should be skipped - } - return false; // Test can proceed - } + /// + /// Checks if internet connection is available by making an HTTP request + /// + /// True if internet connection is available + public static async Task HasInternetConnection() + { + try + { + using var httpClient = new HttpClient(); + httpClient.Timeout = TimeSpan.FromSeconds(5); + using var response = await httpClient.GetAsync("https://1.1.1.1"); + return response.IsSuccessStatusCode; + } + catch + { + return false; + } + } + + /// + /// Skips the current test if no internet connection is available + /// + /// Custom message to display when skipping the test + /// True if test should be skipped (no internet), false if test can continue + public static async Task SkipTestIfNoInternetConnection(string message = "Test requires internet connection") + { + if (!await HasInternetConnection()) + { + Assert.True(true, $"TEST SKIPPED: {message}"); + return true; // Test should be skipped + } + return false; // Test can proceed + } } } 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); diff --git a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs index ed542ee88721..3dbf018c8660 100644 --- a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs +++ b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs @@ -814,7 +814,7 @@ public static bool WaitForTextToBePresentInElement(this IApp app, string automat while (true) { var element = app.FindElements(automationId).FirstOrDefault(); - + if (element is not null && element.TryGetText(out var s) && s.Contains(text, StringComparison.OrdinalIgnoreCase)) { return true;