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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,13 @@ public void UpdateLayout(UICollectionViewLayout newLayout)
ScrollDirection = compositionalLayout.Configuration.ScrollDirection;
}

// Preserve the content offset before updating the layout.
// SetCollectionViewLayout with animated:false can unexpectedly shift the content offset
// on UICollectionViewCompositionalLayout with estimated item sizes.
var savedOffset = CollectionView.ContentOffset;

ItemsViewLayout = newLayout;
_initialized = false;

EnsureLayoutInitialized();

if (_initialized)
{
// Restore the content offset that may have been changed by SetCollectionViewLayout
CollectionView.ContentOffset = savedOffset;
// Reload the data so the currently visible cells get laid out according to the new layout
ReloadData();
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ public class CollectionViewViewModel : INotifyPropertyChanged

public ICommand AddItemCommand { get; }

public CollectionViewViewModel()
public CollectionViewViewModel(bool isScrollingFeatureTest = false)
{
LoadItems();
LoadItems(isScrollingFeatureTest);

AddItemCommand = new Command(AddItem);

Expand Down Expand Up @@ -640,7 +640,7 @@ public bool IsItemTemplateSelected
}
}

private void LoadItems()
private void LoadItems(bool isScrollingFeatureTest = false)
{
_observableCollection = new ObservableCollection<CollectionViewTestItem>();
AddItems(_observableCollection, 7, "Fruits");
Expand Down Expand Up @@ -676,8 +676,8 @@ private void LoadItems()
new Grouping<string, CollectionViewTestItem>("Fruits", new List<CollectionViewTestItem>()),
new Grouping<string, CollectionViewTestItem>("Vegetables", new List<CollectionViewTestItem>())
};
AddItems(_groupedList[0], 20, "Fruits");
AddItems(_groupedList[1], 20, "Vegetables");
AddItems(_groupedList[0], isScrollingFeatureTest ? 20 : 4, "Fruits");
AddItems(_groupedList[1], isScrollingFeatureTest ? 20 : 4, "Vegetables");

_observableCollection3 = new ObservableCollection<CollectionViewTestItem>();
AddItems(_observableCollection3, 15, "Fruits");
Expand All @@ -689,8 +689,8 @@ private void LoadItems()
new Grouping<string, CollectionViewTestItem>("Vegetables", new List<CollectionViewTestItem>())

};
AddItems(_groupedList3[0], 25, "Fruits");
AddItems(_groupedList3[1], 25, "Vegetables");
AddItems(_groupedList3[0], isScrollingFeatureTest ? 25 : 12, "Fruits");
AddItems(_groupedList3[1], isScrollingFeatureTest ? 25 : 12, "Vegetables");

_groupedList2 = new List<Grouping<string, ItemModel>>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ public partial class CollectionViewScrollPage : ContentPage
public CollectionViewScrollPage()
{
InitializeComponent();
_viewModel = new CollectionViewViewModel();
_viewModel = new CollectionViewViewModel(isScrollingFeatureTest: true);
_viewModel.ItemsSourceType = ItemsSourceType.ObservableCollectionT3;
BindingContext = _viewModel;
}

private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
BindingContext = _viewModel = new CollectionViewViewModel();
BindingContext = _viewModel = new CollectionViewViewModel(isScrollingFeatureTest: true);
_viewModel.ItemsSourceType = ItemsSourceType.ObservableCollectionT3;
_viewModel.ScrollToPosition = ScrollToPosition.MakeVisible;
ResetScrollEventLabels();
Expand Down
1 change: 0 additions & 1 deletion src/Controls/tests/TestCases.HostApp/Issues/Issue29484.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ protected override void Init()

