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
72 changes: 72 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue31063.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 31063, "IndicatorView remains interactive even when IsEnabled is False", PlatformAffected.Android)]
public partial class Issue31063 : ContentPage
{
CarouselView _carouselView;
IndicatorView _indicatorView;

public Issue31063()
{
// Create StackLayout
var stackLayout = new StackLayout
{
Padding = 20,
Spacing = 20
};

// CarouselView
_carouselView = new CarouselView
{
HeightRequest = 200,
ItemsSource = new string[]
{
"Item 1", "Item 2", "Item 3", "Item 4", "Item 5"
},
ItemTemplate = new DataTemplate(() =>
{
var label = new Label
{
FontSize = 30,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Padding = 20
};
label.SetBinding(Label.TextProperty, ".");
return label;
})
};

// IndicatorView
_indicatorView = new IndicatorView
{
AutomationId = "TestIndicatorView",
IndicatorColor = Colors.LightGray,
SelectedIndicatorColor = Colors.Blue,
IndicatorSize = 25,
IsEnabled = false,
HorizontalOptions = LayoutOptions.Center
};

// Bind Indicator to Carousel
_indicatorView.SetBinding(IndicatorView.ItemsSourceProperty, new Binding
{
Source = _carouselView,
Path = "ItemsSource"
});

_indicatorView.SetBinding(IndicatorView.PositionProperty, new Binding
{
Source = _carouselView,
Path = "Position",
Mode = BindingMode.TwoWay
});

// Add children
stackLayout.Children.Add(_carouselView);
stackLayout.Children.Add(_indicatorView);

// Set Content
Content = stackLayout;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#if TEST_FAILS_ON_WINDOWS // IndicatorView UI automation not working on Windows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a new issue related with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsuarezruiz, I’ve created an issue for this #31666

using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue31063 : _IssuesUITest
{
public override string Issue => "IndicatorView remains interactive even when IsEnabled is False";

public Issue31063(TestDevice device) : base(device)
{
}

[Test]
[Category(UITestCategories.IndicatorView)]
public void IndicatorViewShouldRespectIsEnabledProperty()
{
App.WaitForElement("TestIndicatorView");
App.Tap("TestIndicatorView");
App.WaitForElement("Item 1");
}
}
#endif
2 changes: 1 addition & 1 deletion src/Core/src/Platform/Android/MauiPageControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void UpdateIndicatorCount()

imageView.SetOnClickListener(new TEditClickListener(view =>
{
if (view?.Tag != null)
if (_indicatorView.IsEnabled && view?.Tag != null)
{
var position = (int)view.Tag;
_indicatorView.Position = position;
Expand Down
Loading