Grid grid = new Grid
{
HorizontalOptions = LayoutOptions.Center,
RowDefinitions =
{
new RowDefinition { Height = GridLength.Auto },
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/tests/TestCases.HostApp/Issues/Issue33604.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Issue33604Page()
var topView = new ContentView { BackgroundColor = Colors.Plum, Content = topLabel };
topView.SafeAreaEdges = new SafeAreaEdges(SafeAreaRegions.Container);

var collectionView = new CollectionView
var collectionView = new CollectionView2
{
AutomationId = "TestCollectionView",
BackgroundColor = Colors.Red,
Expand Down
4 changes: 2 additions & 2 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue34636.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public class Issue34636 : ContentPage

readonly ObservableCollection<MonkeyItem> _items = new(MonkeyData);
readonly LinearItemsLayout _itemsLayout = new(ItemsLayoutOrientation.Vertical) { ItemSpacing = 0 };
CollectionView _collectionView;
CollectionView2 _collectionView;

public Issue34636()
{
Title = "CollectionView ItemSpacing regression";

_collectionView = new CollectionView
_collectionView = new CollectionView2
{
AutomationId = "MonkeyCollectionView",
ItemsSource = _items,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ public void VerifyKeepLastItemInViewWithGroupedListWhenHorizontalGrid()
#endif
#endif

#if TEST_FAILS_ON_ANDROID
#if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_WINDOWS // In windows, related issue: https://github.com/dotnet/maui/issues/34772
//[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)]
Expand Down Expand Up @@ -1297,6 +1297,9 @@ public void VerifyFlowDirectionRTLAndKeepScrollOffsetWithGroupedList()
App.WaitForElement("CollectionViewControl");
App.ScrollDown("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500);
App.ScrollDown("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500);
#if MACCATALYST
App.ScrollDown("CollectionViewControl", ScrollStrategy.Gesture, 0.9, 500);
#endif
App.WaitForElement(AddButton);
App.Tap(AddButton);
App.WaitForNoElement("WaterMelon");
Expand Down Expand Up @@ -1574,6 +1577,7 @@ public void VerifyDefaultScrollToRequested()
}

// ScrollTo By Index Tests
#if TEST_FAILS_ON_WINDOWS // Related issue: https://github.com/dotnet/maui/issues/34772
[Test]
[Category(UITestCategories.CollectionView)]
public void VerifyScrollToByIndexWithMakeVisiblePositionAndVerticalList_Carrot()
Expand Down Expand Up @@ -1786,6 +1790,7 @@ public void VerifyScrollToByItemWithEndPositionAndVerticalList_Carrot()
Assert.That(App.WaitForElement("ItemLabel").GetText(), Is.EqualTo("Carrot"));
VerifyScreenshot();
}
#endif

// Grouped ScrollTo By Index Tests
#if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_IOS // Issue - https://github.com/dotnet/maui/issues/17664
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,10 @@ public void BackButtonBehavior_CommandParameter_CommandFiresWithCorrectParameter
[Test, Order(50)]
public void BackButtonBehavior_IsEnabled_False_BackButtonDoesNotNavigate()
{
if (iOS26OrHigher)
{
Assert.Ignore("Fails on iOS 26 due to bug issue: https://github.com/dotnet/maui/issues/34771");
}
App.WaitForElement("MainPageIdentityLabel");
App.WaitForElement("IsEnabledButton");
App.Tap("IsEnabledButton");
Expand All @@ -905,6 +909,10 @@ public void BackButtonBehavior_IsEnabled_False_BackButtonDoesNotNavigate()
[Test, Order(51)]
public void BackButtonBehavior_IsVisible_False_ProgrammaticNavStillWorks()
{
if (iOS26OrHigher)
{
Assert.Ignore("Fails on iOS 26 due to bug issue: https://github.com/dotnet/maui/issues/34771");
}
App.WaitForElement("MainPageIdentityLabel");
App.WaitForElement("IsVisibleButton");
App.Tap("IsVisibleButton");
Expand All @@ -917,6 +925,10 @@ public void BackButtonBehavior_IsVisible_False_ProgrammaticNavStillWorks()
[Test, Order(52)]
public void BackButtonBehavior_IconOverride_CustomIconShownOnBackButton()
{
if (iOS26OrHigher)
{
NavigateToDetail1AndWait();
}
App.WaitForElement("Detail1GoBackButton");
App.Tap("Detail1GoBackButton");
App.WaitForElement("MainPageIdentityLabel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,12 @@ public void Stepper_ValueChanged_ShouldFire_WhenValueIsClampedToMinimum()
App.WaitForElement("Options");
App.Tap("Options");

App.WaitForElement("MinimumEntry");
App.ClearText("MinimumEntry");
App.EnterText("MinimumEntry", "5");
App.PressEnter();

App.WaitForElement("Apply");
App.Tap("Apply");
App.WaitForElement("Options");

Expand All @@ -385,14 +387,17 @@ public void Stepper_ValueChanged_ShouldFire_WhenValueIsClampedToMaximum()
App.WaitForElement("Options");
App.Tap("Options");

App.WaitForElement("MaximumEntry");
App.ClearText("MaximumEntry");
App.EnterText("MaximumEntry", "10");
App.PressEnter();

App.WaitForElement("ValueEntry");
App.ClearText("ValueEntry");
App.EnterText("ValueEntry", "50");
App.PressEnter();

App.WaitForElement("Apply");
App.Tap("Apply");
App.WaitForElement("Options");

Expand All @@ -408,6 +413,7 @@ public void Stepper_ValueChanged_Arguments_NotRaised_WhenDisabled()
App.Tap("Options");
App.WaitForElement("IsEnabledFalseRadio");
App.Tap("IsEnabledFalseRadio");
App.WaitForElement("Apply");
App.Tap("Apply");

App.WaitForElement("Options");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ public void TabbedPage_MoreButton_Verify()
VerifyScreenshot(TestContext.CurrentContext.Test.MethodName + "_2");
}
#endif

#if TEST_FAILS_ON_WINDOWS // Issue Link : https://github.com/dotnet/maui/issues/14572
[Test, Order(21)]
public void TabbedPage_AddTab_Verify()
{
Expand All @@ -345,6 +347,7 @@ public void TabbedPage_AddTab_Verify()
App.WaitForElement("Tab7Label");
}
#endif
#endif

#if TEST_FAILS_ON_WINDOWS // Issue Link - https://github.com/dotnet/maui/issues/14572

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// On Windows, AutomationId is not working for RefreshView (layout) used in this test
// (https://github.com/dotnet/maui/issues/4715)
#if TEST_FAILS_ON_WINDOWS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand Down Expand Up @@ -30,3 +33,4 @@ public void CollectionViewDoesNotExceedAvailableWidth()
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ public void ApplyQueryAttributeShouldTriggerforPushAndPopButton()
{
App.WaitForElement("HomePageTestLabel");
App.Tap("PushAsyncButton");
App.WaitForElement("InnerPageTestLabel");
// Verify ApplyQueryAttributes triggers on InnerPage when navigating via PushAsync
var result = App.WaitForElement("InnerPageTestLabel").GetText();
Assert.That(result, Is.EqualTo("Issue13537InnerPage QueryAttribute is triggered"));
App.Tap("PopAsyncButton");
var result = App.WaitForElement("HomePageTestLabel").GetText();
Assert.That(result, Is.EqualTo("Issue13537HomePage QueryAttribute is triggered"));
App.WaitForElement("HomePageTestLabel");
}

#if TEST_FAILS_ON_CATALYST
Expand All @@ -37,14 +38,15 @@ public void ApplyQueryAttributeShouldTriggerforPushAndBackButton()
{
App.WaitForElement("HomePageTestLabel");
App.Tap("PushAsyncButton");
App.WaitForElement("InnerPageTestLabel");
// Verify ApplyQueryAttributes triggers on InnerPage when navigating via PushAsync
var result = App.WaitForElement("InnerPageTestLabel").GetText();
Assert.That(result, Is.EqualTo("Issue13537InnerPage QueryAttribute is triggered"));
#if IOS
App.Back();
#else
App.TapBackArrow(backButtonIdentifier);
#endif
var result = App.WaitForElement("HomePageTestLabel").GetText();
Assert.That(result, Is.EqualTo("Issue13537HomePage QueryAttribute is triggered"));
App.WaitForElement("HomePageTestLabel");
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ public Issue16767_Resize(TestDevice testDevice) : base(testDevice)
public override string Issue => "Resize function in W2DImage class";
protected override bool ResetAfterEachTest => true;

#if TEST_FAILS_ON_IOS //Issue Link - https://github.com/dotnet/maui/issues/34755
[Test]
[Category(UITestCategories.GraphicsView)]
public void ImagePaintWithResizeModeFit()
{
App.WaitForElement("ResizeModeFit");
VerifyScreenshot();
}
#endif

[Test]
[Category(UITestCategories.GraphicsView)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// On Windows, the default FlyoutLayoutBehavior is Split mode, so the flyout is always visible and IsGestureEnabled has no effect.
// Reference: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/pages/flyoutpage?view=net-maui-10.0#layout-behavior
#if TEST_FAILS_ON_WINDOWS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand Down Expand Up @@ -27,3 +30,4 @@ public void FlyoutPageIsGestureEnabledShouldPreventSwipeGesture()
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;
public class Issue22060 : _IssuesUITest
{
public override string Issue => "Flyout icon and content page title disappeared after focusing on the search handler";

bool iOS26OrHigher => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp);
public Issue22060(TestDevice device) : base(device)
{
}
Expand All @@ -18,7 +18,14 @@ public void ShouldAppearFlyoutIconAndContentPageTitle()
{
App.EnterTextInShellSearchHandler("Hello");
#if IOS // When the search handler is focused, the Cancel button is displayed on the right side of the search bar only on the iOS platform.
App.Tap("Cancel");
if(iOS26OrHigher)
{
App.Tap("Close");
}
else
{
App.Tap("Cancel");
}
#endif
VerifyScreenshot();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST // Issue link: https://github.com/dotnet/maui/issues/34785
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -20,3 +21,4 @@ public void Issue23377ItemSpacing()
VerifyScreenshot();
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ public Issue28722(TestDevice testDevice) : base(testDevice)
[Category(UITestCategories.Shell)]
public void IsEnabledShouldWorkInBackButtonBehavior()
{
App.WaitForElement("Click");
App.Click("Click");
NavigateBack();
App.WaitForElement("HelloLabel");
App.Click("Click");

NavigateBack();
App.WaitForElement("HelloLabel");
}

// On Windows, BackButtonBehavior.TextOverride is not supported (https://github.com/dotnet/maui/issues/1625),
// so the "Click" element does not exist. Use TapBackArrow to navigate back instead.
void NavigateBack()
{
#if WINDOWS
App.TapBackArrow();
#elif ANDROID
App.TapBackArrow("Click");
#else
App.WaitForElement("Click");
App.Click("Click");
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// On Windows, AutomationId for Layout elements is not working (https://github.com/dotnet/maui/issues/4715)
#if TEST_FAILS_ON_WINDOWS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand Down Expand Up @@ -71,3 +73,4 @@ public void DynamicWidthRequestUpdatesFlexLayoutItems()
}
}
}
#endif
Loading
Loading